Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* `NEW` Add support for lambda style functions, `|paramList| expr` is syntactic sugar for `function(paramList) return expr end`
* `FIX` Respect `completion.showParams` config for local function completion
* `CHG` Improve performance of multithreaded `--check` and `undefined-field` diagnostic
* `FIX` Bad triggering of the `inject-field` diagnostic, when the fields are declared at the creation of the object [#2746](https://github.com/LuaLS/lua-language-server/issues/2746)
* `CHG` Change spacing of parameter inlay hints to match other LSPs, like `rust-analyzer`

## 3.9.3
Expand Down
3 changes: 3 additions & 0 deletions script/core/diagnostics/inject-field.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ return function (uri, callback)
if def.type == 'doc.field' then
return
end
if def.type == 'tablefield' and not isExact then
return
end
end

local howToFix = ''
Expand Down
13 changes: 13 additions & 0 deletions test/diagnostics/inject-field.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
]]