Skip to content

Commit 7860b44

Browse files
committed
Enable open url and preview image command for sublime-syntax
1 parent ac323ea commit 7860b44

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

note_support.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
ST3072 = int(sublime.version()) >= 3072
99

10+
def is_enabled_for_view(view):
11+
valid_syntax = ['Note.tmLanguage', 'Note.sublime-syntax']
12+
syntax = view.settings().get("syntax")
13+
return any(syntax.endswith(s) for s in valid_syntax)
1014

1115
class NoteOpenUrlCommand(sublime_plugin.TextCommand):
1216

@@ -18,7 +22,7 @@ def run(self, edit):
1822
webbrowser.open_new_tab(url)
1923

2024
def is_enabled(self):
21-
return 'Note.tmLanguage' in self.view.settings().get("syntax")
25+
return is_enabled_for_view(self.view)
2226

2327
if ST3072:
2428
class NotePreviewImageCommand(sublime_plugin.TextCommand):
@@ -118,4 +122,4 @@ def getImageInfo(self, data):
118122
return content_type, width, height
119123

120124
def is_enabled(self):
121-
return 'Note.tmLanguage' in self.view.settings().get("syntax")
125+
return is_enabled_for_view(self.view)

0 commit comments

Comments
 (0)