diff options
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | meta/template/string.lua | 1 | ||||
-rw-r--r-- | script/core/diagnostics/inject-field.lua | 3 | ||||
-rw-r--r-- | script/core/hint.lua | 2 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 | ||||
-rw-r--r-- | test/diagnostics/inject-field.lua | 13 |
7 files changed, 23 insertions, 7 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6db21ca..7b4de2ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,8 +27,8 @@ jobs: - { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl } - { os: ubuntu-20.04, target: linux, platform: linux-x64 } - { os: ubuntu-20.04, target: linux, platform: linux-arm64 } - - { os: macos-11, target: darwin, platform: darwin-x64 } - - { os: macos-11, target: darwin, platform: darwin-arm64 } + - { os: macos-latest, target: darwin, platform: darwin-x64 } + - { os: macos-latest, target: darwin, platform: darwin-arm64 } - { os: windows-latest, target: windows, platform: win32-ia32 } - { os: windows-latest, target: windows, platform: win32-x64 } runs-on: ${{ matrix.os }} diff --git a/changelog.md b/changelog.md index 8f835b3e..8ad44ec0 100644 --- a/changelog.md +++ b/changelog.md @@ -8,7 +8,8 @@ * `FIX` Respect `completion.showParams` config for local function completion * `CHG` Improve performance of multithreaded `--check` and `undefined-field` diagnostic * `NEW` added lua regular expression support for Lua.doc.<scope>Name [#2753](https://github.com/LuaLS/lua-language-server/pull/2753) - +* `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 `2024-6-11` diff --git a/meta/template/string.lua b/meta/template/string.lua index e23b0803..14e01a7b 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -73,7 +73,6 @@ function string.gmatch(s, pattern, init) end ---@param n? integer ---@return string ---@return integer count ----@nodiscard function string.gsub(s, pattern, repl, n) end ---#DES 'string.len' diff --git a/script/core/diagnostics/inject-field.lua b/script/core/diagnostics/inject-field.lua index 2866eef8..e1ef02a3 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' and not isExact then + return + end end local howToFix = '' diff --git a/script/core/hint.lua b/script/core/hint.lua index 67ac8516..9d098aa9 100644 --- a/script/core/hint.lua +++ b/script/core/hint.lua @@ -59,7 +59,7 @@ local function typeHint(uri, results, start, finish) end mark[src] = true results[#results+1] = { - text = ':' .. view, + text = ': ' .. view, offset = src.finish, kind = define.InlayHintKind.Type, where = 'right', diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 15e78b9a..2e2fb5eb 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -1426,8 +1426,8 @@ m.register 'textDocument/inlayHint' { }, position = converter.packPosition(state, res.offset), kind = res.kind, - paddingLeft = res.kind == 1, - paddingRight = res.kind == 2, + paddingLeft = false, + paddingRight = res.kind == define.InlayHintKind.Parameter, } end return hintResults 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 +]] |