Skip to content

Commit

Permalink
moved complete_all trigger to be checked later as in issue #35
Browse files Browse the repository at this point in the history
  • Loading branch information
niosus committed Jun 5, 2016
1 parent bd024f9 commit 9528404
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugin/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ def get_position_status(point, view, settings):
Returns:
PosStatus: statuf for this position
"""
if settings.complete_all:
return PosStatus.COMPLETION_NEEDED
trigger_length = 1

word_on_the_left = view.substr(view.word(point - trigger_length))
Expand All @@ -191,8 +189,8 @@ def get_position_status(point, view, settings):
log.debug(" trying to autocomplete digit, are we? Not allowed.")
return PosStatus.WRONG_TRIGGER

# slightly conterintuitive `substr` returns ONE character to the right
# of given point.
# slightly counterintuitive `view.substr` returns ONE character
# to the right of given point.
curr_char = view.substr(point - trigger_length)
wrong_trigger_found = False
for trigger in settings.triggers:
Expand All @@ -207,8 +205,13 @@ def get_position_status(point, view, settings):
log.debug(" wrong trigger '%s%s'.", prev_char, curr_char)
wrong_trigger_found = True
if wrong_trigger_found:
# no correct trigger found, vut a wrong one fired instead
log.debug(" wrong trigger fired")
return PosStatus.WRONG_TRIGGER

if settings.complete_all:
return PosStatus.COMPLETION_NEEDED

# if nothing fired we don't need to do anything
log.debug(" no completions needed")
return PosStatus.COMPLETION_NOT_NEEDED

0 comments on commit 9528404

Please sign in to comment.