summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-06-28 15:01:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-06-28 15:01:16 +0800
commitdaee93fb17e8f206e63ab8573566762011a3f1cd (patch)
tree899636477d8afb30b7dbfe995ef9fa8a76239919 /server/src/core
parentf6a6e9f9d36d34c542c721db41a4e9770bcebcf7 (diff)
downloadlua-language-server-daee93fb17e8f206e63ab8573566762011a3f1cd.zip
修改enum的语法
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/completion.lua15
-rw-r--r--server/src/core/hover/function.lua12
2 files changed, 14 insertions, 13 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index ddbe7271..6ab3c565 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -663,14 +663,14 @@ local function searchEnumAsLib(vm, source, word, callback, pos, args, lib)
end
end
-local function buildEmmyEnumComment(option, data)
- if not option or not option.comment then
+local function buildEmmyEnumComment(enum, data)
+ if not enum.comment then
return data
end
if not data then
data = {}
end
- data.documentation = tostring(option.comment)
+ data.documentation = tostring(enum.comment)
return data
end
@@ -688,18 +688,19 @@ local function searchEnumAsEmmyParams(vm, source, word, callback, pos, args, fun
return
end
- param:eachEnum(function (str, option)
+ param:eachEnum(function (enum)
+ local str = enum[1]
if matchKey(word, str) then
local strSource = parser:ast(tostring(str), 'String')
if strSource then
if source.type == 'string' then
local data = buildTextEdit(source.start, source.finish, strSource[1], source[2])
- callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(option, data))
+ callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(enum, data))
else
- callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(option))
+ callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(enum))
end
else
- callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(option))
+ callback(str, nil, CompletionItemKind.EnumMember, buildEmmyEnumComment(enum))
end
end
end)
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index b3bbb428..620eb054 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -129,18 +129,18 @@ local function buildEnum(func)
local strs = {}
for _, param in ipairs(params) do
local first = true
- param:eachEnum(function (enum, option)
+ param:eachEnum(function (enum)
if first then
first = false
strs[#strs+1] = ('\n%s: %s'):format(param:getName(), param:getType())
end
- if option and option.default then
- strs[#strs+1] = ('\n |>%s'):format(enum)
+ if enum.default then
+ strs[#strs+1] = ('\n |>%s'):format(enum[1])
else
- strs[#strs+1] = ('\n | %s'):format(enum)
+ strs[#strs+1] = ('\n | %s'):format(enum[1])
end
- if option and option.comment then
- strs[#strs+1] = ' -- ' .. option.comment
+ if enum.comment then
+ strs[#strs+1] = ' -- ' .. enum.comment
end
end)
end