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

let
  vs-extensions = inputs.nix-vscode-extensions.extensions.x86_64-linux.open-vsx;
in
{
  home.packages = with pkgs;[
    (nerdfonts.override { fonts = [ "SpaceMono" ]; })
  ];

  programs = {
    vscode = {
      enable = true;
      package = pkgs.vscodium;
      mutableExtensionsDir = false;
      extensions = with vs-extensions;[
        biomejs.biome
        mkhl.direnv
        dracula-theme.theme-dracula
        dbaeumer.vscode-eslint
        eamodio.gitlens
        pkief.material-icon-theme
        jnoortheen.nix-ide
        esbenp.prettier-vscode
        bradlc.vscode-tailwindcss
        humao.rest-client
        loriscro.super
        mads-hartmann.bash-ide-vscode
        foxundermoon.shell-format
      ];
      userSettings = with pkgs;{
        "workbench.iconTheme" = "material-icon-theme";
        "window.titleBarStyle" = "custom";
        "workbench.colorTheme" = "Dracula Theme";

        "editor.fontFamily" = "'SpaceMono Nerd Font', 'monospace', monospace";
        "editor.fontSize" = 16;

        "files.autoSave" = "onWindowChange";
        "editor.formatOnSave" = true;
        "editor.codeActionsOnSave" = {
          "source.organizeImports" = "always";
        };

        "typescript.preferences.preferTypeOnlyAutoImports" = true;
        "chat.commandCenter.enabled" = false;

        "nix.enableLanguageServer" = true; # Enable LSP.
        "nix.serverPath" = "${nixd}/bin/nixd"; # The path to the LSP server executable.
        "nix.serverSettings" = {
          nixd = {
            formatting.command = [ "${nixpkgs-fmt}/bin/nixpkgs-fmt" ];
          };
        };

        "biome.lsp.bin" = "${biome}/bin/biome";

        "bashIde.shellcheckPath" = "${shellcheck}/bin/shellcheck";
        "shellformat.path" = "${shfmt}/bin/shfmt";
      };
    };
  };
}

