Snazzah / SublimeDiscordRP

📄 Discord rich presence for Sublime Text
MIT License
133 stars 35 forks source link

{lang} uses the filename of the .sublime-syntax, not the actual name #45

Closed SALZKARTOFFEEEL closed 5 years ago

SALZKARTOFFEEEL commented 5 years ago

When setting some filed to include {lang} (for example: "state": "Working in {lang}"), the value {lang} gets replaced with is the filename of the .sublime-syntax file, not what the name of the language is defined to be (as shown in the status bar).
This is an issue for custom syntax highlighters (for example those stored in the User folder). The file name does not necessarily reflect the actual syntax name, as defined with the name field at the top of .sublime-syntax files.

Reference to the .sublime-syntax format

FichteFoll commented 5 years ago

I suggest you rename your custom syntax files to hold the same name as shown in the statusbar (and specified in a syntax's name field) because this is how they are keyed for all purposes except in the status bar and the command palette. Notably, when using syntax-specific settings the settings' file name must be the same as the sublime-syntax's and not its name field.

I don't see a reason to parse every syntax file's YAML to fetch their exact name specified inline or even do a regex approximation over the first few lines when the file's name gives the exact same name 99% of the time and in the remaining 1% at least a closely related name.

SALZKARTOFFEEEL commented 5 years ago

Well okay. I thought it would be simpler to get the proper name of the syntax highlighter.
I originally just named it differently so that there were no spaces in the filename, but I guess I'm going to rename it.

And thanks for the info on syntax-specific settings! I didn't know that.