aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-10-31 18:43:54 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-11-12 11:58:21 +0100
commitc48515a50be4c95d8f646c8a293dfe066039ed8b (patch)
tree5eb092f3c56381e8c7de3fdd68f441d3d57d55a8
parent08cd4c82b98194b2dcc3749f944493df17240bc5 (diff)
downloadvis-lspc-c48515a50be4c95d8f646c8a293dfe066039ed8b.tar.gz
vis-lspc-c48515a50be4c95d8f646c8a293dfe066039ed8b.zip
only try to de-flatten a configuration section if it is present
Harper send requests like this {"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{}]},"id":0} containing a single empty item.
-rw-r--r--init.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 15982f4..5cb0d0b 100644
--- a/init.lua
+++ b/init.lua
@@ -1030,14 +1030,17 @@ end
local function lspc_handle_workspace_configuration_call(ls, params, response)
local results = {}
for _, item in ipairs(params.items) do
- local t = ls.settings
- for k in item.section:gmatch('[^.]+') do
- if not t then
- break
+ -- de-flatten the section and map it to our settings if one is present.
+ if item.section then
+ local t = ls.settings
+ for k in item.section:gmatch('[^.]+') do
+ if not t then
+ break
+ end
+ t = t[k]
end
- t = t[k]
+ table.insert(results, t or lspc.json.null)
end
- table.insert(results, t or lspc.json.null)
end
response.result = results
end