Skip to content

Commit

Permalink
Verify that a syntax exists before trying to set it #24
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodaimon committed Jul 13, 2014
1 parent 0954312 commit c44d67d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions GhostText.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ def _set_syntax_by_host(self, host, view):
if syntax is not None:
view.set_syntax_file(syntax)
else:
syntax = settings.get('default_syntax', 'Packages/Markdown/Markdown.tmLanguage')
view.set_syntax_file(syntax)
sublime.error_message('Syntax "{}" is not installed!'.format(syntax_part))
default_syntax = settings.get('default_syntax', 'Markdown.tmLanguage')
resources = sublime.find_resources('*{}'.format(default_syntax))

if len(resources) > 0:
view.set_syntax_file(resources[0])


class OnMessage(AbstractOnMessage):
Expand Down

0 comments on commit c44d67d

Please sign in to comment.