Sublime Forum

Detecting installed syntax shemes

#1

Hi there,

I need to find a way to detect if a syntax file is available/installed when using view.set_syntax_file(syntax) for this plugin: github.com/Cacodaimon/GhostText-for-SublimeText .
Because I want’s to inform the user if her/his sublime text installation does not have the syntax file or when she/he misspelled it’s name.
Which is the best way to archive this?

Thanks in advance!

0 Likes

#2

Not sure which versions of ST you’re wanting to support, but, if only ST 3 you could use sublime.find_resources which should return an array of strings or an empty array if nothing was found.

0 Likes

#3

Thanks, this works!

Now the users gets a nice messages when they specified a non existing syntax.

0 Likes