{ pkgs, ... }:

{
  programs = {
    helix = {
      enable = true;
      defaultEditor = true;
      settings = {
        theme = "dracula";
      };
      extraPackages = with pkgs;[
        marksman
        shfmt
        bash-language-server
        superhtml
        nixd
        nixpkgs-fmt
        biome
      ] ++ (with nodePackages;[
        vscode-langservers-extracted
        typescript-language-server
      ]);
      languages = {
        language = [
          {
            name = "nix";
            language-servers = [ "nixd" "nil" ];
          }
          {
            name = "html";
            language-servers = [ "superhtml" "vscode-html-language-server" ];
          }
          {
            name = "bash";
            formatter = { command = "${pkgs.shfmt}/bin/shfmt"; };
          }
          {
            name = "javascript";
            language-servers = [
              { name = "biome"; }
              {
                name = "typescript-language-server";
                except-features = [ "format" ];
              }
            ];
            auto-format = true;
            formatter = { command = "biome"; args = [ "format" "--stdin-file-path" "a.js" ]; };
          }
          {
            name = "typescript";
            language-servers = [
              { name = "biome"; }
              {
                name = "typescript-language-server";
                except-features = [ "format" ];
              }
            ];
            auto-format = true;
            formatter = { command = "biome"; args = [ "format" "--stdin-file-path" "a.ts" ]; };
          }
          {
            name = "jsx";
            language-servers = [
              { name = "biome"; }
              {
                name = "typescript-language-server";
                except-features = [ "format" ];
              }
            ];
            auto-format = true;
            formatter = { command = "biome"; args = [ "format" "--stdin-file-path" "a.jsx" ]; };
          }
          {
            name = "tsx";
            language-servers = [
              { name = "biome"; }
              {
                name = "typescript-language-server";
                except-features = [ "format" ];
              }
            ];
            auto-format = true;
            formatter = { command = "biome"; args = [ "format" "--stdin-file-path" "a.tsx" ]; };
          }
        ];
      };
    };
  };
}
