{ 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 name = "nix"; language-servers = [ "nixd" "nil" ]; formatter.command = "${getExe nixfmt-rfc-style}"; indent = indent; inherit auto-format; } { # HTML name = "html"; language-servers = [ "vscode-html" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "html" ]; }; } { # JSON name = "json"; language-servers = [ "vscode-json" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "json" ]; }; } { # JSON name = "jsonc"; language-servers = [ "vscode-json" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "json" ]; }; } { # CSS name = "css"; language-servers = [ "vscode-css" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "css" ]; }; } { # MARKDOWN name = "markdown"; language-servers = [ "marksman" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "markdown" ]; }; } { # TYPESCRIPT name = "typescript"; language-servers = [ "typescript" ]; indent = indent; inherit auto-format; formatter = { command = "${prettier}/bin/prettier"; args = [ "--use-tabs" "--parser" "typescript" ]; }; } { # 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" "-" ]; }; } ]; language-server = let vscode = vscode-langservers-extracted; typescript = typescript-language-server; in { nil.command = "${nil}/bin/nil"; nixd.command = "${nixd}/bin/nixd"; typescript.command = "${typescript}/bin/typescript-language-server"; 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"; pyright = { command = "${pyright}/bin/pyright-langserver"; args = [ "--stdio" ]; config = { reportMissingTypeStubs = false; python.analysis = { typeCheckingMode = "basic"; autoImportCompletions = true; }; }; }; }; }; extraPackages = with pkgs; [ # OTHER LSP yaml-language-server lua-language-server taplo ]; }; }