Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Play better with expanded snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeche committed May 16, 2014
1 parent 999a919 commit d1e30e8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/emmet.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,21 @@ multiSelectionActionDecorator = (action) ->
runAction = (action, evt) ->
syntax = editorProxy.getSyntax()
if action is 'expand_abbreviation_with_tab'
# do not handle Tab key for unknown syntaxes
# do not handle Tab key if:
# 1. syntax is unknown
# 2. there’s a selection (user wants to indent it)
# 3. has expanded snippet (e.g. has tabstops)
activeEditor = editorProxy.editor;
if not resources.hasSyntax(syntax) or not activeEditor.getSelection().isEmpty()
return evt.abortKeyBinding()
if activeEditor.snippetExpansion
# in case of snippet expansion: expand abbreviation if we currently on last
# tabstop
se = activeEditor.snippetExpansion
if se.tabStopIndex + 1 >= se.tabStopMarkers.length
se.destroy()
else
return evt.abortKeyBinding()

if action is 'toggle_comment' and toggleCommentSyntaxes.indexOf(syntax) is -1
return evt.abortKeyBinding()
Expand Down

0 comments on commit d1e30e8

Please sign in to comment.