tests/generated: validate declared lsp packages

This commit is contained in:
Matt Sturgeon 2024-10-10 17:58:29 +01:00
parent 7916df22d2
commit 0d2751b53c
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 20 additions and 4 deletions

View file

@ -186,10 +186,7 @@ let
else if lib.hasAttr name lspPackages.customCmd then else if lib.hasAttr name lspPackages.customCmd then
{ inherit (lspPackages.customCmd.${name}) package cmd; } { inherit (lspPackages.customCmd.${name}) package cmd; }
else else
assert lib.assertMsg (lib.elem name lspPackages.unpackaged) "LSP server ${name} is unknown"; { package = null; };
{
package = null;
};
generatedServers = lib.pipe ../../../generated/lspconfig-servers.json [ generatedServers = lib.pipe ../../../generated/lspconfig-servers.json [
lib.importJSON lib.importJSON

View file

@ -39,6 +39,25 @@ let
# The test fails if this is non-empty. # The test fails if this is non-empty.
errors = lib.concatStringsSep "\n" ( errors = lib.concatStringsSep "\n" (
checkDeclarations ( checkDeclarations (
let
inherit (import ../plugins/lsp/lsp-packages.nix) unpackaged packages customCmd;
in
{
name = "lsp";
declarationFile = "plugins/lsp/lsp-packages.nix";
packages = builtins.attrValues packages;
declared = unpackaged ++ lib.attrsets.attrNames (packages // customCmd);
generated = lib.pipe ../generated/lspconfig-servers.json [
lib.importJSON
(builtins.map (lib.getAttr "name"))
lib.lists.unique
];
}
)
++ checkDeclarations (
let let
inherit (import ../plugins/by-name/none-ls/packages.nix lib) noPackage packaged; inherit (import ../plugins/by-name/none-ls/packages.nix lib) noPackage packaged;
in in