Sublime Forum

tmLanguage file that doesn't show up on the Languages menu?

#1

Hi,

Is it possible to create a tmLanguage file that doesn’t show at the languages menu for sole purpose of being included in other tmLanguage files?

Thanks,
Joao

0 Likes

#2

Unfortunately not

0 Likes

#3

I haven’t tested this, but couldn’t you create a tmLanguage file and add it to the ignored packages list? It should still be include-able, no?

0 Likes

#4

Actually I have tried that and the package is disabled even for includes :frowning:

Thank you for your replies.

0 Likes

#5

How about calling it .hidden-tmLanguage? Dunno if it would work the same as tmTheme but one can hope…

This is how tmTheme works:
github.com/maltize/sublime-text … 65144349d9
github.com/maltize/sublime-text … a59e8c53e1

0 Likes

#6

[quote=“bronson”]How about calling it .hidden-tmLanguage? Dunno if it would work the same as tmTheme but one can hope…

This is how tmTheme works:
github.com/maltize/sublime-text … 65144349d9
github.com/maltize/sublime-text … a59e8c53e1[/quote]

Humm, how do I include other tmLanguage file by it’s file name, I thought it was only possible by the scopeName?
And with the extension of .hidden-tmLanguage, I doubt it would even be processed by sublimetext and it’s scope added!

Your example uses python and there’s no python here in this, only tmLanguage files (XML) that include other tmLanguage files.

Thanks

0 Likes

#7

Yeah, I think you’re right – it won’t work for tmLanguage. It was a longshot.

Time to file a feature request?

0 Likes

#8

Maybe, I would definitely agree with such feature although I don’t know if by adding such option inside the tmLanguage file, it would be feasible as it could break compatibility of the tmLanguage files with TextMate and they’re supposed to be interchangeable!

One way I could see it happen, was by creating a small python plugin that would take a list of names from a json file and remove corresponding entries from the languages menu.
Just a thought! :unamused:

0 Likes

#9

I am pretty sure that this does work, using the “.hidden-tmLanguage”. Take a look at “Packages/Default/Find Results.hidden-tmLanguage”.

You then can not use the popup menu from ST’s status bar to change the syntax to that file, instead you’d need to do that with a plugin or by hand in the console.

Edit: disregard this, I can’t read.

0 Likes

#10

You can make .tmLanguange files that won’t show up in the Syntax menu by changing the extension, but then they won’t be available for inclusion into other .tmLanguage files.

0 Likes

#11

You are right, I just found it out while I tested its behaviour and coincidentally hid an included syntax def file.

I’ll support the feature request then, this could really be useful.

0 Likes

#12

Could this be rectified, at least in ST3? It is a significant limitation when building non-trivial syntax highlighters.

0 Likes