summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
Diffstat (limited to 'script/core')
-rw-r--r--script/core/code-action.lua8
-rw-r--r--script/core/diagnostics/undefined-global.lua46
2 files changed, 37 insertions, 17 deletions
diff --git a/script/core/code-action.lua b/script/core/code-action.lua
index cd5f2f80..b434e2bc 100644
--- a/script/core/code-action.lua
+++ b/script/core/code-action.lua
@@ -74,9 +74,13 @@ local function solveUndefinedGlobal(uri, diag, results)
local name = guide.getName(source)
markGlobal(uri, name, results)
-
- -- TODO check other version
end)
+
+ if diag.data and diag.data.versions then
+ for _, version in ipairs(diag.data.versions) do
+ changeVersion(uri, version, results)
+ end
+ end
end
local function solveLowercaseGlobal(uri, diag, results)
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index c07c3570..2b7c7b41 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -33,26 +33,42 @@ return function (uri, callback)
return
end
- do return end
+ local message = lang.script('DIAG_UNDEF_GLOBAL', key)
+ local defs = vm.getDefs(src, 'deep')
+ local validVersions
+ for _, def in ipairs(defs) do
+ if def.bindDocs then
+ for _, doc in ipairs(def.bindDocs) do
+ if doc.type == 'doc.version' then
+ validVersions = vm.getValidVersions(doc)
+ break
+ end
+ end
+ end
+ end
+
+ local versions
+ if validVersions then
+ versions = {}
+ for version, valid in pairs(validVersions) do
+ if valid then
+ versions[#versions+1] = version
+ end
+ end
+ table.sort(versions)
+ if #versions > 0 then
+ message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(versions, '/'), config.config.runtime.version))
+ end
+ end
callback {
start = src.start,
finish = src.finish,
tags = { define.DiagnosticTag.Deprecated },
- message = 'adsad',
+ message = message,
+ data = {
+ versions = versions,
+ }
}
-
- do return end
-
- local defs = vm.getDefs(src, 'deep')
- local versions = {}
- for _, def in ipairs(defs) do
-
- end
- -- TODO check other version
- local otherVersion
- if otherVersion then
- message = ('%s(%s)'):format(message, lang.script('DIAG_DEFINED_VERSION', table.concat(otherVersion, '/'), config.config.runtime.version))
- end
end)
end