1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-27 12:19:48 +01:00

helix: update languages.toml generation (support every option in languages.toml) (#4003)

Co-authored-by: Naïm Favier <n@monade.li>
This commit is contained in:
Philipp Mildenberger 2023-05-20 17:22:06 +02:00 committed by GitHub
parent b9a52ad20e
commit 27ef11f021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 13 deletions

View file

@ -46,12 +46,31 @@ in {
};
languages = mkOption {
type = types.listOf tomlFormat.type;
default = [ ];
example = [{
name = "rust";
auto-format = false;
}];
type = with types;
coercedTo (listOf tomlFormat.type) (language:
lib.warn ''
The syntax of programs.helix.languages has changed.
It now generates the whole languages.toml file instead of just the language array in that file.
Use
{ language = <languages list>; }
instead.
'' { inherit language; }) (addCheck tomlFormat.type builtins.isAttrs);
default = { };
example = literalExpression ''
{
# the language-server option currently requires helix from the master branch at https://github.com/helix-editor/helix/
language-server.typescript-language-server = with pkgs.nodePackages; {
command = "''${typescript-language-server}/bin/typescript-language-server";
args = [ "--stdio" "--tsserver-path=''${typescript}/lib/node_modules/typescript/lib" ];
};
language = [{
name = "rust";
auto-format = false;
}];
}
'';
description = ''
Language specific configuration at
<filename>$XDG_CONFIG_HOME/helix/languages.toml</filename>.
@ -140,9 +159,8 @@ in {
"helix/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "helix-config" cfg.settings;
};
"helix/languages.toml" = mkIf (cfg.languages != [ ]) {
source =
tomlFormat.generate "helix-config" { language = cfg.languages; };
"helix/languages.toml" = mkIf (cfg.languages != { }) {
source = tomlFormat.generate "helix-languages-config" cfg.languages;
};
};

View file

@ -21,10 +21,27 @@ with lib;
};
};
languages = [{
name = "rust";
auto-format = false;
}];
languages = {
language-server.typescript-language-server = let
typescript-language-server = config.lib.test.mkStubPackage {
outPath = "@typescript-language-server@";
};
typescript =
config.lib.test.mkStubPackage { outPath = "@typescript@"; };
in {
command =
"${typescript-language-server}/bin/typescript-language-server";
args = [
"--stdio"
"--tsserver-path=${typescript}/lib/node_modules/typescript/lib"
];
};
language = [{
name = "rust";
auto-format = false;
}];
};
themes = {
base16 = let

View file

@ -1,3 +1,7 @@
[[language]]
auto-format = false
name = "rust"
[language-server.typescript-language-server]
args = ["--stdio", "--tsserver-path=@typescript@/lib/node_modules/typescript/lib"]
command = "@typescript-language-server@/bin/typescript-language-server"