JaroslavTulach closed pull request #431: Make sure the JavaScript coloring prevails inside of Java strings URL: https://github.com/apache/incubator-netbeans/pull/431
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/editor.htmlui/src/org/netbeans/modules/editor/htmlui/JSEmbeddingProvider.java b/editor.htmlui/src/org/netbeans/modules/editor/htmlui/JSEmbeddingProvider.java index a653b97af..2a221cda7 100644 --- a/editor.htmlui/src/org/netbeans/modules/editor/htmlui/JSEmbeddingProvider.java +++ b/editor.htmlui/src/org/netbeans/modules/editor/htmlui/JSEmbeddingProvider.java @@ -89,11 +89,15 @@ public void cancel() { public void run(Parser.Result t, SchedulerEvent se) { canceled.set(false); final CompilationInfo ci = CompilationInfo.get(t); + colorizeJSB(ci); + } + + public static void colorizeJSB(final CompilationInfo ci) { final CompilationUnitTree cu = ci.getCompilationUnit(); final Trees trees = ci.getTrees(); final SourcePositions sp = trees.getSourcePositions(); final Finder f = new Finder(trees); - final List<LiteralTree> result = new ArrayList<LiteralTree>(); + final List<LiteralTree> result = new ArrayList<>(); f.scan(cu, result); if (!result.isEmpty()) { try { @@ -108,6 +112,13 @@ public void run(Parser.Result t, SchedulerEvent se) { final int end = (int) sp.getEndPosition(cu, lt); seq.move(start); while (seq.moveNext() && seq.offset() < end) { + if ( + seq.embedded() != null && + seq.embedded().language() != null && + "text/x-java-string".equals(seq.embedded().language().mimeType()) + ) { + seq.removeEmbedding(seq.embedded().language()); + } seq.createEmbedding(javaScript, 1, 1, true); } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists