Sublime Forum

Multiple sublime-syntax files in Packagers/User not appearing in View > Syntax

#1

On Build 3105 / OS X 10.11.3:

I’m developing a couple syntax definitions using the new .sublime-syntax format.

When I have add one in the Packages/User folder, it shows up in View >> Syntax. When I add another into Packages/User, the original one disappears from the menu, and the new one doesn’t show up at all.

As soon as I remove the second .sublime-syntax file from Packages/User, the original one appears in View >> Syntax.

Also, from this thread, it looks like Packages/User-stored definitions should show up in View > Syntax > User: Sublime-syntax files won't show in View->Syntax as an option

However, my first one showed up in the root View > Syntax menu.

0 Likes

#2

If a package defines two or more syntaxes, they get moved into a submenu named after the package (“User” in this case). This does not happen for the command palette.

0 Likes

#3

I found the View > Syntax > User menu. I guess the original syntax disappearing threw me, and I didn’t notice the new User submenu near the bottom. Or I needed more coffee. :wink:

Thanks!

0 Likes

#4

Is this still the case? I’ve made a package for MathML highlighting (hosted here), and I want to include highlighting within html syntax. I tried doing what ruby on rails did by adding a new .sublime-syntax file that included the html scope with a prototype to set MathML scope when the <math> tag is encountered. However, this second syntax can’t be loaded. The base MathML syntax still loads fine for files with the appropriate extensions, as well as through the command palette and the View -> Syntax menu, but the new syntax file doesn’t show up in the palette or the menu and isn’t loaded for the appropriate extensions. It’s as though it just doesn’t exist.

0 Likes

#5

The link to the repository in your link is wrong, it should probably be: https://github.com/Sensibility/MathML-Sublime-Plugin.

That said, the repository only contains a single syntax file in it. If I install the package locally, I see a MathML entry in the syntax menu and I also get one in the command palette. However, when applying it to a view, I see the following in the console:

no such context tag-subscriptshift at line 341 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
no such context tag-superscriptshift at line 342 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
no such context tag-superscriptshift at line 327 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
no such context tag-subscriptshift at line 313 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
no such context tag-superscriptshift at line 402 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
no such context tag-subscriptshift at line 403 column 20 in Packages/MathML-Sublime-Plugin/MathML.sublime-syntax
rule #anon_main_8 has a scope name, but is unreachable, so the name will never be used

As such possibly your issue is that the syntax file has problems that you need to address.

0 Likes

#6

I haven’t pushed the new file yet, since I can’t test it because I can’t load it, but I could push to the development branch if that’d help. I’m sure it has quite a few problems; the package is only a week old and it’s my first package, but I don’t think that’s why I can’t see it.

0 Likes

#7

Update: I pushed

Also, I’m pretty sure I fixed that link by the time you posted (when I click on it I get to the right page), but if it’s still broken that’s highly weird.

Update to my Update: I think I’ve narrowed this down, actually. There is an issue with the syntax file, it’s saying unknown escape character: s when trying to load my new syntax. I may be crazy, but I’m pretty damn sure that s is a valid escape character. In fact, I copy/pasted a pattern from the HTML syntax definition that contains an escaped s, and I’m sure that the default HTML syntax loads, but it still gives me the same error.

#Final Update
I’m not allowed to reply again to this topic, so this is the only way I can tell anyone who cares that I traced the actual core issue back to the fact that I was - include:-ing the scope for MathML instead of the file, which is to say that I had:

- include: "scope:source.html"

but I needed to explicityl use:

- include: "MathML.sublime-syntax"

The bad escape character was a red-herring, caused by a leftover file from when I was trying frantically to get this syntax to load that was overriding what I was doing.

Many thanks to @OdatNurd for the help

0 Likes

#8

Ah that’s probably my bad; it was wrong when I noticed it so likely you did a ninja edit that I didn’t catch because I was looking elsewhere when the page reloaded.

As you noticed Sublime doesn’t like your escape sequence. The reason for that is that in YAML double quoted strings are treated differently than single quoted strings.

1 Like