vscode: refactor with new profile support
All checks were successful
check / check (push) Successful in 30s

Inspired by 1cc1ff0435/modules/home/programs/graphical/editors/vscode/default.nix
This commit is contained in:
Florian RICHER 2025-02-22 23:37:30 +01:00
parent 863fc04e17
commit fff5b682ba
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77

View file

@ -11,49 +11,77 @@ in
''; '';
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
# Inspired by https://github.com/khaneliman/khanelinix/blob/1cc1ff0435671804666cdc732a0b792178441e2f/modules/home/programs/graphical/editors/vscode/default.nix
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
userSettings = { profiles =
"files.autoSave" = "onFocusChange"; let
"emmet.includeLanguages" = { commonExtensions = with pkgs.vscode-extensions; [
"phoenix-heex" = "html"; # Direnv to automatically Load Dev Env
mkhl.direnv
# Nix
bbenoist.nix
# Improve error display
usernamehw.errorlens
];
commonSettings = {
"files.autoSave" = "onFocusChange";
"git.autofetch" = true;
};
in
{
default = {
extensions = commonExtensions;
enableUpdateCheck = false;
enableExtensionUpdateCheck = false;
userSettings = commonSettings;
};
C_CPP = {
extensions =
with pkgs.vscode-extensions;
commonExtensions
++ [ ms-vscode.cpptools ];
};
Phoenix = {
extensions =
with pkgs.vscode-extensions;
commonExtensions
++ [ phoenixframework.phoenix elixir-lsp.vscode-elixir-ls ];
userSettings = commonSettings // {
"emmet.includeLanguages" = {
"phoenix-heex" = "html";
};
};
};
Ruby = {
extensions =
with pkgs.vscode-extensions;
commonExtensions
++ [ shopify.ruby-lsp ];
};
Rust = {
extensions =
with pkgs.vscode-extensions;
commonExtensions
++ [ tamasfe.even-better-toml ]; # rust-lang.rust-analyzer not compile for now
};
Typescript = {
extensions =
with pkgs.vscode-extensions;
commonExtensions
++ [ yoavbls.pretty-ts-errors ];
};
}; };
"git.autofetch" = true;
};
userTasks = {};
# Waiting https://github.com/nix-community/home-manager/pull/5640 to support multi-profiles support
extensions = with pkgs; with vscode-extensions; [
# Direnv to automatically Load Dev Env
mkhl.direnv
# Nix
bbenoist.nix
# Rust
rust-lang.rust-analyzer
tamasfe.even-better-toml
# Phoenix
phoenixframework.phoenix
elixir-lsp.vscode-elixir-ls
# Ruby
shopify.ruby-lsp
# C/C++ Support
ms-vscode.cpptools
# Improve error display
usernamehw.errorlens
# TS Error
yoavbls.pretty-ts-errors
];
}; };
}; };
} }