diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-13 14:03:26 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-11-30 10:20:03 +0100 |
| commit | 22dee48bad475064616dabf8122c2d7bc1444f72 (patch) | |
| tree | 00e783d081974ee07721f504d7258ac214d4e3f5 | |
| parent | db4ffde924c053357d9d34134a337391088b5b3b (diff) | |
| download | vis-lspc-22dee48bad475064616dabf8122c2d7bc1444f72.tar.gz vis-lspc-22dee48bad475064616dabf8122c2d7bc1444f72.zip | |
settings: do not send empty settings arrays to the server
LSP requires that the result array of a workspace/configure call must
include null if the client can not provide any configuration.
| -rw-r--r-- | init.lua | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -967,7 +967,7 @@ function LanguageServer:send_default_settings() -- Use the rootUri or the open file's path as scope for the initial settings local scope = self.rootUri or vis.win.file and vis.win.file.path local effective_ls_settings = settings.effective_settings(self, nil, scope) - if effective_ls_settings then + if next(effective_ls_settings) then self:send_notification('workspace/didChangeConfiguration', { settings = effective_ls_settings, }) @@ -1049,7 +1049,12 @@ local function lspc_handle_workspace_configuration_call(ls, params, response) for _, item in ipairs(params.items) do local scope = item.scopeUri and uri_to_path(item.scopeUri) local effective_settings = settings.effective_settings(ls, item.section, scope) - table.insert(results, effective_settings) + -- If we can not provide any settings LSP requires that null is present in the result array. + if next(effective_settings) then + table.insert(results, effective_settings) + else + table.insert(results, nil) + end end response.result = results end |
