From c48515a50be4c95d8f646c8a293dfe066039ed8b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 31 Oct 2025 18:43:54 +0100 Subject: 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. --- init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'init.lua') 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 -- cgit v1.2.3