summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/core/completion.lua14
-rw-r--r--test-beta/completion/init.lua23
2 files changed, 8 insertions, 29 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua
index b0f15f74..d5ce0d9a 100644
--- a/script-beta/core/completion.lua
+++ b/script-beta/core/completion.lua
@@ -75,6 +75,8 @@ local function findSymbol(text, offset)
or char == ':'
or char == '#' then
return char, i
+ else
+ return nil
end
::CONTINUE::
end
@@ -474,10 +476,6 @@ local function checkKeyWord(ast, text, start, word, results)
end
end
-local function checkDot(ast, start, results)
-
-end
-
local function tryWord(ast, text, offset, results)
local word, start = findWord(text, offset)
if not word then
@@ -508,8 +506,12 @@ local function trySymbol(ast, text, offset, results)
if isInString(ast, offset) then
return nil
end
- if symbol == '.' then
- checkDot(ast, start, results)
+ if symbol == '.'
+ or symbol == ':' then
+ local parent, oop = findParent(ast, text, start)
+ if parent then
+ checkField('', start, parent, oop, results)
+ end
end
end
diff --git a/test-beta/completion/init.lua b/test-beta/completion/init.lua
index 36e9b9e4..579d5ebb 100644
--- a/test-beta/completion/init.lua
+++ b/test-beta/completion/init.lua
@@ -298,12 +298,10 @@ t.$
{
label = 'a',
kind = CompletionItemKind.Field,
- detail = EXISTS,
},
{
label = 'b',
kind = CompletionItemKind.Field,
- detail = EXISTS,
},
}
@@ -316,12 +314,10 @@ t. $
{
label = 'a',
kind = CompletionItemKind.Field,
- detail = EXISTS,
},
{
label = 'b',
kind = CompletionItemKind.Field,
- detail = EXISTS,
},
}
@@ -335,15 +331,10 @@ t:$
{
label = 'b',
kind = CompletionItemKind.Method,
- documentation = EXISTS,
- detail = EXISTS,
},
{
label = 'b()',
kind = CompletionItemKind.Snippet,
- documentation = EXISTS,
- detail = EXISTS,
- insertText = EXISTS,
},
}
@@ -358,20 +349,6 @@ xxx()
{
label = 'a',
kind = CompletionItemKind.Field,
- detail = EXISTS,
- },
- {
- label = 'xxx',
- kind = CompletionItemKind.Function,
- documentation = EXISTS,
- detail = EXISTS,
- },
- {
- label = 'xxx()',
- kind = CompletionItemKind.Snippet,
- documentation = EXISTS,
- detail = EXISTS,
- insertText = EXISTS,
},
}