1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 16:10:45 +01:00

fix(vscode): use standard settings and manage extensions

This commit is contained in:
Ryan Cao 2023-09-04 20:33:03 +08:00
parent 810d7fcc2f
commit ea20be5b58
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E

View file

@ -1,117 +1,145 @@
{pkgs, ...}: { {
pkgs,
lib,
...
}: let
extensions = [
"antfu.iconify"
"antfu.unocss"
"astro-build.astro-vscode"
"bierner.lit-html"
"bmalehorn.vscode-fish"
"bradlc.vscode-tailwindcss"
"Catppuccin.catppuccin-vsc"
"Catppuccin.catppuccin-vsc-icons"
"csstools.postcss"
"denoland.vscode-deno"
"dbaeumer.vscode-eslint"
"dprint.dprint"
"DotJoshJohnson.xml"
"EditorConfig.EditorConfig"
"eamodio.gitlens"
"github.vscode-github-actions"
"esbenp.prettier-vscode"
"GraphQL.vscode-graphql"
"GraphQL.vscode-graphql-syntax"
"golang.go"
"griimick.vhs"
"LeonardSSH.vscord"
"jnoortheen.nix-ide"
"ms-python.isort"
"ms-python.black-formatter"
"ms-python.vscode-pylance"
"ms-python.python"
"mvllow.rose-pine"
"ms-vscode.cpptools"
"Prisma.prisma"
"nvarner.typst-lsp"
"ronnidc.nunjucks"
"rust-lang.rust-analyzer"
"tamasfe.even-better-toml"
"sastan.twind-intellisense"
"skellock.just"
"svelte.svelte-vscode"
"timonwong.shellcheck"
"unifiedjs.vscode-mdx"
"Vue.volar"
"yoavbls.pretty-ts-errors"
];
in {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
extensions = []; extensions = [];
mutableExtensionsDir = true;
userSettings = { userSettings = {
workbench.colorTheme = "Catppuccin Frappé"; "workbench.colorTheme" = "Catppuccin Frappé";
workbench.iconTheme = "catppuccin-frappe"; "workbench.iconTheme" = "catppuccin-frappe";
catppuccin.boldKeywords = false; "catppuccin.boldKeywords" = false;
catppuccin.italicKeywords = true; "catppuccin.italicKeywords" = true;
catppuccin.accentColor = "sky"; "catppuccin.accentColor" = "sky";
catppuccin.workbenchMode = "default"; "catppuccin.workbenchMode" = "default";
catppuccin.customUIColors = { "catppuccin.customUIColors" = {
all = { all = {
activityBar.activeBorder = "accent"; "activityBar.activeBorder" = "accent";
}; };
}; };
git.autofetch = true; "git.autofetch" = true;
git.confirmSync = false; "git.confirmSync" = false;
diffEditor.renderSideBySide = false; "diffEditor.renderSideBySide" = false;
git.inputValidation = "off"; "git.inputValidation" = "off";
gitlens.showWelcomeOnInstall = false; "gitlens.showWelcomeOnInstall" = false;
git.suggestSmartCommit = false; "git.suggestSmartCommit" = false;
diffEditor.ignoreTrimWhitespace = false; "diffEditor.ignoreTrimWhitespace" = false;
editor.fontFamily = "\"CaskaydiaCove Nerd Font\", monospace"; "editor.fontFamily" = "\"CaskaydiaCove Nerd Font\", monospace";
editor.formatOnSave = true; "editor.formatOnSave" = true;
editor.fontLigatures = "'calt', 'ss01'"; "editor.fontLigatures" = "'calt', 'ss01'";
editor.insertSpaces = true; "editor.insertSpaces" = true;
editor.tabSize = 2; "editor.tabSize" = 2;
editor.cursorSmoothCaretAnimation = "on"; "editor.cursorSmoothCaretAnimation" = "on";
editor.fontSize = 16; "editor.fontSize" = 16;
editor.lineHeight = 1.5; "editor.lineHeight" = 1.5;
editor.minimap.renderCharacters = false; "editor.minimap.renderCharacters" = false;
editor.cursorBlinking = "phase"; "editor.cursorBlinking" = "phase";
editor.inlineSuggest.enabled = true; "editor.inlineSuggest.enabled" = true;
workbench.editor.highlightModifiedTabs = true; "workbench.editor.highlightModifiedTabs" = true;
workbench.editor.untitled.hint = "hidden"; "workbench.editor.untitled.hint" = "hidden";
terminal.integrated.fontFamily = "\"CaskaydiaCove Nerd Font Mono\", monospace"; "terminal.integrated.fontFamily" = "\"CaskaydiaCove Nerd Font Mono\", monospace";
terminal.integrated.fontSize = 14; "terminal.integrated.fontSize" = 14;
terminal.integrated.lineHeight = 1.5; "terminal.integrated.lineHeight" = 1.5;
terminal.integrated.cursorBlinking = true; "terminal.integrated.cursorBlinking" = true;
terminal.integrated.defaultProfile.osx = "fish"; "terminal.integrated.defaultProfile.osx" = "fish";
terminal.integrated.inheritEnv = false; "terminal.integrated.inheritEnv" = false;
terminal.integrated.shellIntegration.enabled = false; "terminal.integrated.shellIntegration.enabled" = false;
shellcheck.ignorePatterns = {".envrc" = true;}; "shellcheck.ignorePatterns" = {
editor.defaultFormatter = "esbenp.prettier-vscode"; ".envrc" = true;
tailwindCSS.includeLanguages = { };
"editor.defaultFormatter" = "esbenp.prettier-vscode";
"tailwindCSS.includeLanguages" = {
typescript = "javascript"; typescript = "javascript";
typescriptreact = "javascript"; typescriptreact = "javascript";
vue-html = "html"; vue-html = "html";
}; };
typescript.enablePromptUseWorkspaceTsdk = true; "typescript.enablePromptUseWorkspaceTsdk" = true;
telemetry.telemetryLevel = "off"; "telemetry.telemetryLevel" = "off";
workbench.enableExperiments = false; "workbench.enableExperiments" = false;
workbench.settings.enableNaturalLanguageSearch = false; "workbench.settings.enableNaturalLanguageSearch" = false;
extensions.ignoreRecommendations = true; "extensions.ignoreRecommendations" = true;
editor.accessibilitySupport = "off"; "editor.accessibilitySupport" = "off";
vscord.status.details.text.editing = "In {{workspace}"; "vscord.status.details.text.editing" = "In {workspace}";
vscord.status.details.text.viewing = "In {workspace}"; "vscord.status.details.text.viewing" = "In {workspace}";
vscord.status.problems.enabled = false; "vscord.status.problems.enabled" = false;
vscord.status.state.text.editing = "Working on {file_name}{file_extension}"; "vscord.status.state.text.editing" = "Working on {file_name}{file_extension}";
vscord.status.buttons.button1.enabled = false; "vscord.status.buttons.button1.enabled" = false;
gitlens.defaultTimeFormat = "HH=mm"; "gitlens.defaultTimeFormat" = "HH=mm";
gitlens.defaultDateShortFormat = "YYYY/MM/DD"; "gitlens.defaultDateShortFormat" = "YYYY/MM/DD";
gitlens.defaultDateFormat = null; "gitlens.defaultDateFormat" = null;
"[python]" = { "[python]"."editor.tabSize" = 4;
editor.tabSize = 4; "[python]"."editor.defaultFormatter" = "ms-python.black-formatter";
editor.defaultFormatter = "ms-python.black-formatter"; "[cpp]"."editor.defaultFormatter" = "ms-vscode.cpptools";
}; "[toml]"."editor.defaultFormatter" = "tamasfe.even-better-toml";
"[cpp]" = { "[rust]"."editor.defaultFormatter" = "rust-lang.rust-analyzer";
editor.defaultFormatter = "ms-vscode.cpptools"; "[nix]"."editor.defaultFormatter" = "jnoortheen.nix-ide";
}; "[svelte]"."editor.defaultFormatter" = "svelte.svelte-vscode";
"[toml]" = { "[go][go.mod][go.sum]"."editor.defaultFormatter" = "golang.go";
editor.defaultFormatter = "tamasfe.even-better-toml"; "[xml]"."editor.defaultFormatter" = "DotJoshJohnson.xml";
}; "[fish]"."editor.defaultFormatter" = "bmalehorn.vscode-fish";
"[rust]" = { "[just]"."editor.defaultFormatter" = "skellock.just";
editor.defaultFormatter = "rust-lang.rust-analyzer"; "[mdx]"."editor.wordWrap" = "on";
}; "[astro]"."editor.defaultFormatter" = "astro-build.astro-vscode";
"[nix]" = {
editor.defaultFormatter = "jnoortheen.nix-ide";
};
"[svelte]" = {
editor.defaultFormatter = "svelte.svelte-vscode";
};
"[go][go.mod][go.sum]" = {
editor.defaultFormatter = "golang.go";
};
"[xml]" = {
editor.defaultFormatter = "DotJoshJohnson.xml";
};
"[fish]" = {
editor.defaultFormatter = "bmalehorn.vscode-fish";
};
"[just]" = {
editor.defaultFormatter = "skellock.just";
};
"[mdx]" = {
editor.wordWrap = "on";
};
"[astro]" = {
editor.defaultFormatter = "astro-build.astro-vscode";
};
rust-analyzer.server.path = "${pkgs.rust-analyzer}/bin/rust-analyzer"; "rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
files.associations = { "files.associations" = {
"*.mcmeta" = "json"; "*.mcmeta" = "json";
"*.plist" = "xml"; "*.plist" = "xml";
".dockerignore" = "ignore"; ".dockerignore" = "ignore";
@ -122,18 +150,18 @@
"flake.lock" = "json"; "flake.lock" = "json";
}; };
deno.inlayHints.enumMemberValues.enabled = false; "deno.inlayHints.enumMemberValues.enabled" = false;
deno.inlayHints.functionLikeReturnTypes.enabled = false; "deno.inlayHints.functionLikeReturnTypes.enabled" = false;
deno.inlayHints.parameterNames.enabled = "none"; "deno.inlayHints.parameterNames.enabled" = "none";
deno.inlayHints.parameterTypes.enabled = false; "deno.inlayHints.parameterTypes.enabled" = false;
deno.inlayHints.propertyDeclarationTypes.enabled = false; "deno.inlayHints.propertyDeclarationTypes.enabled" = false;
deno.inlayHints.variableTypes.enabled = false; "deno.inlayHints.variableTypes.enabled" = false;
svelte.enable-ts-plugin = true; "svelte.enable-ts-plugin" = true;
nix.enableLanguageServer = true; "nix.enableLanguageServer" = true;
nix.serverPath = "${pkgs.nil}/bin/nil"; "nix.serverPath" = "${pkgs.nil}/bin/nil";
nix.serverSettings = { "nix.serverSettings" = {
nil = { nil = {
formatting = { formatting = {
command = ["${pkgs.alejandra}/bin/alejandra"]; command = ["${pkgs.alejandra}/bin/alejandra"];
@ -142,4 +170,33 @@
}; };
}; };
}; };
home.activation = {
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
declare -A currentExtensions
for extension in $(${pkgs.vscode}/bin/code --list-extensions); do
currentExtensions["$extension"]=1;
done
${builtins.concatStringsSep
"\n"
(
builtins.map
(ext: ''
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
echo "installing ${ext}"
${pkgs.vscode}/bin/code --install-extension ${ext} &> /dev/null
fi
unset 'currentExtensions[${ext}]'
'')
extensions
)}
for ext in "''${!currentExtensions[@]}"; do
echo "uninstalling $ext"
${pkgs.vscode}/bin/code --uninstall-extension $ext &> /dev/null
currentExtensions[$ext]=
done
'';
};
} }