Home Download Buy Blog Forum Support

Detecting installed syntax shemes

Detecting installed syntax shemes

Postby Cacodaimon on Sat Jul 12, 2014 12:45 pm

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: https://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!
Cacodaimon
 
Posts: 8
Joined: Fri Jul 11, 2014 10:53 am
Location: Germany

Re: Detecting installed syntax shemes

Postby subhaze on Sat Jul 12, 2014 4:59 pm

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.
subhaze
 
Posts: 229
Joined: Tue Apr 09, 2013 3:22 am

Re: Detecting installed syntax shemes

Postby Cacodaimon on Sun Jul 13, 2014 2:31 pm

Thanks, this works!

Now the users gets a nice messages when they specified a non existing syntax.
Cacodaimon
 
Posts: 8
Joined: Fri Jul 11, 2014 10:53 am
Location: Germany


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 8 guests