{ inputs, config, pkgs, ... }:

{
  programs = {
    helix = {
      enable = true;
      defaultEditor = true;
      settings = {
        theme = "dracula";
      };
      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" ]; };
          }
        ];
        language-server = with pkgs;{
          bash-language-server = {
            command = "${bash-language-server}/bin/bash-language-server";
            args = [ "start" ];
          };

          superhtml = {
            command = "${superhtml}/bin/superhtml";
            args = [ "lsp" ];
          };

          nixd = {
            command = "${nixd}/bin/nixd";
            config.nil = {
              formatting.command = [ "${nixpkgs-fmt}/bin/nixpkgs-fmt" ];
            };
          };

          typescript-language-server = with nodePackages; {
            command = "${typescript-language-server}/bin/typescript-language-server";
            args = [ "--stdio" "--tsserver-path=${typescript}/lib/node_modules/typescript/lib" ];
          };
          vscode-css-language-server = {
            command = "${vscode-langservers-extracted}/bin/vscode-css-language-server";
            args = [ "--stdio" ];
          };
          vscode-json-language-server = {
            command = "${vscode-langservers-extracted}/bin/vscode-json-language-server";
            args = [ "--stdio" ];
          };
          vscode-markdown-language-server = {
            command = "${vscode-langservers-extracted}/bin/vscode-markdown-language-server";
            args = [ "--stdio" ];
          };

          biome = {
            command = "${biome}/bin/biome";
            args = [ "lsp-proxy" ];
          };
        };
      };
    };
  };
}
