From a2cea5dc0d3311b376c74f440536c07034b8dd7e Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sun, 4 May 2025 17:09:57 +0200 Subject: [PATCH] Switch to `vim.lsp.config` & remove ltex-ls --- flake.lock | 18 ------- flake.nix | 5 -- nvim/after/lsp/bashls.lua | 3 ++ nvim/after/lsp/jsonls.lua | 9 ++++ nvim/default.nix | 18 +++---- nvim/lua/plugins/lsp.lua | 101 +++++++------------------------------- 6 files changed, 37 insertions(+), 117 deletions(-) create mode 100644 nvim/after/lsp/bashls.lua create mode 100644 nvim/after/lsp/jsonls.lua diff --git a/flake.lock b/flake.lock index d61923e..8f699fa 100644 --- a/flake.lock +++ b/flake.lock @@ -228,23 +228,6 @@ "type": "github" } }, - "ltex-extra": { - "flake": false, - "locked": { - "lastModified": 1737936194, - "narHash": "sha256-b92tQ9ouf9ikizEalOrVvRDaumttz2ENR7E1rc8N4Bw=", - "owner": "barreiroleo", - "repo": "ltex_extra.nvim", - "rev": "09dc879b1873001f855bca5ad1f024ca15b9bbaf", - "type": "github" - }, - "original": { - "owner": "barreiroleo", - "ref": "dev", - "repo": "ltex_extra.nvim", - "type": "github" - } - }, "neovim-nightly": { "inputs": { "flake-compat": "flake-compat", @@ -402,7 +385,6 @@ "flood": "flood", "home-manager": "home-manager", "impermanence": "impermanence", - "ltex-extra": "ltex-extra", "neovim-nightly": "neovim-nightly", "nix-darwin": "nix-darwin", "nix-index-database": "nix-index-database", diff --git a/flake.nix b/flake.nix index 3a2063c..440e20f 100644 --- a/flake.nix +++ b/flake.nix @@ -44,11 +44,6 @@ url = "github:tmux/tmux"; flake = false; }; - - ltex-extra = { - url = "github:barreiroleo/ltex_extra.nvim/dev"; - flake = false; - }; }; outputs = { diff --git a/nvim/after/lsp/bashls.lua b/nvim/after/lsp/bashls.lua new file mode 100644 index 0000000..30fac2a --- /dev/null +++ b/nvim/after/lsp/bashls.lua @@ -0,0 +1,3 @@ +return { + filetypes = { "sh", "zsh", "make" }, +} diff --git a/nvim/after/lsp/jsonls.lua b/nvim/after/lsp/jsonls.lua new file mode 100644 index 0000000..b874e56 --- /dev/null +++ b/nvim/after/lsp/jsonls.lua @@ -0,0 +1,9 @@ +return { + settings = { + json = { + schemas = require('schemastore').json.schemas(), + format = { enable = true }, + validate = { enable = true }, + }, + }, +} diff --git a/nvim/default.nix b/nvim/default.nix index 88c29bd..ac0ae43 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -2,18 +2,16 @@ pkgs, lib, neovim-nightly, - ltex-extra, ... }: let mkNvim = import ./nix/mknvim.nix {inherit pkgs lib;}; - - mkPlugin = src: pname: - (pkgs.vimUtils.buildVimPlugin - { - inherit pname src; - version = src.lastModifiedDate; - }) - .overrideAttrs {doCheck = false;}; + # mkPlugin = src: pname: + # (pkgs.vimUtils.buildVimPlugin + # { + # inherit pname src; + # version = src.lastModifiedDate; + # }) + # .overrideAttrs {doCheck = false;}; in mkNvim { withNodeJs = false; @@ -69,7 +67,6 @@ in }) SchemaStore-nvim roslyn-nvim - (mkPlugin ltex-extra "ltex-extra") nvim-lint (conform-nvim.overrideAttrs { # clashes with oil @@ -135,7 +132,6 @@ in nil vscode-langservers-extracted # html, jsonls marksman - ltex-ls texlab helm-ls zls diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 38b7fff..2a11291 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -1,87 +1,22 @@ +vim.lsp.enable("lua_ls") +vim.lsp.enable("hls") +vim.lsp.enable("rust_analyzer") +vim.lsp.enable("clangd") +vim.lsp.enable("pyright") +vim.lsp.enable("nil_ls") +vim.lsp.enable("ts_ls") +vim.lsp.enable("yamlls") +vim.lsp.enable("marksman") +vim.lsp.enable("texlab") +vim.lsp.enable("html") +vim.lsp.enable("helm_ls") +vim.lsp.enable("zls") +vim.lsp.enable("gopls") +vim.lsp.enable("bashls") +vim.lsp.enable("jsonls") + return { - { - "lsp", - event = { "BufReadPost", "BufWritePost", "BufNewFile" }, - load = function() end, - after = function() - -- see https://github.com/neovim/nvim-lspconfig/issues/3494 - require("lspconfig").lua_ls.setup({}) - require("lspconfig").hls.setup({}) - require("lspconfig").rust_analyzer.setup({}) - require("lspconfig").clangd.setup({}) - require("lspconfig").pyright.setup({}) - require("lspconfig").nil_ls.setup({}) - require("lspconfig").ts_ls.setup({}) - require("lspconfig").yamlls.setup({}) - require("lspconfig").marksman.setup({}) - require("lspconfig").texlab.setup({}) - require("lspconfig").html.setup({}) - require("lspconfig").helm_ls.setup({}) - require("lspconfig").zls.setup({}) - - require("lspconfig").bashls.setup({ - filetypes = { "sh", "zsh", "make" }, - }) - require("lspconfig").ltex.setup({ - filetypes = { "markdown", "org", "plaintex", "rst", "tex", "pandoc", "rmd", "mail", "text" } - }) - - require("lspconfig").jsonls.setup({ - on_new_config = function(new_config) - new_config.settings.json.schemas = new_config.settings.json.schemas or {} - vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) - end, - settings = { - json = { - format = { - enable = true, - }, - validate = { enable = true }, - }, - }, - }) - - require("lspconfig").gopls.setup({ - settings = { - -- https://go.googlesource.com/vscode-go/+/HEAD/docs/settings.md#settings-for - gopls = { - analyses = { - nilness = true, - unusedparams = true, - unusedwrite = true, - useany = true - }, - experimentalPostfixCompletions = true, - gofumpt = true, - staticcheck = true, - usePlaceholders = true, - hints = { - assignVariableTypes = true, - compositeLiteralFields = true, - compositeLiteralTypes = true, - constantValues = true, - functionTypeParameters = true, - parameterNames = true, - rangeVariableTypes = true - } - } - } - }) - end, - }, - - { - "ltex_extra.nvim", - ft = { "markdown", "tex" }, - opts = { - -- See https://valentjn.github.io/ltex/supported-languages.html#natural-languages - load_langs = { 'en-US' }, - }, - after = function(plug) - require("ltex_extra").setup(plug.opts) - end, - }, - + -- see https://github.com/seblyng/roslyn.nvim/pull/178 { "roslyn.nvim", ft = { "cs", "vb" },