mirror of
https://gitlab.com/baco/dotconf.git
synced 2024-06-14 12:16:37 +00:00
feat: Merge LSP workspace settings with default ones
Instead of just override the entire Neovim's LSP server settings with new ones from the workspace, merge new settings with existing ones.
This commit is contained in:
parent
bfbf40be41
commit
48341a2d10
|
@ -1,10 +1,22 @@
|
|||
local function table_merge(t1, t2)
|
||||
for k, v in pairs(t2) do
|
||||
if (type(v) == "table") and (type(t1[k] or false) == "table") then
|
||||
table_merge(t1[k], t2[k])
|
||||
else
|
||||
t1[k] = v
|
||||
end
|
||||
end
|
||||
return t1
|
||||
end
|
||||
|
||||
local settings = {}
|
||||
|
||||
settings.pylsp = require("python_lsp_server_settings")
|
||||
|
||||
local workspace_settings_file = vim.fn.findfile(".nvim/lsp-server-settings.lua", ".;")
|
||||
if workspace_settings_file ~= "" then
|
||||
settings = dofile(workspace_settings_file)
|
||||
workspace_settings = dofile(workspace_settings_file)
|
||||
settings = table_merge(settings, workspace_settings)
|
||||
end
|
||||
|
||||
return settings
|
||||
|
|
13
nvim/lua/workspace_sample/lsp-server-settings.lua
Normal file
13
nvim/lua/workspace_sample/lsp-server-settings.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local settings = {}
|
||||
settings.pylsp = {
|
||||
plugins = {
|
||||
flake8 = {maxLineLength = 120},
|
||||
pylint = {
|
||||
args = {
|
||||
"--max-line-length=120",
|
||||
"--disable=missing-docstring,invalid-name,redefined-outer-name,logging-format-interpolation"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
return settings
|
Loading…
Reference in New Issue
Block a user