summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeOzay <colpaert.benoit@gmail.com>2024-07-08 16:34:32 +0200
committerNeOzay <colpaert.benoit@gmail.com>2024-07-08 16:34:32 +0200
commitaa0fbf5aede66b2c3f380d44f2a031d19fd2d975 (patch)
tree20d55493564019f0ddad878ca1ba96e465c0f7b3
parent46707395df3255808682fdac883f7d86c1ac9a78 (diff)
downloadlua-language-server-aa0fbf5aede66b2c3f380d44f2a031d19fd2d975.zip
fix: add a missing check for inject-field diagnostics
-rw-r--r--script/core/diagnostics/inject-field.lua3
-rw-r--r--test/diagnostics/inject-field.lua13
2 files changed, 16 insertions, 0 deletions
diff --git a/script/core/diagnostics/inject-field.lua b/script/core/diagnostics/inject-field.lua
index 2866eef8..ec027c21 100644
--- a/script/core/diagnostics/inject-field.lua
+++ b/script/core/diagnostics/inject-field.lua
@@ -68,6 +68,9 @@ return function (uri, callback)
if def.type == 'doc.field' then
return
end
+ if def.type == 'tablefield' then
+ return
+ end
end
local howToFix = ''
diff --git a/test/diagnostics/inject-field.lua b/test/diagnostics/inject-field.lua
index 9bb0f8fc..d5b49701 100644
--- a/test/diagnostics/inject-field.lua
+++ b/test/diagnostics/inject-field.lua
@@ -82,3 +82,16 @@ function m:init() -- OK
end
end
]]
+
+TEST [[
+---@class Class
+local m = {
+ xx = 1, -- OK
+}
+
+---@type Class
+local m
+
+m.xx = 1 -- OK
+m.<!yy!> = 1 -- Warning
+]]