2024-09-15 13:54:43 +02:00
{ config , pkgs , lib , . . . }:
with lib ;
let
cfg = config . modules . home . editors . vscode ;
in
{
options . modules . home . editors . vscode = {
enable = mkEnableOption ''
Enable vscode with my custom configurations
'' ;
} ;
config = mkIf cfg . enable {
2025-02-22 23:37:30 +01:00
# Inspired by https://github.com/khaneliman/khanelinix/blob/1cc1ff0435671804666cdc732a0b792178441e2f/modules/home/programs/graphical/editors/vscode/default.nix
2024-09-15 13:54:43 +02:00
programs . vscode = {
enable = true ;
2025-02-22 23:37:30 +01:00
profiles =
let
commonExtensions = with pkgs . vscode-extensions ; [
# Direnv to automatically Load Dev Env
mkhl . direnv
2024-09-15 13:54:43 +02:00
2025-02-22 23:37:30 +01:00
# Nix
bbenoist . nix
2024-09-15 13:54:43 +02:00
2025-02-22 23:37:30 +01:00
# Improve error display
usernamehw . errorlens
] ;
2025-02-08 20:59:33 +01:00
2025-02-22 23:37:30 +01:00
commonSettings = {
" f i l e s . a u t o S a v e " = " o n F o c u s C h a n g e " ;
" g i t . a u t o f e t c h " = true ;
} ;
in
{
default = {
extensions = commonExtensions ;
enableUpdateCheck = false ;
enableExtensionUpdateCheck = false ;
userSettings = commonSettings ;
} ;
2024-09-15 13:54:43 +02:00
2025-02-22 23:37:30 +01:00
C_CPP = {
extensions =
with pkgs . vscode-extensions ;
commonExtensions
++ [ ms-vscode . cpptools ] ;
} ;
2024-09-15 13:54:43 +02:00
2025-02-22 23:37:30 +01:00
Phoenix = {
extensions =
with pkgs . vscode-extensions ;
commonExtensions
++ [ phoenixframework . phoenix elixir-lsp . vscode-elixir-ls ] ;
2024-09-15 13:54:43 +02:00
2025-02-22 23:37:30 +01:00
userSettings = commonSettings // {
" e m m e t . i n c l u d e L a n g u a g e s " = {
" p h o e n i x - h e e x " = " h t m l " ;
} ;
} ;
} ;
2025-02-08 20:59:33 +01:00
2025-02-22 23:37:30 +01:00
Ruby = {
extensions =
with pkgs . vscode-extensions ;
commonExtensions
++ [ shopify . ruby-lsp ] ;
} ;
2025-02-08 20:59:33 +01:00
2025-02-22 23:37:30 +01:00
Rust = {
extensions =
with pkgs . vscode-extensions ;
commonExtensions
++ [ tamasfe . even-better-toml ] ; # rust-lang.rust-analyzer not compile for now
} ;
2025-02-08 20:59:33 +01:00
2025-02-22 23:37:30 +01:00
Typescript = {
extensions =
with pkgs . vscode-extensions ;
commonExtensions
++ [ yoavbls . pretty-ts-errors ] ;
} ;
} ;
2024-09-15 13:54:43 +02:00
} ;
} ;
}