summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/duplicate-doc-field.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/core/diagnostics/duplicate-doc-field.lua')
-rw-r--r--script/core/diagnostics/duplicate-doc-field.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/script/core/diagnostics/duplicate-doc-field.lua b/script/core/diagnostics/duplicate-doc-field.lua
index d4116b9b..a30dfa88 100644
--- a/script/core/diagnostics/duplicate-doc-field.lua
+++ b/script/core/diagnostics/duplicate-doc-field.lua
@@ -1,5 +1,7 @@
local files = require 'files'
local lang = require 'language'
+local vm = require 'vm.vm'
+local await = require 'await'
local function getFieldEventName(doc)
if not doc.extends then
@@ -28,6 +30,7 @@ local function getFieldEventName(doc)
return nil
end
+---@async
return function (uri, callback)
local state = files.getState(uri)
if not state then
@@ -45,7 +48,13 @@ return function (uri, callback)
mark = {}
elseif doc.type == 'doc.field' then
if mark then
- local name = ('%q'):format(doc.field[1])
+ await.delay()
+ 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