plugins.lsp: automatically remove unsupported servers

A new update script will check which "old" files do not have an
equivalent "new" file, then the plugins.lsp module will create a
removal assertion for any servers that are listed in the generated
file.
This commit is contained in:
Matt Sturgeon 2025-10-01 22:53:06 +01:00
parent fc779c6e82
commit 5c4a10093d
6 changed files with 68 additions and 3 deletions

View file

@ -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"

View file

@ -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 .)

View file

@ -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"
''