This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 93768 - Syntax coloring not updated after custom embedding created
Summary: Syntax coloring not updated after custom embedding created
Status: RESOLVED DUPLICATE of bug 108173
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-01 09:28 UTC by Marek Fukala
Modified: 2007-11-05 13:45 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2007-02-01 09:28:51 UTC
In HTML editor I update the syntax coloring based on HTML parser results. The
parser currently finds <script>...</script> tag and creates custom javascript
embedding for this part by

tokenSequence.createEmbedding(javascriptLanguage, 0, 0);

The embedding is created (the token contains the sub-tokens) but the editor
coloring stays unchanged.

Please look at EmbeddingUpdater class in html/editor module to find more and
possibly debug.

Please try to fix the problem ASAP or let me know how I can handle it.

Thanks.
Comment 1 Vitezslav Stejskal 2007-02-02 03:17:25 UTC
I've done some investigation and found the following. First, the javascript
snippets in html are colored, but their coloring is not accurate. The problem is
not in the syntax highlighting layer nor it is in your code that creates the
custom embedding. The problems are two:

1. As per the general concept text/javascript defines only a few colorings
(js_regularExpression, s_p, method, localVariable) and the definitions are only
partial (eg. +bold or fgColor). That's exactly how it should be and all works
fine for standalone .js files. With embedded javascript the problem is that the
defaults for its colorings are not inherited from 'All Languages', but from
text/html. That's why, for example, all operators (eg. =()@) are green, because
they are green in HTML.

Although I am not sure about the solution, the problem here is in the
inheritance hierarchy I think. I have an odd feeling that the deep inheritance
hierarchy as it is defined today is not very practical. Perhaps we should stick
to something as simple as:

text/html/text/javascript
text/javascript
/

On the other hand this would break the use of trivial embeddings like java
strings, javadocs, etc that people got already used to.
 
2. Second problem is that some of the colorings in javascript are based on the
shliemann parser and the javascript grammar (eg. bold function names or brown
function parameters). Since the schliemann parser ignores html files these
colorings do not work in embedded javascripts. I am affraid that the scope of
this problem and its solution is out of my understanding.

I'll leave this defect with editor to fix the inheritance hierarchy, but I would
suggest to file another one for #2 against the languages module.
Comment 2 Vitezslav Stejskal 2007-10-01 11:19:06 UTC
The change in the MimeLookup hierarchy as described in issue #108173 is pretty much what I suggested here in #1.

*** This issue has been marked as a duplicate of 108173 ***