summaryrefslogtreecommitdiff
path: root/script/core/completion
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 23:34:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 23:34:54 +0800
commit79cc877095745be377b9dd189ee5e38cf35a3c5e (patch)
tree9e5f0e07741c8c5022d08672fef2ba137e352703 /script/core/completion
parent27dcfa8d1463936d0b2514cd82eebe1910ab3bb7 (diff)
downloadlua-language-server-79cc877095745be377b9dd189ee5e38cf35a3c5e.zip
semantic and completion description
Diffstat (limited to 'script/core/completion')
-rw-r--r--script/core/completion/completion.lua21
1 files changed, 13 insertions, 8 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index ae1d7f9e..bc3760d9 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -1566,6 +1566,7 @@ local function tryluaDocCate(word, results)
'async',
'nodiscard',
'cast',
+ 'operator',
} do
if matchKey(word, docType) then
results[#results+1] = {
@@ -1740,16 +1741,18 @@ local function tryluaDocBySource(state, position, source, results)
for _, name in ipairs(vm.UNARY_OP) do
if matchKey(source[1], name) then
results[#results+1] = {
- label = name,
- kind = define.CompletionItemKind.Operator,
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.UNARY_MAP[name]),
}
end
end
for _, name in ipairs(vm.BINARY_OP) do
if matchKey(source[1], name) then
results[#results+1] = {
- label = name,
- kind = define.CompletionItemKind.Operator,
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.BINARY_MAP[name]),
}
end
end
@@ -1866,14 +1869,16 @@ local function tryluaDocByErr(state, position, err, docState, results)
elseif err.type == 'LUADOC_MISS_OPERATOR_NAME' then
for _, name in ipairs(vm.UNARY_OP) do
results[#results+1] = {
- label = name,
- kind = define.CompletionItemKind.Operator,
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.UNARY_MAP[name]),
}
end
for _, name in ipairs(vm.BINARY_OP) do
results[#results+1] = {
- label = name,
- kind = define.CompletionItemKind.Operator,
+ label = name,
+ kind = define.CompletionItemKind.Operator,
+ description = ('```lua\n%s\n```'):format(vm.BINARY_MAP[name]),
}
end
end