Put the following into a buffer with Java syntax highlighting, and everything after it will be seen as a string:
class X { Y z = Pattern.compile("(\\d)(\\d{2})"); }
Put the following into a buffer with Java syntax highlighting, and everything after it will be seen as a string:
class X { Y z = Pattern.compile("(\\d)(\\d{2})"); }
I have modified my own JavaScript language to not have this issue. As you can see it renders fine for me.
[pre=#181818]class X { Y z = Pattern.compile("(\d)(\d{2})"); }[/pre]
Try editing your JavaScript.tmLanguage file, line 650 I believe, with this:
[pre=#181818] (?<=\s\,=(:]|^|return|&&||||!)\s*(/)(?!/+{}?]|^/]$)[/pre]
Unfortunately my problem is with the Java syntax highlighting, not the JavaScript one…
Though I’d love to know how (or if?) you made your html tags highlighted like that
Hmm. I will have to take a look at this a bit later. It seems to be breaking down as it is parsing the class. I am not a Java coder, but once I understand the basic rules of a Java class, I should be able to identify where in the syntax the regex breaks down.
If someone doesn’t come up with a solution in the next couple of days before I do, I will let you know how to fix this.
Okay, I think I have a solution.
Starting at line 425 in the Java.tmLanguage, replace the entire “class-body” dict with this:
[pre=#181818] class-body
patterns
include
#comments
include
#class
include
#enums
begin
=
beginCaptures
0
name
keyword.operator.assignment.java
end
;
endCaptures
0
name
punctuation.terminator.java
name
patterns
include
#code
include
#methods
include
#annotations
include
#storage-modifiers
include
#code
[/pre]
This is how it now looks for me.
[pre=#181818]class X { Y z =* Pattern*.compile("(\d)(\d{2})"); }[/pre]
This works for me. It turned out to be more straight forward than I thought it would be.
Great, that seems to do the trick! Thanks a lot for the help – and hope this gets put into the standard syntax definition file for the next release
Keep in mind, I am not 100% sure it is a flawless fix. I did throw it together pretty quick, but it is a least a good temporary fix.