Sublime Forum

Syntax not working anymore

#1

The syntax that i made works very well berfore the 3103, what i can gather is that when it have two scopes with the same begining it’s not working, like you can see below.

Pay attention on the scope description, the focus is on the procedure word.
I used the shift+ctrl+alt+p to see the scope.

Version 3103


Version 3083

My question is it’s really a 3103 bug, new feature?
I need to know what are my next steps.

https://bitbucket.org/JeisonJHA/sublime-delphi-language

0 Likes

#2

Can you please provide your sample file?

0 Likes

#3

One thing to note: .tmLanguage is now deprecated, so you might want to switch to the new language (you can easily convert you syntax to the new one with the menu tools -> create new syntax from xxx : it appears if your current open file is highlighted by your syntax file).

0 Likes

#4

@FichteFoll
This code is a example from Embarcadero you can copy and paste it to test.

Code Example

@Clams
Like http://www.sublimetext.com/docs/3/syntax.html says:
“Sublime Text can use both .sublime-syntax and .tmLanguage files for syntax highlighting.”
So I think it should continue working.

Thank you both for reply so fast!

0 Likes

#5

I took a look at it, but I can’t spot anything obvious. What I can tell:

  1. It works in ST2, but it does not in ST3.
  2. Highlighting is errorneous starting in line 99 where the fist “procedure” is only matched until source.delphi unit.block.delphi implementation.block.delphi function.implementation.delphi.
  3. The only match in #methoddeclaration does not seem to match there, although being included by the pattern defining function.implementation.delphi.
  4. Definitely a regression from the new regex engine.
0 Likes

ST stopped remembering syntax ater update (Build 3103)
#6

I had the same issue with my pascal.tmLanguage file that I lovingly updated being ignored, even though it was in the user folder. After I upgraded I noticed that there was a new pascal.sublime-syntax file and this was being used instead of my tmLanguage file. That is, my old syntax definition was being overridden.

I fixed this by using PackageResourceViewer to copy the Pascal.sublime-syntax file to go into my user directory, and then updated it with my desired changes. Now it all works as it used to. The new sublime-syntax definitions really are much better, but I wish ST3 would highlight it the same way it used to highlight the older YAML-tmLanguage files with its hidden syntax highlighting.

0 Likes

#7

I have plans for that, but no time for it yet. You can subscribe to https://github.com/SublimeText/PackageDev/issues/57 if you want to stay updated.

Other than that, Sublime Text does not provide a Delphi syntax definition by default and this was the only one available (which I placed inside a sub-folder of my User package), so your issue is not related.

0 Likes

#8

I have the same issue with my syntax files. They highlights incorrectly now.
@FichteFoll, now we have to rewrite with new syntax or there will be a fix?

Just tried, it generates same incorrect highlighting.

Thanks.

0 Likes

#9

The problem is line 1008: you have a double look-ahead pattern, just remove the last one:

(?=^\s*(?i:(class procedure|class function|function|procedure|constructor|destructor))\s+([A-Za-z_][A-Za-z0-9_]*))

I do not think having a look-ahead inside a look-ahead is valid, so I would tend to believe that behavior is now correct.

Edit: Looking a bit more at your syntax file, this is actually happening multiple times so you might want to look at every occurence of those double look-ahead pattern.
Also you are using multiple times \n in your regex: I’m not sure that it works, sublime run it’s grammar line by line, so maybe you should replace it by $

Also line 810 you have a patterns array inside a patterns array: this prevent the conversion tool to works correctly, not sure if it affects the highlighting too but it might be a good idea to fix it anyway.

0 Likes

#10

Look-aheads inside look-aheads are perfectly valid (also indicated by the fact that it worked previously).

0 Likes

#11

I have noticed this as well, sublime syntax is either incorrect for the set type or not loading the correct syntax type.

In that screenshot, it is a simple .scss file, it loads incorrect, I have to CTRL+SHIFT+P and set it. If I go to View > Syntax, most are disabled, I cannot set the syntax for this file by default. (Don’t understand why so many are disabled…)

For example

Some Javascript syntax has also gone wonkie, I don’t have an example on me right now as I saw it at work.

0 Likes

#12

I expect there to be a fix. This is a serious regression.

0 Likes