Skip to content

Commit

Permalink
Closes issue SublimeText#71
Browse files Browse the repository at this point in the history
- Update get_syntax_name to use scope if available
  • Loading branch information
23maverick23 committed Feb 14, 2015
1 parent ea7b3dd commit 627433e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions origami.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,22 @@ def on_activated(self, view):

class AutoSwitchPane(sublime_plugin.EventListener):
def get_syntax_name(self, view):
syntax_path = view.settings().get('syntax')
syntax_name = os.path.splitext(os.path.basename(syntax_path))[0].lower()
return syntax_name
pt = view.sel()[0].end()
scopes = view.scope_name(pt)
if scopes:
for scope in scopes.strip().split(" "):
if "source." in scope:
return scope[7:].lower()

if "text.html." in scope:
return scope[10:].lower()

if "text." in scope:
return scope[5:].lower()
else:
# fallback to path search if scopes are not available
syntax_path = view.settings().get('syntax')
return os.path.splitext(os.path.basename(syntax_path))[0].lower()

def on_load(self, view):
syntax_grouping = get_setting(view, 'syntax_grouping')
Expand Down

0 comments on commit 627433e

Please sign in to comment.