Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only call workspace/configuration when available #2843

Merged
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 @@ -10,6 +10,7 @@
* `FIX` Improve type narrow by checking exact match on literal type params
* `FIX` Correctly list enums for function overload arguments [#2840](https://github.com/LuaLS/lua-language-server/pull/2840)
* `FIX` Incorrect function params' type infer when there is only `@overload` [#2509](https://github.com/LuaLS/lua-language-server/issues/2509) [#2708](https://github.com/LuaLS/lua-language-server/issues/2708) [#2709](https://github.com/LuaLS/lua-language-server/issues/2709)
* `FIX` Only call workspace/configuration when available [#981](https://github.com/LuaLS/lua-language-server/issues/981), [#2318](https://github.com/LuaLS/lua-language-server/issues/2318), [2336](https://github.com/LuaLS/lua-language-server/issues/2336) [#2843](https://github.com/LuaLS/lua-language-server/pull/2843)

## 3.10.5
`2024-8-19`
Expand Down
3 changes: 3 additions & 0 deletions script/lclient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ local defaultClientOptions = {
},
},
},
workspace = {
configuration = true,
},
},
}

Expand Down
15 changes: 10 additions & 5 deletions script/provider/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ function m.updateConfig(uri)
end

for _, folder in ipairs(scope.folders) do
local clientConfig = cfgLoader.loadClientConfig(folder.uri)
local clientConfig = nil
if client.getAbility('workspace.configuration') then
clientConfig = cfgLoader.loadClientConfig(folder.uri)
end
if clientConfig then
log.info('Load config from client', folder.uri)
log.info(inspect(clientConfig))
Expand All @@ -57,10 +60,12 @@ function m.updateConfig(uri)
config.update(folder, clientConfig, rc)
end

local global = cfgLoader.loadClientConfig()
log.info('Load config from client', 'fallback')
log.info(inspect(global))
config.update(scope.fallback, global)
if client.getAbility('workspace.configuration') then
local global = cfgLoader.loadClientConfig()
log.info('Load config from client', 'fallback')
log.info(inspect(global))
config.update(scope.fallback, global)
end
end

function m.register(method)
Expand Down
Loading