Skip to content

Commit 24abb08

Browse files
gwenzekmarkbirbeck
authored andcommitted
[#74] More flexible resource lookup to support .sublime-syntax file extension
1 parent e635c5e commit 24abb08

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

SublimeHelper.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,15 @@ def __init__(self, window, data_key, command, working_dir, title=None, syntax=No
217217
# Set the syntax for the output:
218218
#
219219
if syntax is not None:
220-
resources = sublime.find_resources(syntax + '.tmLanguage')
221-
self.console.set_syntax_file(resources[0])
220+
if not (syntax.endswith('.tmLanguage') or
221+
syntax.endswith('.sublime-syntax')):
222+
syntax += '.tmLanguage'
223+
resources = sublime.find_resources(syntax)
224+
225+
if not resources:
226+
print('Resource not found:', syntax)
227+
else:
228+
self.console.set_syntax_file(resources[0])
222229

223230
# Set a flag on the view that we can use in key bindings:
224231
#

0 commit comments

Comments
 (0)