diff --git a/ci/generate.nix b/ci/generate.nix index 5e84d5f8..1e24144d 100644 --- a/ci/generate.nix +++ b/ci/generate.nix @@ -51,6 +51,7 @@ writeShellApplication { generate_json "${conform-formatters}" "conform-formatters" generate_json "${lspconfig-servers}" "lspconfig-servers" + generate_json "${lspconfig-servers.unsupported}" "unsupported-lspconfig-servers" if [ -n "$commit" ]; then cd "$generated_dir" diff --git a/ci/nvim-lspconfig/default.nix b/ci/nvim-lspconfig/default.nix index be910049..ef5c6163 100644 --- a/ci/nvim-lspconfig/default.nix +++ b/ci/nvim-lspconfig/default.nix @@ -1,5 +1,6 @@ { lib, + callPackage, vimPlugins, neovimUtils, wrapNeovimUnstable, @@ -31,6 +32,7 @@ runCommand "lspconfig-servers" pandoc python3 ]; + passthru.unsupported = callPackage ./unsupported.nix { }; } '' export HOME=$(realpath .) diff --git a/ci/nvim-lspconfig/unsupported.nix b/ci/nvim-lspconfig/unsupported.nix new file mode 100644 index 00000000..246b573a --- /dev/null +++ b/ci/nvim-lspconfig/unsupported.nix @@ -0,0 +1,24 @@ +{ + runCommand, + jq, + vimPlugins, +}: +/** + Produces a JSON array of all nvim-lspconfig server configs that don't yet + support the new system. + + I.e., files in the old `lua/lspconfig/configs/` directory, that aren't + present in the new `lsp/` directory. +*/ +runCommand "unsupported-lspconfig-servers" + { + nativeBuildInputs = [ jq ]; + lspconfig = vimPlugins.nvim-lspconfig; + } + '' + for file in "$lspconfig"/lua/lspconfig/configs/*.lua + do + name=$(basename --suffix=.lua "$file") + [ -f "$lspconfig"/lsp/"$name".lua ] || echo "$name" + done | jq --raw-input . | jq --slurp [.] > "$out" + '' diff --git a/generated/unsupported-lspconfig-servers.json b/generated/unsupported-lspconfig-servers.json new file mode 100644 index 00000000..fb61e7af --- /dev/null +++ b/generated/unsupported-lspconfig-servers.json @@ -0,0 +1,16 @@ +[ + "bitbake_ls", + "bqnlsp", + "cadence", + "clarity_lsp", + "codeqlls", + "delphi_ls", + "drools_lsp", + "haxe_language_server", + "openedge_ls", + "pkgbuild_language_server", + "relay_lsp", + "sourcery", + "vdmj", + "vuels" +] diff --git a/plugins/lsp/language-servers/default.nix b/plugins/lsp/language-servers/default.nix index bd3f954e..b3b4a458 100644 --- a/plugins/lsp/language-servers/default.nix +++ b/plugins/lsp/language-servers/default.nix @@ -212,7 +212,26 @@ in imports = let mkLsp = import ./_mk-lsp.nix; - lspModules = map mkLsp generatedServers; + mkUnsupportedLsp = + { + name, + serverName ? name, + ... + }: + lib.mkRemovedOptionModule [ "plugins" "lsp" "servers" name ] '' + nvim-lspconfig has switched from its own LSP configuration API to neovim's built-in LSP API. + '${serverName}' has not been updated to support neovim's built-in LSP API. + See https://github.com/neovim/nvim-lspconfig/issues/3705 + ''; + unsupported = lib.importJSON ../../../generated/unsupported-lspconfig-servers.json; + lspModules = map ( + { + name, + serverName ? name, + ... + }@lsp: + (if lib.elem serverName unsupported then mkUnsupportedLsp else mkLsp) lsp + ) generatedServers; baseLspPath = [ "plugins" "lsp" diff --git a/tests/lsp-servers.nix b/tests/lsp-servers.nix index 947de81e..55afeef7 100644 --- a/tests/lsp-servers.nix +++ b/tests/lsp-servers.nix @@ -1,11 +1,14 @@ { + lib, nixvimConfiguration, name ? "lsp-all-servers", }: let _file = ./lsp-servers.nix; - renamed = builtins.attrNames (import ../plugins/lsp/language-servers/_renamed.nix); + unsupported = + builtins.attrNames (import ../plugins/lsp/language-servers/_renamed.nix) + ++ lib.importJSON ../generated/unsupported-lspconfig-servers.json; enable-lsp-module = { inherit _file; @@ -63,7 +66,7 @@ let package = null; } )) - (lib.filterAttrs (server: _: !(lib.elem server renamed))) + (lib.filterAttrs (server: _: !(lib.elem server unsupported))) ]; # TODO 2025-10-01