Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit b8bb59a

Browse files
committed
Use more appropriate prefix for autocomletions
As autocompletion prefix, it is much more reliable to use the piece of text from the beginning of the line until current text cursor, rather than beginning and end of current line.
1 parent d0e1206 commit b8bb59a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

SQLTools.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,12 @@ def on_query_completions(view, prefix, locations):
245245
completions = view.extract_completions(prefix)
246246

247247
if prefix == "":
248-
region = sublime.Region(locations[0], locations[0])
248+
currentPoint = locations[0]
249+
lineStartPoint = view.line(currentPoint).begin()
250+
lineStartToLocation = sublime.Region(lineStartPoint, currentPoint)
249251
try:
250-
prefix = view.substr(view.line(region)).split(" ").pop()
252+
# everything after last space is a prefix
253+
prefix = view.substr(lineStartToLocation).split(" ").pop()
251254
except Exception:
252255
pass
253256

0 commit comments

Comments
 (0)