From 75400c4065b53f078da7051a6f56c59eb58dda59 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:08:32 -0500 Subject: [PATCH 01/39] Serialize annotations out in full. --- prototype/doubt-difftool/main.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index ecbbb361d..a109c1e35 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -162,8 +162,8 @@ case .Split: "after": .String(bSource.contents), "diff": diff.JSON(pure: { $0.JSON { $0.JSON(annotation: { $0.range.JSON }, leaf: Doubt.JSON.String) } }, leaf: Doubt.JSON.String, annotation: { [ - "before": $0.range.JSON, - "after": $1.range.JSON, + "before": $0.JSON, + "after": $1.JSON, ] }), ] From efc90df9eed4ac6a53720f9f5ace8787d27ed2ec Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:09:01 -0500 Subject: [PATCH 02/39] I guess this was deleted. --- prototype/UI/dom.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 prototype/UI/dom.js diff --git a/prototype/UI/dom.js b/prototype/UI/dom.js deleted file mode 100644 index e69de29bb..000000000 From 5d15e3c88da2889f0efd87f7ebccd7cfbc3be51d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:11:50 -0500 Subject: [PATCH 03/39] dom.js is gone. --- prototype/UI/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 3bcd72d54..80330ff2c 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -47,7 +47,6 @@ - From 9be365ce3033ca16ebc82961743e5e2196876649 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:12:35 -0500 Subject: [PATCH 04/39] Indentation. --- prototype/UI/index.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 80330ff2c..0bb8bdb96 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -29,10 +29,11 @@ background-color: #ffffec; outline: 1px solid #e9e9c0; } - .invisible { - background-color: #fff; - visibility: hidden; - } + + .invisible { + background-color: #fff; + visibility: hidden; + } .diff div, .diff ul, .diff li, .diff dl, .diff dd, .diff span { white-space: pre-wrap; @@ -65,16 +66,15 @@ -
-
+
+
From edcb850f93f42f2efaa626c67a5b9cfc304b37d2 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:20:01 -0500 Subject: [PATCH 05/39] Extract range & categories. --- prototype/UI/diff.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index fa4448879..845cf2c23 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -205,7 +205,14 @@ function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { function rollToDOM(sources, rollOrTerm, getRangeFun, diffToDOMFun) { var syntax = rollOrTerm.unwrap - var range = rollOrTerm.extract + var categories = { + before: rollOrTerm.extract.before.categories, + after: rollOrTerm.extract.after.categories + } + var range = { + before: rollOrTerm.extract.before.range, + after: rollOrTerm.extract.after.range + } var elementA; var elementB; From ad3462b13579ca92071052707f15e94f21d862ef Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:20:38 -0500 Subject: [PATCH 06/39] Terms are annotated with their categories in the JSON too. --- prototype/doubt-difftool/main.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index a109c1e35..425c9d1d0 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -160,7 +160,7 @@ case .Split: let JSON: Doubt.JSON = [ "before": .String(aSource.contents), "after": .String(bSource.contents), - "diff": diff.JSON(pure: { $0.JSON { $0.JSON(annotation: { $0.range.JSON }, leaf: Doubt.JSON.String) } }, leaf: Doubt.JSON.String, annotation: { + "diff": diff.JSON(pure: { $0.JSON { $0.JSON(annotation: { $0.JSON }, leaf: Doubt.JSON.String) } }, leaf: Doubt.JSON.String, annotation: { [ "before": $0.JSON, "after": $1.JSON, From 4a31774d983ff7033ab568669e1f8c2dc9ab2f9d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:58:59 -0500 Subject: [PATCH 07/39] Extract the correct ranges. --- prototype/UI/diff.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 845cf2c23..2b1388248 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -137,11 +137,11 @@ function diffToDOM(diff, sources) { if (diffOrTerm.pure != null) { var beforeRange, afterRange; if (diffOrTerm.pure.before != null) { - beforeRange = diffOrTerm.pure.before.extract + beforeRange = diffOrTerm.pure.before.extract.range } if (diffOrTerm.pure.after != null) { - afterRange = diffOrTerm.pure.after.extract + afterRange = diffOrTerm.pure.after.extract.range } if (beforeRange == null) { @@ -154,10 +154,10 @@ function diffToDOM(diff, sources) { return { "before": beforeRange, "after": afterRange }; } if (diffOrTerm.roll != null) { - return diffOrTerm.roll.extract; + return { before: diffOrTerm.roll.extract.before.range, after: diffOrTerm.roll.extract.after.range }; } if (diffOrTerm.extract != null) { - return diffOrTerm.extract; + return diffOrTerm.extract.range; } } From 4ff4f570bdaf1a76e873f6c49d4e756c18188971 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 13:59:57 -0500 Subject: [PATCH 08/39] We no longer use termToDOM. --- prototype/UI/term.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/prototype/UI/term.js b/prototype/UI/term.js index 10dae6208..f0e834616 100644 --- a/prototype/UI/term.js +++ b/prototype/UI/term.js @@ -12,12 +12,3 @@ function Term(object) { this.unwrap = object.unwrap; return this; } - -/// Term -> String -> DOM -function termToDOM(term, which, source) { - return rangeAndSyntaxToDOM(term.range, term.unwrap, source, function(term) { - return term.range; - }, function(term) { - return termToDOM(term, which, source); - }); -} From 547ab8d3d25602df8c1bacf3545a8907a1f54ed4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:03:55 -0500 Subject: [PATCH 09/39] Unpack the ranges. --- prototype/UI/diff.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 2b1388248..2226fa0dc 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -175,7 +175,7 @@ function diffToDOM(diff, sources) { function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { var elementA, elementB; if (patch.before != null) { - elementA = rangeAndSyntaxToDOM(sources.before, patch.before.unwrap, patch.before.extract, getRangeFun); + elementA = rangeAndSyntaxToDOM(sources.before, patch.before.unwrap, patch.before.extract.range, getRangeFun); elementA.classList.add("delete"); if (patch.after != null) { elementA.classList.add("replace"); @@ -183,7 +183,7 @@ function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { } if (patch.after != null) { - elementB = rangeAndSyntaxToDOM(sources.after, patch.after.unwrap, patch.after.extract, getRangeFun); + elementB = rangeAndSyntaxToDOM(sources.after, patch.after.unwrap, patch.after.extract.range, getRangeFun); elementB.classList.add("insert"); if (patch.before != null) { elementB.classList.add("replace"); From 880d51ffd8a628f95b19b5309bd52cdab4060bb5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:08:32 -0500 Subject: [PATCH 10/39] Add CSS classes for the various categories. --- prototype/UI/diff.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 2226fa0dc..750726577 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -436,6 +436,14 @@ function rollToDOM(sources, rollOrTerm, getRangeFun, diffToDOMFun) { elementB.appendChild(document.createTextNode(textB)); } + for (index in categories.before) { + elementA.classList.add('category-'+categories.before[index]); + } + + for (index in categories.after) { + elementB.classList.add('category-'+categories.after[index]); + } + return { "before": elementA, "after": elementB } } From 2d18d653c89b4f660ce97f773ed74a619bb66cfd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:12:41 -0500 Subject: [PATCH 11/39] Highlight strings. --- prototype/UI/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 0bb8bdb96..6ed089e1b 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -45,6 +45,11 @@ .diff dt { display: none; } + + /* syntax highlighting */ + .category-string { + color: #183691; + } From 2081b7447fa7491fe1c2a3f0e0644896f63a6a51 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:12:45 -0500 Subject: [PATCH 12/39] Highlight numbers. --- prototype/UI/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 6ed089e1b..6ad911832 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -50,6 +50,10 @@ .category-string { color: #183691; } + + .category-number { + color: #0086b3; + } From 0c9698c75dd5937e82ef444844fcc4775a5bbe69 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:31:22 -0500 Subject: [PATCH 13/39] Prefix the highlighting selectors with `.diff`. --- prototype/UI/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 6ad911832..a7e4797d1 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -47,11 +47,11 @@ } /* syntax highlighting */ - .category-string { + .diff .category-string { color: #183691; } - .category-number { + .diff .category-number { color: #0086b3; } From ad9e9f7a1de263133eaebbd22e16004a8b3f375d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:31:36 -0500 Subject: [PATCH 14/39] =?UTF-8?q?Don=E2=80=99t=20inherit=20syntax=20highli?= =?UTF-8?q?ghting=20by=20default.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index a7e4797d1..8e05da481 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -40,6 +40,7 @@ display: inline; margin: 0; padding: 0; + color: initial; } .diff dt { From 4deba674048c2bcb1de0551f7d6755145c0a10c4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:35:12 -0500 Subject: [PATCH 15/39] Highlight member accesses. --- prototype/UI/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 8e05da481..fa28f7454 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -55,6 +55,10 @@ .diff .category-number { color: #0086b3; } + + .diff .category-member_access :not(:first-child) .category-identifier { + color: #0086b3; + } From fbeee38bd4c1cd66eb380df545494b87b6d732fb Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:35:19 -0500 Subject: [PATCH 16/39] Highlight comments. --- prototype/UI/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index fa28f7454..ae2d9b905 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -59,6 +59,10 @@ .diff .category-member_access :not(:first-child) .category-identifier { color: #0086b3; } + + .diff .category-comment { + color: #969896; + } From 9b78911a04cba5785a5001e0bb44bfa97be82e81 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:40:37 -0500 Subject: [PATCH 17/39] Highlight a bunch of operators and statements. --- prototype/UI/index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index ae2d9b905..4d4369b90 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -63,6 +63,17 @@ .diff .category-comment { color: #969896; } + + .diff .category-bool_op, + .diff .category-type_op, + .diff .category-var_declaration, + .diff .category-if_statement, + .diff .category-do_statement, + .diff .category-for_statement, + .diff .category-return_statement, + .diff .category-function { + color: #a71d5d; + } From eca1b0e2b2cfde377e402bfa89a1ee5c6d71bf16 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:48:22 -0500 Subject: [PATCH 18/39] Match member access a little more carefully. --- prototype/UI/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 4d4369b90..00d676441 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -56,7 +56,7 @@ color: #0086b3; } - .diff .category-member_access :not(:first-child) .category-identifier { + .diff .category-member_access>:not(:first-child)>.category-identifier { color: #0086b3; } From 684a6f24ae7d12268c9b307c9437821b2a24dd99 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:48:30 -0500 Subject: [PATCH 19/39] Match member assignment a little more carefully. --- prototype/UI/index.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 00d676441..72c11cb6c 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -74,6 +74,10 @@ .diff .category-function { color: #a71d5d; } + + .diff .category-assignment>li>.category-member_access:first-of-type>:not(:first-child)>.category-identifier { + color: #795da3; + } From f006b7f95cdcba815c329474448d904672b3a905 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:49:45 -0500 Subject: [PATCH 20/39] Only match the assigned-to property with this rule. --- prototype/UI/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 72c11cb6c..dd29a9ca9 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -75,7 +75,7 @@ color: #a71d5d; } - .diff .category-assignment>li>.category-member_access:first-of-type>:not(:first-child)>.category-identifier { + .diff .category-assignment>li:first-child>.category-member_access>:not(:first-child)>.category-identifier { color: #795da3; } From e1a4a97c469cdffa9e154da4e2615bc2a400bc07 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:51:41 -0500 Subject: [PATCH 21/39] Highlight keys in objects. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index dd29a9ca9..480da39ca 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -75,6 +75,7 @@ color: #a71d5d; } + .diff .category-pair>li:first-child>.category-identifier, .diff .category-assignment>li:first-child>.category-member_access>:not(:first-child)>.category-identifier { color: #795da3; } From 440a7326fb937c1feef8a814b418f63c9b68abcd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:54:28 -0500 Subject: [PATCH 22/39] Highlight true and false. --- prototype/UI/index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 480da39ca..8a7f617de 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -52,10 +52,9 @@ color: #183691; } - .diff .category-number { - color: #0086b3; - } - + .diff .category-false, + .diff .category-true, + .diff .category-number, .diff .category-member_access>:not(:first-child)>.category-identifier { color: #0086b3; } From 50c7575ecde964f17b84e008a4c080dc99c09c92 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:55:51 -0500 Subject: [PATCH 23/39] Highlight ternaries. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 8a7f617de..05e7e9a59 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -65,6 +65,7 @@ .diff .category-bool_op, .diff .category-type_op, + .diff .category-ternary, .diff .category-var_declaration, .diff .category-if_statement, .diff .category-do_statement, From 767aecd6907ff30fdb2db69514ed8848cc981597 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:56:52 -0500 Subject: [PATCH 24/39] Highlight relational operators. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 05e7e9a59..e14c05eb0 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -65,6 +65,7 @@ .diff .category-bool_op, .diff .category-type_op, + .diff .category-rel_op, .diff .category-ternary, .diff .category-var_declaration, .diff .category-if_statement, From 85e634dbd1542a9b91f258874f5d09d161064f16 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 14:57:22 -0500 Subject: [PATCH 25/39] Highlight assignments. --- prototype/UI/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index e14c05eb0..d62df68a2 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -72,7 +72,9 @@ .diff .category-do_statement, .diff .category-for_statement, .diff .category-return_statement, - .diff .category-function { + .diff .category-function, + .diff .category-assignment, + .diff .category-var_assignment { color: #a71d5d; } From fbf1704425e9e8e212204848a6943eb262614522 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:00:49 -0500 Subject: [PATCH 26/39] Highlight function calls. --- prototype/UI/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index d62df68a2..dbdb15103 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -55,6 +55,8 @@ .diff .category-false, .diff .category-true, .diff .category-number, + .diff .category-function_call>li>.category-identifier, + .diff .category-function_call>li>.category-member_access>.category-identifier, .diff .category-member_access>:not(:first-child)>.category-identifier { color: #0086b3; } From 1216c34d21cbc72bac750e41938f0b37c1db1ce8 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:06:58 -0500 Subject: [PATCH 27/39] Highlight the operators en masse. --- prototype/UI/index.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index dbdb15103..97d701442 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -65,9 +65,7 @@ color: #969896; } - .diff .category-bool_op, - .diff .category-type_op, - .diff .category-rel_op, + .diff [class^="category-"][class$="_op"], .diff .category-ternary, .diff .category-var_declaration, .diff .category-if_statement, From 787cb679b116a3c01b2d9c4b85984cec416abfcd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:07:17 -0500 Subject: [PATCH 28/39] Highlight null. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 97d701442..53ea32501 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -54,6 +54,7 @@ .diff .category-false, .diff .category-true, + .diff .category-null, .diff .category-number, .diff .category-function_call>li>.category-identifier, .diff .category-function_call>li>.category-member_access>.category-identifier, From dbc59507e9550adaf8db241e1cfd17868e521928 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:07:20 -0500 Subject: [PATCH 29/39] Highlight undefined. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 53ea32501..c936a80b8 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -55,6 +55,7 @@ .diff .category-false, .diff .category-true, .diff .category-null, + .diff .category-undefined, .diff .category-number, .diff .category-function_call>li>.category-identifier, .diff .category-function_call>li>.category-member_access>.category-identifier, From a33eec8c58b306959c28f59a066b205f4bbace8c Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:09:50 -0500 Subject: [PATCH 30/39] Highlight `new`. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index c936a80b8..49fe95ef3 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -70,6 +70,7 @@ .diff [class^="category-"][class$="_op"], .diff .category-ternary, .diff .category-var_declaration, + .diff .category-new_expression, .diff .category-if_statement, .diff .category-do_statement, .diff .category-for_statement, From 94c6297026aef3a22e29a701fd69a740af67e44e Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:09:55 -0500 Subject: [PATCH 31/39] Highlight type names. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 49fe95ef3..0e6d01590 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -81,6 +81,7 @@ color: #a71d5d; } + .diff .category-new_expression>li>.category-function_call>li:first-child>.category-identifier, .diff .category-pair>li:first-child>.category-identifier, .diff .category-assignment>li:first-child>.category-member_access>:not(:first-child)>.category-identifier { color: #795da3; From f38da39f865003d80f36d05931c280b53a48d473 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:12:44 -0500 Subject: [PATCH 32/39] Highlight regexps. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 0e6d01590..4b41c33de 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -48,6 +48,7 @@ } /* syntax highlighting */ + .diff .category-regex, .diff .category-string { color: #183691; } From dbeb9073a351ec593153753efe9d7ab046ee1bf5 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:13:39 -0500 Subject: [PATCH 33/39] Highlight function names. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 4b41c33de..86f370461 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -82,6 +82,7 @@ color: #a71d5d; } + .diff .category-function>li:first-child>.category-identifier, .diff .category-new_expression>li>.category-function_call>li:first-child>.category-identifier, .diff .category-pair>li:first-child>.category-identifier, .diff .category-assignment>li:first-child>.category-member_access>:not(:first-child)>.category-identifier { From 5e6c94fd75c4ca1e9f1593e479f4496db103e795 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:16:36 -0500 Subject: [PATCH 34/39] Pass the whole annotation into rangeAndSyntaxToDOM. --- prototype/UI/diff.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 750726577..68fe928d3 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -67,10 +67,11 @@ function wrap(tagName, element) { } /// String -> Syntax a -> Range -> (a -> Range) -> (a -> DOM) -> DOM -function rangeAndSyntaxToDOM(source, syntax, range, getRange, recur) { +function rangeAndSyntaxToDOM(source, syntax, extract, getRange, recur) { recur = recur || function(term) { return rangeAndSyntaxToDOM(source, term.unwrap, term.extract, getRange); } + var range = extract.range; var element; if (syntax.leaf != null) { element = document.createElement("span"); @@ -175,7 +176,7 @@ function diffToDOM(diff, sources) { function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { var elementA, elementB; if (patch.before != null) { - elementA = rangeAndSyntaxToDOM(sources.before, patch.before.unwrap, patch.before.extract.range, getRangeFun); + elementA = rangeAndSyntaxToDOM(sources.before, patch.before.unwrap, patch.before.extract, getRangeFun); elementA.classList.add("delete"); if (patch.after != null) { elementA.classList.add("replace"); @@ -183,7 +184,7 @@ function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { } if (patch.after != null) { - elementB = rangeAndSyntaxToDOM(sources.after, patch.after.unwrap, patch.after.extract.range, getRangeFun); + elementB = rangeAndSyntaxToDOM(sources.after, patch.after.unwrap, patch.after.extract, getRangeFun); elementB.classList.add("insert"); if (patch.before != null) { elementB.classList.add("replace"); From ea96c3d580d929cd24f8f3eabda057c58caa598d Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:16:43 -0500 Subject: [PATCH 35/39] Highlight within patches. --- prototype/UI/diff.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 68fe928d3..399ead7f4 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -71,6 +71,7 @@ function rangeAndSyntaxToDOM(source, syntax, extract, getRange, recur) { recur = recur || function(term) { return rangeAndSyntaxToDOM(source, term.unwrap, term.extract, getRange); } + var categories = extract.categories; var range = extract.range; var element; if (syntax.leaf != null) { @@ -128,6 +129,11 @@ function rangeAndSyntaxToDOM(source, syntax, extract, getRange, recur) { element.appendChild(document.createTextNode(source.substr(previous, range[0] + range[1] - previous))); } element["data-range"] = range; + + for (index in categories) { + element.classList.add('category-'+categories[index]); + } + return element; } From f5c21074c59604c4fafc0ee3cf09140859ca5e94 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:25:52 -0500 Subject: [PATCH 36/39] =?UTF-8?q?Don=E2=80=99t=20flatten=20terms.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prototype/UI/diff.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 399ead7f4..15967df00 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -85,18 +85,9 @@ function rangeAndSyntaxToDOM(source, syntax, extract, getRange, recur) { var child = values[i]; if (child.pure == "") continue; var childRange = getRange(child); - if (childRange.before != null) { - var beforeRange = childRange.before; - element.appendChild(document.createTextNode(source.substr(previous, beforeRange[0] - previous))); - element.appendChild(wrap("li", recur(child))); - previous = beforeRange[0] + beforeRange[1]; - } - if (childRange.after != null) { - var afterRange = childRange.before; - element.appendChild(document.createTextNode(source.substr(previous, afterRange[0] - previous))); - element.appendChild(wrap("td", recur(child))); - previous = afterRange[0] + afterRange[1]; - } + element.appendChild(document.createTextNode(source.substr(previous, childRange[0] - previous))); + element.appendChild(wrap("li", recur(child))); + previous = childRange[0] + childRange[1]; } element.appendChild(document.createTextNode(source.substr(previous, range[0] + range[1] - previous))); } else if (syntax.keyed != null) { From e0968815785ead87781bc182c93e2a97b49b9289 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:26:32 -0500 Subject: [PATCH 37/39] Rename rangeAndSyntaxToDOM. --- prototype/UI/diff.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/prototype/UI/diff.js b/prototype/UI/diff.js index 15967df00..5b50d50fe 100644 --- a/prototype/UI/diff.js +++ b/prototype/UI/diff.js @@ -67,9 +67,9 @@ function wrap(tagName, element) { } /// String -> Syntax a -> Range -> (a -> Range) -> (a -> DOM) -> DOM -function rangeAndSyntaxToDOM(source, syntax, extract, getRange, recur) { +function termToDOM(source, syntax, extract, getRange, recur) { recur = recur || function(term) { - return rangeAndSyntaxToDOM(source, term.unwrap, term.extract, getRange); + return termToDOM(source, term.unwrap, term.extract, getRange); } var categories = extract.categories; var range = extract.range; @@ -173,7 +173,7 @@ function diffToDOM(diff, sources) { function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { var elementA, elementB; if (patch.before != null) { - elementA = rangeAndSyntaxToDOM(sources.before, patch.before.unwrap, patch.before.extract, getRangeFun); + elementA = termToDOM(sources.before, patch.before.unwrap, patch.before.extract, getRangeFun); elementA.classList.add("delete"); if (patch.after != null) { elementA.classList.add("replace"); @@ -181,7 +181,7 @@ function pureToDOM(sources, patch, getRangeFun, diffToDOMFun) { } if (patch.after != null) { - elementB = rangeAndSyntaxToDOM(sources.after, patch.after.unwrap, patch.after.extract, getRangeFun); + elementB = termToDOM(sources.after, patch.after.unwrap, patch.after.extract, getRangeFun); elementB.classList.add("insert"); if (patch.before != null) { elementB.classList.add("replace"); From 9e1ceccc77e1dee3732255f7de7cbac292bf9b8b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:30:34 -0500 Subject: [PATCH 38/39] Highlight for/in statements. --- prototype/UI/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/UI/index.html b/prototype/UI/index.html index 86f370461..3d1b3da27 100644 --- a/prototype/UI/index.html +++ b/prototype/UI/index.html @@ -75,6 +75,7 @@ .diff .category-if_statement, .diff .category-do_statement, .diff .category-for_statement, + .diff .category-for_in_statement, .diff .category-return_statement, .diff .category-function, .diff .category-assignment, From 5b23d62b4873fd994c0fa5cf82651a6b9624b010 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 3 Nov 2015 15:38:59 -0500 Subject: [PATCH 39/39] Split mode. --- .../xcshareddata/xcschemes/doubt-difftool.xcscheme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prototype/Doubt.xcodeproj/xcshareddata/xcschemes/doubt-difftool.xcscheme b/prototype/Doubt.xcodeproj/xcshareddata/xcschemes/doubt-difftool.xcscheme index d39788a85..ffcc5c44d 100644 --- a/prototype/Doubt.xcodeproj/xcshareddata/xcschemes/doubt-difftool.xcscheme +++ b/prototype/Doubt.xcodeproj/xcshareddata/xcschemes/doubt-difftool.xcscheme @@ -64,7 +64,7 @@ + isEnabled = "NO">