Sublime Forum

is c++ syntax highlighting broken?

#1

Screenshot%20from%202022-07-27%2017-15-37

0 Likes

#2

Are you sure the syntax highlighting is set to C++? Does it happen in safe mode?

0 Likes

#3

definitely set to c++ at bottom right corner.

i was unaware of safe mode. i tried that and the highlighting does work in safe mode.

0 Likes

#4

Then you’ve got a package/override breaking the syntax highlighting somehow. I suggest using the "ignored_packages" setting to find which package is the culprit.

0 Likes

#5

hmm…i only had a couple packages installed. i tried adding them to the “ignored_packages” list and restarting but that didn’t appear to help.

is there any other custom settings i could have made that could be causing the c++ highlighting to not work?
the handful of other syntaxes i tried seem to work including c and objective-c++.

0 Likes

#6

you can simply run view.syntax() in ST console to reveal information about the used syntax.

>>> view.syntax()
Syntax('Packages/Python/Python.sublime-syntax', 'Python', False, 'source.python')
1 Like

#7

view.syntax()
Syntax(‘Packages/C++/C++.sublime-syntax’, ‘C++’, False, ‘source.c++’)

0 Likes

#8

This sounds like a stupid question: Is there any error/warning message about syntax file in ST console?

0 Likes

#9

hmm…not that i can see.

0 Likes

#10

Perhaps you have an override in your user package. Check the menu Packages > Browse Packages… in the User folder.

0 Likes

#11

nothing in the User folder looks suspicious.
if i backup and delete all the files in that folder sublime reverts to its default themes and looks like safe mode but the c++ syntax highlighting is still wrong :frowning:

0 Likes

#12

The only causes can be located in the Packages or Installed Packages folders.

0 Likes

#13

ok. i unziped /opt/sublime_text/Packages/C++.sublime-package and copied the C++.sublime-syntax file contained within to ~/.config/sublime-text-3/Packages/User/.

now in sublime text if i click on c++ on the bottom left and select the second c++ option i just created, it highlights the syntax correctly.

0 Likes

#14

Then you’ve definitely got an override for it somewhere.

0 Likes