summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-18 01:07:30 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-18 01:07:30 +0800
commitdca751cf110a96a351c8cadc049ac364dc41a4dd (patch)
tree785d41633d4ee6bfa3e97ec25043c5cedbc6da28 /script/core
parent04c671114d1d4c4bcfbad74c8341b24844552865 (diff)
downloadlua-language-server-dca751cf110a96a351c8cadc049ac364dc41a4dd.zip
#1255
diagnostic for enum
Diffstat (limited to 'script/core')
-rw-r--r--script/core/hover/init.lua28
-rw-r--r--script/core/hover/label.lua5
2 files changed, 18 insertions, 15 deletions
diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua
index 949156aa..5a65cbce 100644
--- a/script/core/hover/init.lua
+++ b/script/core/hover/init.lua
@@ -92,19 +92,21 @@ local function getHover(source)
end
local accept = {
- ['local'] = true,
- ['setlocal'] = true,
- ['getlocal'] = true,
- ['setglobal'] = true,
- ['getglobal'] = true,
- ['field'] = true,
- ['method'] = true,
- ['string'] = true,
- ['number'] = true,
- ['integer'] = true,
- ['doc.type.name'] = true,
- ['function'] = true,
- ['doc.module'] = true,
+ ['local'] = true,
+ ['setlocal'] = true,
+ ['getlocal'] = true,
+ ['setglobal'] = true,
+ ['getglobal'] = true,
+ ['field'] = true,
+ ['method'] = true,
+ ['string'] = true,
+ ['number'] = true,
+ ['integer'] = true,
+ ['doc.type.name'] = true,
+ ['doc.class.name'] = true,
+ ['doc.enum.name'] = true,
+ ['function'] = true,
+ ['doc.module'] = true,
}
---@async
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua
index d5c0a11e..5c502ec1 100644
--- a/script/core/hover/label.lua
+++ b/script/core/hover/label.lua
@@ -36,7 +36,7 @@ local function asDocTypeName(source)
return '(alias) ' .. doc.alias[1] .. ' ' .. lang.script('HOVER_EXTENDS', vm.getInfer(doc.extends):view(guide.getUri(source)))
end
if doc.type == 'doc.enum' then
- return '(enum) ' .. doc.enum[1] .. ' ' .. lang.script('HOVER_EXTENDS', vm.getInfer(doc.extends):view(guide.getUri(source)))
+ return '(enum) ' .. doc.enum[1]
end
end
end
@@ -216,7 +216,8 @@ return function (source, oop)
elseif source.type == 'number'
or source.type == 'integer' then
return asNumber(source)
- elseif source.type == 'doc.type.name' then
+ elseif source.type == 'doc.type.name'
+ or source.type == 'doc.enum.name' then
return asDocTypeName(source)
elseif source.type == 'doc.field' then
return asDocFieldName(source)