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

139 lines
4 KiB
Nix
Raw Normal View History

{ pkgs, lib, ... }:
2024-11-21 09:24:15 +00:00
let
inherit (lib) getExe;
2024-11-21 09:24:15 +00:00
indent = {
tab-width = 2;
unit = " ";
};
auto-format = true;
in {
programs.helix = with pkgs; {
languages = {
language = let prettier = nodePackages_latest.prettier;
in [
{
# NIX LSP
2024-11-21 09:24:15 +00:00
name = "nix";
language-servers = [ "nixd" "nil" ];
formatter.command = "${getExe nixfmt-rfc-style}";
2024-11-21 09:24:15 +00:00
indent = indent;
inherit auto-format;
}
{
# HTML
2024-11-21 09:24:15 +00:00
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
2024-11-21 09:24:15 +00:00
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
2024-11-21 09:24:15 +00:00
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
2024-11-21 09:24:15 +00:00
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
2024-11-21 09:24:15 +00:00
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" ];
};
}
{
# 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" ];
};
}
{
# PYTHON
2024-12-03 14:20:37 +00:00
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 {
nil.command = "${nil}/bin/nil";
2024-12-03 14:20:37 +00:00
nixd.command = "${nixd}/bin/nixd";
typescript.command = "${typescript}/bin/typescript-language-server";
2024-12-03 14:20:37 +00:00
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";
ruff.command = "${ruff-lsp}/bin/ruff-lsp";
2024-12-03 14:20:37 +00:00
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
};
};
};
extraPackages = with pkgs; [
# OTHER LSP
yaml-language-server
lua-language-server
taplo
];
};
}