Sublime Forum

C++ stops highlighting

#1

I’ve noticed highlighting stops with certain C++ files. For example, if I open llc.cpp from the llvm project it stops highlighting after line 131. Can anyone else reproduce this? Here’s the source file:

llvm.org/viewvc/llvm-project/llv … rev=156747

Not sure if it’s a plugin issue or a syntax file issue or something else. I’m using build 2219 on Win7 and Win8. Thanks!

0 Likes

#2

I am seeing this issue as well, but my highlighting stops on line 237 for the file you posted.

I have also seen this in Bash files. Typically the highlighting stops within +/- 50 lines of line 200.

However, I also have a few C++ files that are 3000+ lines in length, and they work fine. I can’t immediately see a pattern as to what works and what does not.

0 Likes

#3

Thanks for confirming DAVe3283. I haven’t noticed any specific syntax that seems to trigger the issue either.

0 Likes

#4

I’m having the same issue with a bash script. Syntax highlighting stops after line 351. I have some functions in the script and the highlighting seems to stop after the 15 function (func_bla). When I type anything but another function after that 15 function, the highlighting is still fine. When I insert some empty functions before that 15th function, it’s still fine up until func_bla. I’ve tried changing several things in func_bla and the function after it, but haven’t found a clear cause.

Greets,
Erwin

0 Likes

#5

Usually issues like this are caused by the way a tmLanguage is defined. C/C++ Language does this recursion thing when looking at certain elements on a page. When the internal recursion limit gets hit in ST2, the syntax highlighting aborts.

That is why you are seeing it cut off. The file you referenced is the perfect file to show something like this:

So I grabbed the scope of the last highlighted element, and this is what it is:

Scope: source.c++ meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c meta.parens.c meta.function.c entity.name.function.c

Notice the repeating scopes. This is simply because the tmLanguage is kind of poorly configured. I haven’t had a chance to dig in and try and fix this yet, but I have fixed issues like this before in the C/C++ languages specifically.

0 Likes

#6

Thanks facelessuser. If I have time, and can figure out a fix, I’ll be sure to post it here.

0 Likes