summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 23:49:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 23:49:28 +0800
commita19a1f4f077830014dd2d2c378988e7770be2be1 (patch)
tree137f0455d0648c425b96004a236c074f30ad1340 /script/core
parent79cc877095745be377b9dd189ee5e38cf35a3c5e (diff)
downloadlua-language-server-a19a1f4f077830014dd2d2c378988e7770be2be1.zip
support `call`
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion/completion.lua25
-rw-r--r--script/core/diagnostics/unknown-operator.lua5
2 files changed, 24 insertions, 6 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index bc3760d9..c577874f 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -1743,7 +1743,7 @@ local function tryluaDocBySource(state, position, source, results)
results[#results+1] = {
label = name,
kind = define.CompletionItemKind.Operator,
- description = ('```lua\n%s\n```'):format(vm.UNARY_MAP[name]),
+ description = ('```lua\n%s\n```'):format(vm.OP_UNARY_MAP[name]),
}
end
end
@@ -1752,10 +1752,20 @@ local function tryluaDocBySource(state, position, source, results)
results[#results+1] = {
label = name,
kind = define.CompletionItemKind.Operator,
- description = ('```lua\n%s\n```'):format(vm.BINARY_MAP[name]),
+ description = ('```lua\n%s\n```'):format(vm.OP_BINARY_MAP[name]),
}
end
end
+ for _, name in ipairs(vm.OTHER_OP) do
+ if matchKey(source[1], name) then
+ results[#results+1] = {
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.OP_OTHER_MAP[name]),
+ }
+ end
+ end
+ return true
end
return false
end
@@ -1871,14 +1881,21 @@ local function tryluaDocByErr(state, position, err, docState, results)
results[#results+1] = {
label = name,
kind = define.CompletionItemKind.Operator,
- description = ('```lua\n%s\n```'):format(vm.UNARY_MAP[name]),
+ description = ('```lua\n%s\n```'):format(vm.OP_UNARY_MAP[name]),
}
end
for _, name in ipairs(vm.BINARY_OP) do
results[#results+1] = {
label = name,
kind = define.CompletionItemKind.Operator,
- description = ('```lua\n%s\n```'):format(vm.BINARY_MAP[name]),
+ description = ('```lua\n%s\n```'):format(vm.OP_BINARY_MAP[name]),
+ }
+ end
+ for _, name in ipairs(vm.OTHER_OP) do
+ results[#results+1] = {
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.OP_OTHER_MAP[name]),
}
end
end
diff --git a/script/core/diagnostics/unknown-operator.lua b/script/core/diagnostics/unknown-operator.lua
index 5e8177c3..7404b5ef 100644
--- a/script/core/diagnostics/unknown-operator.lua
+++ b/script/core/diagnostics/unknown-operator.lua
@@ -21,8 +21,9 @@ return function (uri, callback)
local op = doc.op
if op then
local opName = op[1]
- if not vm.BINARY_MAP[opName]
- and not vm.UNARY_MAP[opName] then
+ if not vm.OP_BINARY_MAP[opName]
+ and not vm.OP_UNARY_MAP[opName]
+ and not vm.OP_OTHER_MAP[opName] then
callback {
start = doc.op.start,
finish = doc.op.finish,