Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 377102

Summary: [Compare]Word diff annotation is hidden in html files.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: mamacdon, Silenio_Quarti, susan
Version: 0.4   
Target Milestone: 0.5 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2012-04-18 11:42:11 EDT
If you change an html file, there are some special invisible range style annotations generated by syntax highlighter that are racing with word diff annotations. Basically in html file, all the range annotations generated by compare widget are hidden.
I tried to use syntaxHilighter.setup().then(/*render all the annotations*/) to make sure they are generated after syntax highlighting but it did not help.
Comment 1 libing wang CLA 2012-04-18 11:51:30 EDT
got a pathc from mark and tested it , fixed the issue.
diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
index 2462ae5..23b817e 100644
--- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
+++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js
@@ -25,7 +25,6 @@ define("orion/editor/htmlGrammar", [], function() {
 		 * @type Object
 		 */
 		return {
-			"name": "HTML",
 			"scopeName": "source.html",
 			"uuid": "3B5C76FB-EBB5-D930-F40C-047D082CE99B",
 			"patterns": [
Comment 2 libing wang CLA 2012-04-18 11:57:30 EDT
Took Mark's patch and fixed it.
But I think we should have a smarter merging policy. Bug 376775.
Comment 3 Mark Macdonald CLA 2012-04-18 12:11:32 EDT
The HTML grammar applied a global stylerange (class "HTML" ) to every line of an .html file. These were overwriting the style ranges used to mark up word diffs.

The patch in Comment 2 removes these global HTML ranges (which is reasonable, they were not used for anything).

But we should still investigate what is going on in the merging of style ranges. I think that overlapping ranges could simply have their styleClasses merged rather than making 1 range clobber the other.
Comment 4 libing wang CLA 2012-04-30 15:53:59 EDT
Susan pointed out that she could see the issue.
I tried both my localhost and orion.eclipse.
1.Reload all plugins.
2.Change an html file and go to status page. 
3.Click on the  html file and see the inline compare.

In my local host I could see the word diff annotation but syntax is not highlighted.

In orion.eclipse.org,  I could see syntax highlighted but the word diff annotation was hidden.

Weird...
Comment 5 libing wang CLA 2012-04-30 16:43:52 EDT
Talked to Silenio, the annotations created by compare widget have to always come after syntaxHighlighter creates all the range styles.
It has to follow the syntaxHighlither.setup().then(create diff annotations) pattern.
In html files, it just so happened that the syntax range style creation happens after diff annotations are created.

I will use  syntaxHighlither.setup().then pattern to completely fix this bug.
Comment 6 libing wang CLA 2012-04-30 16:57:47 EDT
Additional info:
The previous version that made me think it was fixed:
My word diff was not really a key word that got highlighted by html grammar, which occasionally did not have overlap.
Comment 8 libing wang CLA 2012-05-01 11:57:04 EDT
can be verified with commit page on 8dfd02c90be3d949edf546e6ab62ade79466e61e.
There a lot of html changes.