-
Notifications
You must be signed in to change notification settings - Fork 481
fix(utils): Changed to be able to refer to default settings proposed … #973
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
Conversation
|
from: #972 (comment) If i want to add new settings based on default setting, i can just pass in a table, i.e. settings["lsp_deps"] = {
"bashls",
"clangd",
"html",
"jsonls",
"lua_ls",
"pylsp",
"zls", -- zig lsp
}If i want to replace/remove some default settings, i need to pass in a function, i.e. settings["lsp_deps"] = function()
return {
"lua_ls",
"pylsp",
"zls", -- zig lsp
}
endDid I missing understanding anything? |
|
The override method is fine |
|
aha, got it. So for referring default settings and adding new settings: local default_setting = require("core.settings")
settings["lsp_deps"] = function(default_settings.lsp_deps)
return {
"zls", -- zig lsp
}
endFor rewriting default settings: settings["lsp_deps"] = function()
return {
"lua_ls",
"pylsp",
"zls", -- zig lsp
}
endam i right? |
|
The suggestion is to leave room for users to do their own merges. settings["lsp_deps"] = {
"bashls",
"clangd",
"html",
"jsonls",
"lua_ls",
"pylsp",
}We can change the settings as follows. (use
settings["lsp_deps"] = {
"zls", -- zig lsp
}
-- Return:
-- {
-- "bashls",
-- "clangd",
-- "html",
-- "jsonls",
-- "lua_ls",
-- "pylsp",
-- "zls"
-- }
settings["lsp_deps"] = function(default)
return {
default[5] -- "lua_ls"
default[6] -- "pylsp"
"zls", -- zig lsp
}
end
-- default:
-- {
-- "bashls",
-- "clangd",
-- "html",
-- "jsonls",
-- "lua_ls",
-- "pylsp",
-- }
-- Return:
-- {
-- "lua_ls",
-- "pylsp",
-- "zls"
-- }
-- Override bufferline
return function(default)
return {
options = {
number = nil,
...
color_icons = default.options.color_icons, -- reference default opt
}
}
end
-- default:
-- options = {
-- number = nil,
-- modified_icon = icons.ui.Modified,
-- buffer_close_icon = icons.ui.Close,
-- ...
--} |
|
tks for the explanations! |
charliie-dev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changed to be able to refer to default settings from
extend_configandload_pluginfunctions proposed in #972