diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-10-31 18:43:54 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-11-12 11:58:21 +0100 |
| commit | c48515a50be4c95d8f646c8a293dfe066039ed8b (patch) | |
| tree | 5eb092f3c56381e8c7de3fdd68f441d3d57d55a8 /init.lua | |
| parent | 08cd4c82b98194b2dcc3749f944493df17240bc5 (diff) | |
| download | vis-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.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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 |
