mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +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:
parent
b9a52ad20e
commit
27ef11f021
3 changed files with 52 additions and 13 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue