Sublime Forum

Build 3175 - Syntax Highlighting selection not persistent

#1

Description:

I’m having trouble getting syntax highlighting of my Handlebars files to persist between file open operations. This used to work in previous builds (< 3.1) but this is the first time I’ve tried it on a recent build.

Steps to reproduce

  • Open a Handlebars (.hbs) file
  • Notice that the syntax is not highlighted
  • Choose View --> Syntax --> Open all with current extension as … --> Handlebars
  • Notice that the syntax highlighting gets applied correctly
  • Open another .hbs file
  • Notice that no syntax highlighting get’s applied even though ST3 indicates that the file is a “Handlebars” file

What was expected to happen

I expected the file to have syntax highlighting applied.

What happened instead

The file had no syntax highlighting applied at all.

0 Likes

Syntax Highlighting (for SublimePuppet) Initially Wrong
#2

After opening a .hbs file with no syntax highlighting active, what does running view.settings().get('syntax') in the console yield?

0 Likes

#3
>>> view.settings().get('syntax')
'Package/Theme - Monokai+/icons/Lnags/Handlebars.tmLanguage'

So it seems that it does recognize the file type but it doesn’t apply the styling properly. :confused:

One thing that might be important is that this works perfectly on my Linux machine; the same ST3 version with the same plugins. My original problem was running ST3 on macOS 10.13.4., so this might be a platform thing.

0 Likes

#4

I thought an example would help to illustrate my situation. Again, this is only happening on macOS High Sierra (10.13.5) and not on my Ubuntu machine. Previous ST3 builds didn’t have this problem either.

This example shows a simple Handlebars file that I just opened. Notice that the bottom right of the screen shows that ST3 knows the type of file but that it’s not properly highlighted:

If I open the file-type menu you can see that Handlebars is not selected:

When I select Handlebars from that menu ST3 applies the syntax formatting properly:

0 Likes

#5

try uninstalling Monokai+ or whatever package is conflicting

1 Like

#6

Yup, that seemed to work. :smile:

WooHoo! I have my syntax highlighting back again!

I had 2 different Monokai plugins installed and I guess they were conflicting with each other or something.

Thank you very much!

0 Likes

#7

The actual issue was that a theme (Monokai+) was shipping stub syntax definitions for Handlebars and since Theme - Monokai+ comes after Handlebars (or whatever the package name of your other syntax definition is), the stub file would be prioritized.

2 Likes