{ pkgs, lib, ... }: let inherit (lib) getExe; indent = { tab-width = 2; unit = " "; }; auto-format = true; in { programs.helix = with pkgs; { languages = { language = let prettier = nodePackages_latest.prettier; in [ { # NIX LSP inherit auto-format indent; name = "nix"; language-servers = [ "nixd" "nil" ]; formatter.command = "${getExe nixfmt-rfc-style}"; } { # HTML inherit auto-format indent; name = "html"; language-servers = [ "vscode-html" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "html" ]; }; } { # JSON inherit auto-format indent; name = "json"; language-servers = [ "vscode-json" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "json" ]; }; } { # JSON inherit auto-format indent; name = "jsonc"; language-servers = [ "vscode-json" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "json" ]; }; } { # CSS inherit auto-format indent; name = "css"; language-servers = [ "vscode-css" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "css" ]; }; } { # MARKDOWN inherit auto-format indent; name = "markdown"; language-servers = [ "marksman" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "markdown" ]; }; } { # TYPESCRIPT inherit auto-format indent; name = "typescript"; language-servers = [ "typescript" ]; formatter = { command = "${getExe prettier}"; args = [ "--use-tabs" "--parser" "typescript" ]; }; } { # PYTHON inherit auto-format indent; name = "python"; language-servers = [ "pylsp" "ruff" ]; shebangs = [ "${getExe python39}" ]; file-types = [ "py" "pyi" "py3" "pyw" ".pythonstartup" ".pythonrc" ]; roots = [ "." "pyproject.toml" "pyrightconfig.json" ]; comment-token = "#"; scope = "source.python"; injection-regex = "python"; formatter = { command = "${getExe ruff}"; args = [ "format" "-" ]; }; } ]; language-server = let vscode = vscode-langservers-extracted; typescript = typescript-language-server; in { nil.command = "${getExe nil}"; nixd.command = "${getExe nixd}"; typescript.command = "${getExe typescript}"; 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 = "${getExe marksman}"; ruff.command = "${getExe ruff-lsp}"; pyright = { command = "${getExe pyright}"; args = [ "--stdio" ]; config = { reportMissingTypeStubs = false; python.analysis = { typeCheckingMode = "basic"; autoImportCompletions = true; }; }; }; }; }; extraPackages = with pkgs; [ # OTHER LSP yaml-language-server lua-language-server taplo ]; }; }