From 78f8ce08e289e106cd885fef93ba71cff72d5ed2 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:44:14 -0400 Subject: [PATCH] feat(programs/helix): add superhtml lsp & vscode-langservers-extracted, remove deno config Deno config to be added back, need to figure out a better solution. --- users/uncenter/programs/helix.nix | 163 ++++++++++++++---------------- 1 file changed, 77 insertions(+), 86 deletions(-) diff --git a/users/uncenter/programs/helix.nix b/users/uncenter/programs/helix.nix index 7dd1ea9..77b7a2e 100644 --- a/users/uncenter/programs/helix.nix +++ b/users/uncenter/programs/helix.nix @@ -15,97 +15,64 @@ }; languages = { - language = - let - lang-to-ext = { - javascript = "js"; - json = "json"; - markdown = "md"; - typescript = "ts"; - jsx = "jsx"; - tsx = "tsx"; + language = [ + { + name = "nix"; + formatter = { + command = lib.getExe pkgs.nixfmt-rfc-style; }; - in - [ - { - name = "nix"; - formatter = { - command = lib.getExe pkgs.nixfmt-rfc-style; - }; - auto-format = true; - } - { - name = "python"; - formatter = { - command = "ruff"; - args = [ - "format" - "-" - ]; - }; - auto-format = true; - } - { - name = "fish"; - formatter = { - command = "fish_indent"; - }; - auto-format = true; - } - { - name = "swift"; - formatter = { - command = "swift-format"; - args = [ "format" ]; - }; - auto-format = true; - } - { - name = "toml"; - formatter = { - command = "taplo"; - args = [ - "format" - "-" - ]; - }; - auto-format = true; - } - ] - ++ (lib.attrsets.mapAttrsToList (lang: ext: { auto-format = true; - name = lang; - roots = [ - "deno.json" - "deno.jsonc" - ]; + } + { + name = "python"; formatter = { + command = "ruff"; args = [ - "fmt" + "format" "-" - "--ext" - ext ]; - command = "deno"; }; - }) lang-to-ext) - ++ (lib.attrsets.mapAttrsToList (lang: ext: { - name = lang; - shebangs = [ - "deno" - ]; - roots = [ - "deno.json" - "deno.jsonc" - ]; - file-types = [ - ext - ]; + auto-format = true; + } + { + name = "fish"; + formatter = { + command = "fish_indent"; + }; + auto-format = true; + } + { + name = "swift"; + formatter = { + command = "swift-format"; + args = [ "format" ]; + }; + auto-format = true; + } + { + name = "toml"; + formatter = { + command = "taplo"; + args = [ + "format" + "-" + ]; + }; + auto-format = true; + } + { + name = "html"; + scope = "source.html"; + roots = [ ]; + file-types = [ "html" ]; language-servers = [ - "deno-lsp" + { + name = "superhtml-lsp"; + except-features = [ "format" ]; + } ]; - auto-format = true; - }) lang-to-ext); + } + ]; language-server = { deno-lsp = { @@ -125,12 +92,36 @@ }; }; }; - }; - rust-analyzer = { - config.check.command = "clippy"; + rust-analyzer = { + config.check.command = "clippy"; + }; + vscode-json-language-server = { + config.json.schemas = [ + { + fileMatch = [ + "tsconfig.json" + "tsconfig.*.json" + ]; + url = "https://json.schemastore.org/tsconfig.json"; + } + { + fileMatch = [ + "package.json" + ]; + url = "https://json.schemastore.org/package.json"; + } + ]; + }; + superhtml-lsp = { + command = "superhtml"; + args = [ "lsp" ]; + }; }; }; - extraPackages = with pkgs; [ nodePackages.typescript-language-server ]; + extraPackages = with pkgs; [ + nodePackages.typescript-language-server + nodePackages.vscode-langservers-extracted + ]; }; }