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

Account for new client.settings in custom configuration handler #627

Merged
merged 1 commit into from
Feb 21, 2024
Merged
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
11 changes: 8 additions & 3 deletions lua/jdtls/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,19 @@ local function configuration_handler(err, result, ctx, config)
-- This isn't done in start_or_attach because a user could use a plugin like editorconfig to configure tabsize/spaces
-- That plugin may run after `start_or_attach` which is why we defer the setting lookup.
-- This ensures the language-server will use the latest version of the options
client.config.settings = vim.tbl_deep_extend('keep', client.config.settings or {}, {
local new_settings = {
java = {
format = {
insertSpaces = api.nvim_buf_get_option(bufnr, 'expandtab'),
insertSpaces = vim.bo[bufnr].expandtab,
tabSize = lsp.util.get_effective_tabstop(bufnr)
}
}
})
}
if client.settings then
client.settings.java = vim.tbl_deep_extend('keep', client.settings.java or {}, new_settings.java)
else
client.config.settings = vim.tbl_deep_extend('keep', client.config.settings or {}, new_settings)
end
end
return lsp.handlers['workspace/configuration'](err, result, ctx, config)
end
Expand Down
Loading