diff options
| -rw-r--r-- | config/plugins/cmp.nix | 4 | ||||
| -rw-r--r-- | config/plugins/efmls.nix | 53 | ||||
| -rw-r--r-- | config/plugins/lsp.nix | 86 |
3 files changed, 63 insertions, 80 deletions
diff --git a/config/plugins/cmp.nix b/config/plugins/cmp.nix index d3d1ab4..1bc85f1 100644 --- a/config/plugins/cmp.nix +++ b/config/plugins/cmp.nix @@ -21,10 +21,10 @@ snippet.expand = "luasnip"; sources = map (name: {inherit name;}) [ - "buffer" - "luasnip" "nvim_lsp" + "luasnip" "path" + "buffer" "rg" ]; }; diff --git a/config/plugins/efmls.nix b/config/plugins/efmls.nix index 3d543a7..e3cfb07 100644 --- a/config/plugins/efmls.nix +++ b/config/plugins/efmls.nix @@ -1,23 +1,15 @@ { plugins = { lsp.servers.efm.extraOptions = { - init_options.documentFormatting = true; + init_options = { + documentFormatting = true; + documentRangeFormatting = true; + }; }; efmls-configs = { enable = true; - externallyManagedPackages = [ - "eslintd" - "isort" - "mypy" - "prettierd" - "prettier_eslint" - "pylint" - "ruff" - "rustfmt" - ]; - setup = { all = { linter = [ @@ -32,7 +24,7 @@ }; css = { - formatter = "prettier_d"; + formatter = "prettier"; }; fish = { @@ -40,16 +32,11 @@ }; html = { - formatter = "prettier_d"; - }; - - javascript = { - formatter = "prettier_eslint"; - linter = "eslint_d"; + formatter = "prettier"; }; json = { - formatter = "prettier_d"; + formatter = "prettier"; }; lua = { @@ -57,32 +44,15 @@ }; nix = { - formatter = "alejandra"; linter = "statix"; }; - python = { - formatter = [ - "ruff" - "isort" - ]; - - linter = [ - "mypy" - "pylint" - ]; - }; - - rust = { - formatter = "rustfmt"; - }; - sass = { - formatter = "prettier_d"; + formatter = "prettier"; }; scss = { - formatter = "prettier_d"; + formatter = "prettier"; }; sh = { @@ -90,11 +60,6 @@ linter = "shellcheck"; }; - typescript = { - formatter = "prettier_eslint"; - linter = "eslint_d"; - }; - yaml = { formatter = "prettier"; linter = "actionlint"; diff --git a/config/plugins/lsp.nix b/config/plugins/lsp.nix index c2648db..0b8e3cd 100644 --- a/config/plugins/lsp.nix +++ b/config/plugins/lsp.nix @@ -1,13 +1,15 @@ -{lib, ...}: { +{ plugins.lsp = { enable = true; + # nil-ls wants dynamicRegistration capabilities = '' capabilities = vim.tbl_deep_extend( - "force", - require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()), - { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } } - ) + "force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } } + ) ''; keymaps = { @@ -17,38 +19,54 @@ "]d" = "goto_next"; "<leader>u" = "setloclist"; }; + + lspBuf = { + "<leader>ca" = "code_action"; + }; }; servers = let - withDefaultOpts = lib.genAttrs [ - "bashls" - "lua-ls" - "nil_ls" - ] (_: {enable = true;}); - - optionalOpts = { - enable = true; - installLanguageServer = false; - autostart = false; - }; + enable = {enable = true;}; - optional = lib.genAttrs [ - "clangd" - "eslint" - "pyright" - "rust-analyzer" - "tsserver" - ] (_: optionalOpts); - in - withDefaultOpts - // optional - // { - rust-analyzer = - optionalOpts - // { - installRustc = false; - installCargo = false; - }; - }; + optional = + enable + // { + installLanguageServer = false; + autostart = false; + }; + in { + bashls = enable; + clangd = optional; + denols = optional; + eslint = optional; + + lua-ls = enable; + + nil_ls = + enable + // { + settings.formatting.command = ["alejandra"]; + }; + + pyright = optional; + ruff-lsp = + optional + // { + # let pyright handle it + onAttach.function = '' + client.server_capabilities.hoverProvider = false + ''; + }; + + rust-analyzer = + optional + // { + installRustc = false; + installCargo = false; + settings.check.command = "clippy"; + }; + + tsserver = optional; + }; }; } |
