summaryrefslogtreecommitdiff
path: root/script-beta/core/completion.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/core/completion.lua')
-rw-r--r--script-beta/core/completion.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index e9c3cc00..73111268 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -627,15 +627,18 @@ end
local function completion(uri, offset)
local ast = files.getAst(uri)
- if not ast then
- return nil
- end
- clearStack()
local text = files.getText(uri)
local results = {}
-
- tryWord(ast, text, offset, results)
- trySymbol(ast, text, offset, results)
+ clearStack()
+ if ast then
+ tryWord(ast, text, offset, results)
+ trySymbol(ast, text, offset, results)
+ else
+ local word = findWord(text, offset)
+ if word then
+ checkCommon(word, text, results)
+ end
+ end
if #results == 0 then
return nil