1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +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 { languages = mkOption {
type = types.listOf tomlFormat.type; type = with types;
default = [ ]; coercedTo (listOf tomlFormat.type) (language:
example = [{ lib.warn ''
name = "rust"; The syntax of programs.helix.languages has changed.
auto-format = false; 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 = '' description = ''
Language specific configuration at Language specific configuration at
<filename>$XDG_CONFIG_HOME/helix/languages.toml</filename>. <filename>$XDG_CONFIG_HOME/helix/languages.toml</filename>.
@ -140,9 +159,8 @@ in {
"helix/config.toml" = mkIf (cfg.settings != { }) { "helix/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "helix-config" cfg.settings; source = tomlFormat.generate "helix-config" cfg.settings;
}; };
"helix/languages.toml" = mkIf (cfg.languages != [ ]) { "helix/languages.toml" = mkIf (cfg.languages != { }) {
source = source = tomlFormat.generate "helix-languages-config" cfg.languages;
tomlFormat.generate "helix-config" { language = cfg.languages; };
}; };
}; };

View file

@ -21,10 +21,27 @@ with lib;
}; };
}; };
languages = [{ languages = {
name = "rust"; language-server.typescript-language-server = let
auto-format = false; 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 = { themes = {
base16 = let base16 = let

View file

@ -1,3 +1,7 @@
[[language]] [[language]]
auto-format = false auto-format = false
name = "rust" 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"