1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-21 09:49:41 +01:00
nixvim/ci/nvim-lspconfig/default.nix
Matt Sturgeon b9c5a75cc6 ci/nvim-lspconfig: migrate to the new API
This is nearly a full rewrite of the lspconfig-servers update-script,
migrating it to the new `lsp/` directory system and simplifying where
possible.

- plugins/lsp: adapt to new file format
- flake/locate-lsp-packages: update for new lspconfig file format
- generated: Updated lspconfig-servers.json
2025-10-03 20:29:49 +00:00

54 lines
1.2 KiB
Nix

{
callPackage,
vimPlugins,
runCommand,
pandoc,
jq,
}:
runCommand "lspconfig-servers"
{
lspconfig = vimPlugins.nvim-lspconfig;
nativeBuildInputs = [
jq
pandoc
];
passthru.unsupported = callPackage ./unsupported.nix { };
}
''
for file in "$lspconfig"/lsp/*.lua
do
name=$(basename --suffix=.lua "$file")
# A lua @brief doc-comment has the description
# NOTE: this is only needed for `plugins.lsp`
description=$(
awk '
# Capture the @brief doc-comment
/^---@brief/ {
inbrief=1
next
}
# Print each line in the doc-comment
inbrief && /^--- / {
sub(/^--- /, "")
print
next
}
# Until the end of the comment
inbrief && !/^---/ {
inbrief=0
}
' "$file" \
| pandoc -t markdown --lua-filter ${./desc-filter.lua}
)
# Map each server config to {name: description}
jq --null-input \
--arg name "$name" \
--arg desc "$description" \
'{ ($name): $desc }'
done | jq --slurp add > "$out"
''