Sublime Forum

Error Loading Syntax File: C Improved Package


I am experiencing an error using a certain package: C Improved.

It fails to read the syntax file due to some problem with regex


I am on the most recent build 4121.

I had to revert to a clean state sublime text and I am trying to install the packages I had before. I did not have this problem with C Imporved before.

Any help would be appreciated, thanks



This looks like the same cause with Sublime text 4 error, which has to be fixed in ST core.



Thanks for bringing that to my attention. Is there a fix for it yet? Or can I fix it myself?



No and no. Hmm… maybe yes if you want to take over the C Improved Package, which is not recommended. I guess converting it into .sublime-syntax format will auto fix it.

A stable release usually takes months…



This might currently be the best option for the OP though, if being able to use this package is essential.

After all, as you said, it should only require exporting the syntax to the new format, and the RegEx compatibility issue should be gone. I’d personally opt for this choice if dealing with an old syntax, since the new ST4 features are too cool to preserve backward compatibility with ST2.

So, @EndCar808, you should consider forking the original package, convert it to the new ST syntax format, and maybe even enable the version: 2, so you get rid of the old ST3 bugs and quirks and can access the new fantastic features (this might require some work though).

But if you really use a syntax a lot, it’s worth considering the option of forking the original package and creating a new ST-4 specific version thereof — others might switch to it, and become contributors.



Hmmm… I have noticed this problem with other packages though, like the MagicPython package for example, so maybe this may be more work than necessary, but I will look into.

What I can’t wrap my head around is why this issue didn’t arise when I upgraded from ST3 to ST4 initially. It is only after installing a new clean ST4 that this issue happened. Maybe I could try downloading a clean version of ST3 installing my required packages and upgrading then to ST4?



From the description of the problem found at link offered by @jfcherng it seems that it was a RegEx behavior compatibility fix relating to old syntaxes vs the new format. Chances are that some ST4 updates have further improved the RegEx engine and the Syntax mechanics, so probably the problem will show again whichever way you install ST4 (unless you stick to and older version).

It’s hard to tell, but from what I can see all the new syntax features and bug fixes are for the best, and I did notice various bug fixes affecting how a same syntax worked in ST3 vs ST4 — some of them are listed in the documentation, since enabling version: 2 in a Syntax will ensure that ST4 does not emulate those bugs (i.e. for backward compatibility with syntaxes designed for ST3).

Unfortunately ST3 has seen various RegEx bugs and changes in the RegEx engine(s) supported, which has lead to syntaxes being designed around those quirks, which might affect their functionality with ST4, now that this quirks are being fixed.

IMO, it’s worth looking forward and try to exploit the new ST4 features, which when it comes to syntaxes are really cool, adding a whole new layer of possibilities that were not there before.

Also, ST4 now offers some context hints when peeking at tokens’ scoping, which is quite helpful since it can be used as a “syntax debugger” of sort, to trace were things are not working as expected.

True, migrating an old syntax to the new ST4 feature can indeed require some work, but if we heavily rely on a specific syntax it might be worth it. In any case, you can always start by removing (commenting out) broken features, and then gradually reintroduce them one at the time, to reduce the amount of work.

As a general rule, I prefer to avoid very old syntaxes which are not actively maintained, and favor third party forks which are being updated.



This is simply a bug. We’ve got a fix in the works for it.