Sublime Forum

Overriding language definitions

#1

Has there been a change in the way language definitions are loaded in Sublime Text 2? Previously, I had a folder called Haskell2 with a modified language definition for .hs files that used to override the default one. In Sublime Text 2, however, this no longer seems to work, as the default one gets precedence. If this simply not implemented yet or is there a new way of overriding language definitions?

1 Like

#2

By overriding, do you mean which .tmLanguage file is selected when you open a .hs file?

If you use View/Syntax/Open all with current extension as, that setting should take precedence over what’s listed in the tmLanguage files.

1 Like

#3

Ah, never knew that was there. That does the trick just fine, thanks.
Where are these default filetype associations stored? It would be nice if they could be easily replicated to new computers along with all the other settings, but I was unable to find the file that stores it in the AppData/ST2 folder

1 Like

#4

If your file is called Haskell2.tmLanguage, then they should be stored in User/Haskell2.sublime-settings

1 Like

#5

Ah, I see. Great, thanks.

1 Like

#6

I am also confused by this change.

If I want to override JavaScript.tmLanguage file, I can create a JavaScript.tmLanguage file in my use directory. If I don’t give it a different name though the syntax drop down list has JavaScript twice. It shows a check mark next to both even though only 1 is really active.

I could call the language my-javascript instead to get around these problems but that seems weird. I just want to override the default JavaScript.tmLanguage file.

Am I doing something wrong?

1 Like

#7

[quote=“corsen2000”]I am also confused by this change.

If I want to override JavaScript.tmLanguage file, I can create a JavaScript.tmLanguage file in my use directory. If I don’t give it a different name though the syntax drop down list has JavaScript twice. It shows a check mark next to both even though only 1 is really active.

I could call the language my-javascript instead to get around these problems but that seems weird. I just want to override the default JavaScript.tmLanguage file.

Am I doing something wrong?[/quote]

You would override the JavaScript.tmLanguage file be creating at “Packages/JavaScript/JavaScript.tmLanguage”. I wrote this plugin (link) to help view and override sublime-package defaults. In the command palette, search for PackageResourceViewer: Edit Package Resource". This will (or at least should) open a file in the proper location for you to edit.

1 Like