Skip to content

Commit

Permalink
refactor: better structure for sumneko config
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Sep 10, 2022
1 parent 74b93b1 commit 79a3cf0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
7 changes: 4 additions & 3 deletions lua/settings/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ M.defaults = {
},
-- configures sumneko_lua to get completion of lspconfig server settings
sumneko_lua = {
-- nil: by default, this is only enabled in your neovim config directory
-- true/false: you can explicitely enable/disable this by settings the property below
enabled = nil,
-- by default, sumneko_lua annotations are only enabled in your neovim config directory
enabled_for_neovim_config = true,
-- explicitely enable adding annotations. Mostly relevant to put in your local .nvim.settings.json file
enabled = false,
},
},
}
Expand Down
15 changes: 1 addition & 14 deletions lua/settings/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,7 @@ function M.setup()
M.register({
get_schema = function()
local defaults = require("settings.config").defaults
local ret = require("settings.schema").plugin_schema("settings.nvim", defaults, "Settings for settings.nvim")
ret.properties["settings.nvim"].properties.plugins.properties.sumneko_lua = {
type = "object",
properties = {
enabled = {
description = "When null, this will only be enabled for your neovim config",
type = {
"boolean",
"null",
},
},
},
}
return ret
return require("settings.schema").plugin_schema("settings.nvim", defaults, "Settings for settings.nvim")
end,
})
M.register(require("settings.plugins.lspconfig"))
Expand Down
2 changes: 1 addition & 1 deletion lua/settings/plugins/sumneko.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function M.on_new_config(config, root_dir)
local settings = Config.get({ file = root_dir })

local enabled = settings.plugins.sumneko_lua.enabled
if enabled == nil then
if not enabled and settings.plugins.sumneko_lua.enabled_for_neovim_config then
enabled = Util.is_nvim_config(root_dir)
end

Expand Down

0 comments on commit 79a3cf0

Please sign in to comment.