diff --git a/plugins/by-name/neoconf/default.nix b/plugins/by-name/neoconf/default.nix new file mode 100644 index 00000000..da142f8c --- /dev/null +++ b/plugins/by-name/neoconf/default.nix @@ -0,0 +1,92 @@ +{ lib, ... }: +let + inherit (lib.nixvim) defaultNullOpts; +in +lib.nixvim.neovim-plugin.mkNeovimPlugin { + name = "neoconf"; + originalName = "neoconf.nvim"; + package = "neoconf-nvim"; + + maintainers = [ lib.maintainers.BoneyPatel ]; + + settingsOptions = { + local_settings = defaultNullOpts.mkStr ".neoconf.json" '' + Name of the local settings file for the plugin. + ''; + + global_settings = defaultNullOpts.mkStr "neoconf.json" '' + Name of the global settings file in your Neovim config directory. + ''; + + import = { + vscode = defaultNullOpts.mkBool true '' + Whether to import settings from local `.vscode/settings.json` files. + ''; + + coc = defaultNullOpts.mkBool true '' + Whether to import settings from global/local `coc-settings.json` files. + ''; + + lsp = defaultNullOpts.mkBool true '' + Whether to import settings from global/local `nlsp-settings.nvim` JSON settings. + ''; + }; + + live_reload = defaultNullOpts.mkBool true '' + Send new configuration to LSP clients when JSON settings change. + ''; + + filetype_jsonc = defaultNullOpts.mkBool true '' + Set the filetype to JSONC for settings files, allowing comments. Requires the JSONC treesitter parser. + ''; + + plugins = { + lspconfig = { + enabled = defaultNullOpts.mkBool true '' + Enable configuration of LSP clients in order of Lua settings, global JSON settings, then local JSON settings. + ''; + }; + + jsonls = { + enabled = defaultNullOpts.mkBool true '' + Enable jsonls to provide completion for `.nvim.settings.json` files. + ''; + + configured_servers_only = defaultNullOpts.mkBool true '' + Limit JSON settings completion to configured LSP servers only. + ''; + }; + + lua_ls = { + enabled_for_neovim_config = defaultNullOpts.mkBool true '' + Enable lua_ls annotations specifically within the Neovim config directory. + ''; + + enabled = defaultNullOpts.mkBool false '' + Enable adding annotations in local `.nvim.settings.json` files. + ''; + }; + }; + }; + + settingsExample = { + local_settings = ".neoconf.json"; + global_settings = "neoconf.json"; + import = { + vscode = true; + coc = true; + lsp = true; + }; + live_reload = true; + filetype_jsonc = true; + plugins = { + lspconfig = { + enabled = true; + }; + lua_ls = { + enabled_for_neovim_config = true; + enabled = false; + }; + }; + }; +} diff --git a/tests/test-sources/plugins/by-name/neoconf/default.nix b/tests/test-sources/plugins/by-name/neoconf/default.nix new file mode 100644 index 00000000..54376852 --- /dev/null +++ b/tests/test-sources/plugins/by-name/neoconf/default.nix @@ -0,0 +1,67 @@ +{ + empty = { + plugins.neoconf.enable = true; + }; + + defaults = { + plugins.neoconf = { + enable = true; + + settings = { + local_settings = ".neoconf.json"; + global_settings = "neoconf.json"; + import = { + vscode = true; + coc = true; + lsp = true; + }; + live_reload = true; + filetype_jsonc = true; + plugins = { + lspconfig = { + enabled = true; + }; + jsonls = { + enabled = true; + configured_servers_only = true; + }; + lua_ls = { + enabled_for_neovim_config = true; + enabled = false; + }; + }; + }; + }; + }; + + example = { + plugins.neoconf = { + enable = true; + + settings = { + local_settings = ".neoconf.example.json"; + global_settings = "neoconf-example.json"; + import = { + vscode = false; + coc = true; + lsp = false; + }; + live_reload = false; + filetype_jsonc = false; + plugins = { + lspconfig = { + enabled = false; + }; + jsonls = { + enabled = true; + configured_servers_only = false; + }; + lua_ls = { + enabled_for_neovim_config = false; + enabled = true; + }; + }; + }; + }; + }; +}