summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-08 01:46:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-08 01:46:49 +0800
commitfac6be724ebccdbf79960a288f2d85f3e89ff2ec (patch)
tree7cde49aaf66c6110166504ecf8cf36ab2317dc9c /script/core/diagnostics
parent5f1f0fad1686847fe34936b2f6cd8ee48fd8289d (diff)
downloadlua-language-server-fac6be724ebccdbf79960a288f2d85f3e89ff2ec.zip
update
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/duplicate-doc-field.lua25
1 files changed, 24 insertions, 1 deletions
diff --git a/script/core/diagnostics/duplicate-doc-field.lua b/script/core/diagnostics/duplicate-doc-field.lua
index 03f4dee5..4bed984c 100644
--- a/script/core/diagnostics/duplicate-doc-field.lua
+++ b/script/core/diagnostics/duplicate-doc-field.lua
@@ -1,8 +1,31 @@
local files = require 'files'
local lang = require 'language'
+local infer = require 'vm.infer'
local function getFieldEventName(doc)
-
+ if not doc.extends then
+ return nil
+ end
+ if #doc.extends.types ~= 1 then
+ return nil
+ end
+ local docFunc = doc.extends.types[1]
+ if docFunc.type ~= 'doc.type.function' then
+ return nil
+ end
+ for i = 1, 2 do
+ local arg = docFunc.args[i]
+ if arg
+ and #arg.extends.types == 1 then
+ local literal = arg.extends.types[1]
+ if literal.type == 'doc.type.boolean'
+ or literal.type == 'doc.type.string'
+ or literal.type == 'doc.type.integer' then
+ return ('%q'):format(literal[1])
+ end
+ end
+ end
+ return nil
end
return function (uri, callback)