1
0
Fork 0
mirror of https://git.sr.ht/~neverness/ultima synced 2025-01-10 13:43:54 +00:00
ultima/modules/home/programs/cli/helix/languages.nix

129 lines
3.8 KiB
Nix
Raw Normal View History

2024-11-21 09:24:15 +00:00
{ pkgs, ... }:
let
indent = {
tab-width = 2;
unit = " ";
};
auto-format = true;
in {
programs.helix = with pkgs; {
languages = {
language = let prettier = nodePackages_latest.prettier;
in [
{ # NIX LSP
name = "nix";
language-servers = [ "nixd" ];
formatter.command = "${nixfmt-classic}/bin/nixfmt";
indent = indent;
inherit auto-format;
}
{ # HTML
name = "html";
2024-12-03 14:20:37 +00:00
language-servers = [ "vscode-html" ];
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "html" ];
};
}
{ # JSON
name = "json";
2024-12-03 14:20:37 +00:00
language-servers = [ "vscode-json" ];
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "json" ];
};
}
{ # JSON
name = "jsonc";
2024-12-03 14:20:37 +00:00
language-servers = [ "vscode-json" ];
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "json" ];
};
}
{ # CSS
name = "css";
2024-12-03 14:20:37 +00:00
language-servers = [ "vscode-css" ];
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "css" ];
};
}
{ # MARKDOWN
name = "markdown";
language-servers = [ "marksman" ];
2024-12-03 14:20:37 +00:00
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "markdown" ];
};
}
2024-12-03 14:20:37 +00:00
{ # TYPESCRIPT
2024-11-21 09:24:15 +00:00
name = "typescript";
language-servers = [ "typescript" ];
2024-12-03 14:20:37 +00:00
indent = indent;
2024-11-21 09:24:15 +00:00
inherit auto-format;
formatter = {
command = "${prettier}/bin/prettier";
args = [ "--use-tabs" "--parser" "typescript" ];
};
}
2024-12-03 14:20:37 +00:00
{ # PYTHON
name = "python";
language-servers = [ "pylsp" "ruff" ];
shebangs = [ "${python39}/bin/python" ];
file-types = [ "py" "pyi" "py3" "pyw" ".pythonstartup" ".pythonrc" ];
roots = [ "." "pyproject.toml" "pyrightconfig.json" ];
comment-token = "#";
scope = "source.python";
injection-regex = "python";
indent = indent;
inherit auto-format;
formatter = {
command = "${ruff}/bin/ruff";
args = [ "format" "-" ];
};
}
2024-11-21 09:24:15 +00:00
];
2024-12-03 14:20:37 +00:00
language-server = let
vscode = vscode-langservers-extracted;
typescript = typescript-language-server;
2024-11-21 09:24:15 +00:00
in {
2024-12-03 14:20:37 +00:00
nixd.command = "${nixd}/bin/nixd";
vscode-html.command = "${vscode}/bin/vscode-html-language-server";
vscode-json.command = "${vscode}/bin/vscode-json-language-server";
vscode-css.command = "${vscode}/bin/vscode-css-language-server";
marksman.command = "${marksman}/bin/marksman";
typescript.command = "${typescript}/bin/typescript-language-server";
pyright = {
command = "${pyright}/bin/pyright-langserver";
args = [ "--stdio" ];
config = {
reportMissingTypeStubs = false;
python.analysis = {
typeCheckingMode = "basic";
autoImportCompletions = true;
};
};
2024-11-21 09:24:15 +00:00
};
2024-12-03 14:20:37 +00:00
ruff.command = "${ruff-lsp}/bin/ruff-lsp";
2024-11-21 09:24:15 +00:00
};
};
extraPackages = with pkgs; [
# OTHER LSP
yaml-language-server
lua-language-server
taplo
];
};
}