From 6007748e175646824e130946be2ce9dc31765ab8 Mon Sep 17 00:00:00 2001 From: Lander Van den Bulcke Date: Tue, 30 Sep 2025 11:00:39 +0200 Subject: [PATCH] chore: move from plugins.lsp to lsp Signed-off-by: Lander Van den Bulcke --- config/plugins/lsp/lsp.nix | 297 ++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 173 deletions(-) diff --git a/config/plugins/lsp/lsp.nix b/config/plugins/lsp/lsp.nix index 1f9d826..8d178c7 100644 --- a/config/plugins/lsp/lsp.nix +++ b/config/plugins/lsp/lsp.nix @@ -4,6 +4,9 @@ let in { plugins = { + lspconfig = { + enable = true; + }; lsp-lines = { enable = true; }; @@ -16,180 +19,128 @@ in lspsaga = { enable = true; }; - lsp = { - enable = true; - inlayHints = true; - servers = { - html = { - enable = true; - }; - lua_ls = { - enable = true; - }; - nil_ls = { - enable = true; - }; - ts_ls = { - enable = true; - }; - marksman = { - enable = true; - }; - pyright = { - enable = true; - }; - gopls = { - enable = true; - }; - terraformls = { - enable = true; - settings = { - terraform.path = "${pkgs.opentofu}/bin/tofu"; - }; - }; - jsonls = { - enable = true; - }; - hls = { - enable = true; - installGhc = true; - }; - rubocop = { - enable = true; - }; - ruby_lsp = { - enable = true; - }; - texlab = { - enable = true; - }; - puppet = { - enable = true; - package = puppet-editor-services; - cmd = [ - "${puppet-editor-services}/bin/puppet-languageserver" - "--stdio" - ]; - }; - helm_ls = { - enable = true; - extraOptions = { - settings = { - "helm_ls" = { - yamlls = { - path = "${pkgs.yaml-language-server}/bin/yaml-language-server"; - }; - }; - }; - }; - }; - yamlls = { - enable = true; - extraOptions = { - settings = { - yaml = { - format = { - singleQuote = true; - }; - schemas = { - kubernetes = "'*.yaml"; - "http://json.schemastore.org/github-workflow" = ".github/workflows/*"; - "http://json.schemastore.org/github-action" = ".github/action.{yml,yaml}"; - "http://json.schemastore.org/ansible-stable-2.9" = "roles/tasks/*.{yml,yaml}"; - "http://json.schemastore.org/kustomization" = "kustomization.{yml,yaml}"; - "http://json.schemastore.org/ansible-playbook" = "*play*.{yml,yaml}"; - "http://json.schemastore.org/chart" = "Chart.{yml,yaml}"; - "https://json.schemastore.org/dependabot-v2" = ".github/dependabot.{yml,yaml}"; - "https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json" = - "*docker-compose*.{yml,yaml}"; - "https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json" = - "*flow*.{yml,yaml}"; - }; - }; - }; - }; - }; - }; - - keymaps = { - silent = true; - lspBuf = { - gd = { - action = "definition"; - desc = "Goto Definition"; - }; - gr = { - action = "references"; - desc = "Goto References"; - }; - gD = { - action = "declaration"; - desc = "Goto Declaration"; - }; - gI = { - action = "implementation"; - desc = "Goto Implementation"; - }; - gT = { - action = "type_definition"; - desc = "Type Definition"; - }; - K = { - action = "hover"; - desc = "Hover"; - }; - "cw" = { - action = "workspace_symbol"; - desc = "Workspace Symbol"; - }; - "cr" = { - action = "rename"; - desc = "Rename"; - }; - }; - diagnostic = { - "cd" = { - action = "open_float"; - desc = "Line Diagnostics"; - }; - "[d" = { - action = "goto_next"; - desc = "Next Diagnostic"; - }; - "]d" = { - action = "goto_prev"; - desc = "Previous Diagnostic"; - }; - }; - }; - }; }; - extraPlugins = with pkgs.vimPlugins; [ - ansible-vim - vim-puppet - ]; - - extraConfigLua = '' - local _border = "rounded" - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( - vim.lsp.handlers.hover, { - border = _border - } - ) - - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( - vim.lsp.handlers.signature_help, { - border = _border - } - ) - - vim.diagnostic.config{ - float={border=_border} + lsp = { + servers = { + html = { + enable = true; + }; + lua_ls = { + enable = true; + }; + nil_ls = { + enable = true; + }; + ts_ls = { + enable = true; + }; + marksman = { + enable = true; + }; + pyright = { + enable = true; + }; + gopls = { + enable = true; + }; + terraformls = { + enable = true; + settings = { + terraform.path = "${pkgs.opentofu}/bin/tofu"; + }; + }; + jsonls = { + enable = true; + }; + hls = { + enable = true; + }; + rubocop = { + enable = true; + }; + ruby_lsp = { + enable = true; + }; + texlab = { + enable = true; + }; + puppet = { + enable = true; + package = puppet-editor-services; + settings.cmd = [ + "${puppet-editor-services}/bin/puppet-languageserver" + "--stdio" + ]; + }; + helm_ls = { + enable = true; + settings = { + "helm_ls" = { + yamlls = { + path = "${pkgs.yaml-language-server}/bin/yaml-language-server"; + }; + }; + }; + }; + yamlls = { + enable = true; + settings = { + yaml = { + format = { + singleQuote = true; + }; + schemas = { + kubernetes = "'*.yaml"; + "http://json.schemastore.org/github-workflow" = ".github/workflows/*"; + "http://json.schemastore.org/github-action" = ".github/action.{yml,yaml}"; + "http://json.schemastore.org/ansible-stable-2.9" = "roles/tasks/*.{yml,yaml}"; + "http://json.schemastore.org/kustomization" = "kustomization.{yml,yaml}"; + "http://json.schemastore.org/ansible-playbook" = "*play*.{yml,yaml}"; + "http://json.schemastore.org/chart" = "Chart.{yml,yaml}"; + "https://json.schemastore.org/dependabot-v2" = ".github/dependabot.{yml,yaml}"; + "https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json" = + "*docker-compose*.{yml,yaml}"; + "https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json" = + "*flow*.{yml,yaml}"; + }; + }; + }; + }; }; - require('lspconfig.ui.windows').default_options = { - border = _border - } - ''; + keymaps = [ + { + key = "gd"; + lspBufAction = "definition"; + } + { + key = "gr"; + lspBufAction = "references"; + } + { + key = "gD"; + lspBufAction = "declaration"; + } + { + key = "gI"; + lspBufAction = "implementation"; + } + { + key = "gT"; + lspBufAction = "type_definition"; + } + { + key = "K"; + lspBufAction = "hover"; + } + { + key = "cw"; + lspBufAction = "workspace_symbol"; + } + { + key = "cr"; + lspBufAction = "rename"; + } + ]; + }; }