feat: refactor and separate LSP/language configurations

This commit is contained in:
NotAShelf 2023-04-17 23:27:27 +03:00
commit 6b512f132a
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
30 changed files with 1266 additions and 522 deletions

25
lib/languages.nix Normal file
View file

@ -0,0 +1,25 @@
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
{lib}: {
# Converts a boolean to a yes/no string. This is used in lots of
# configuration formats.
diagnosticsToLua = {
lang,
config,
diagnostics,
}:
lib.listToAttrs
(map (v: let
type =
if builtins.isString v
then v
else builtins.getAttr v.type;
package =
if builtins.isString v
then diagnostics.${type}.package
else v.package;
in {
name = "${lang}-diagnostics-${type}";
value = diagnostics.${type}.nullConfig package;
})
config);
}