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:
parent
b9a52ad20e
commit
27ef11f021
3 changed files with 52 additions and 13 deletions
|
@ -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 ''
|
||||||
|
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";
|
name = "rust";
|
||||||
auto-format = false;
|
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; };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,27 @@ with lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
languages = [{
|
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";
|
name = "rust";
|
||||||
auto-format = false;
|
auto-format = false;
|
||||||
}];
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
themes = {
|
themes = {
|
||||||
base16 = let
|
base16 = let
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue