summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-23 03:32:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-23 03:32:57 +0800
commit420812ce4e77ff4143437b2893dd77fc729c7622 (patch)
tree92293fc9ab871147060130e432819ea3c3e6f6b9 /script/core
parent838ce36fdd7abdff0b4cab5e67c2500325178805 (diff)
downloadlua-language-server-420812ce4e77ff4143437b2893dd77fc729c7622.zip
update
Diffstat (limited to 'script/core')
-rw-r--r--script/core/collector.lua7
-rw-r--r--script/core/diagnostics/duplicate-doc-field.lua8
2 files changed, 14 insertions, 1 deletions
diff --git a/script/core/collector.lua b/script/core/collector.lua
index a2e3ca08..368a04ec 100644
--- a/script/core/collector.lua
+++ b/script/core/collector.lua
@@ -71,6 +71,8 @@ local DUMMY_FUNCTION = function () end
local function eachOfFolder(nameCollect, scp)
local curi, value
+ ---@return any
+ ---@return uri
local function getNext()
curi, value = next(nameCollect, curi)
if not curi then
@@ -90,6 +92,8 @@ end
local function eachOfLinked(nameCollect, scp)
local curi, value
+ ---@return any
+ ---@return uri
local function getNext()
curi, value = next(nameCollect, curi)
if not curi then
@@ -120,6 +124,8 @@ end
local function eachOfFallback(nameCollect, scp)
local curi, value
+ ---@return any
+ ---@return uri
local function getNext()
curi, value = next(nameCollect, curi)
if not curi then
@@ -146,6 +152,7 @@ end
--- 迭代某个名字的订阅
---@param uri uri
---@param name string
+---@return fun():any, uri
function mt:each(uri, name)
uri = uri or '<fallback>'
local nameCollect = self.collect[name]
diff --git a/script/core/diagnostics/duplicate-doc-field.lua b/script/core/diagnostics/duplicate-doc-field.lua
index d4116b9b..78112beb 100644
--- a/script/core/diagnostics/duplicate-doc-field.lua
+++ b/script/core/diagnostics/duplicate-doc-field.lua
@@ -1,5 +1,6 @@
local files = require 'files'
local lang = require 'language'
+local vm = require 'vm.vm'
local function getFieldEventName(doc)
if not doc.extends then
@@ -45,7 +46,12 @@ return function (uri, callback)
mark = {}
elseif doc.type == 'doc.field' then
if mark then
- local name = ('%q'):format(doc.field[1])
+ local name
+ if doc.field.type == 'doc.type' then
+ name = ('[%s]'):format(vm.getInfer(doc.field):view(uri))
+ else
+ name = ('%q'):format(doc.field[1])
+ end
local eventName = getFieldEventName(doc)
if eventName then
name = name .. '|' .. eventName