nixos-config-priv/home/zhuangzi/common/optional/dev/vscodium.nix

436 lines
14 KiB
Nix
Raw Normal View History

2024-06-07 11:37:13 +00:00
/*
VS Codium
*/
{ pkgs, inputs, system, config, ... }:
{
programs.vscodium = {
enable = true;
package = pkgs.unstable.vscodium;
enableExtensionUpdateCheck = true;
enableUpdateCheck = true;
extensions = let
t = inputs.nix-vscode-extensions.extensions.${system}.forVSCodeVersion
config.programs.vscode.package.version;
p = t.vscode-marketplace;
in [
# general
p.bierner.emojisense
p.bierner.markdown-checkbox
p.bierner.markdown-emoji
p.davidlday.languagetool-linter
p.dracula-theme.theme-dracula
p.eamodio.gitlens
p.gruntfuggly.todo-tree
p.mkhl.direnv
p.robole.marky-stats
p.stkb.rewrap
p.tomoki1207.pdf
p.tyriar.sort-lines
# haskell
p.haskell.haskell # language server
p.justusadam.language-haskell # syntax highlighting
p.s0kil.vscode-hsx # HSX is HTML templating for IHP
# other languages
p.banacorn.agda-mode
p.denoland.vscode-deno
p.jnoortheen.nix-ide
p.kokakiwi.vscode-just
p.mark-hansen.hledger-vscode
p.samuelcolvin.jinjahtml
p.scala-lang.scala
p.scalameta.metals
p.tamasfe.even-better-toml
# C#
# the nixpkgs version of this has a patch for a problem where uname isn't found
pkgs.unstable.vscode-extensions.ms-dotnettools.csharp
p.ms-dotnettools.vscode-dotnet-runtime
p.csharpier.csharpier-vscode
];
{
"extensionsGallery": {
"serviceUrl": "https://open-vsx.org/vscode/gallery",
"itemUrl": "https://open-vsx.org/vscode/item"
"cacheUrl": "",
"controlUrl": ""
}
}
keybindings = [
{
key = "ctrl+shift+t";
command = "workbench.action.terminal.focus";
when = "!terminalFocus";
}
{
key = "ctrl+shift+t";
command = "workbench.action.focusActiveEditorGroup";
when = "terminalFocus";
}
# use ctrl+c in the terminal for copying if there's a selection
# (passed through to the shell otherwise)
# thanks to https://stackoverflow.com/a/69928270/7659481
{
key = "ctrl+c";
command = "workbench.action.terminal.copySelection";
when = "terminalFocus && terminalProcessSupported && terminalTextSelected";
}
# use ctrl+v in the terminal for pasting
{
key = "ctrl+v";
command = "workbench.action.terminal.paste";
when = "terminalFocus && terminalProcessSupported";
}
# workaround to use Neo2 backslash for Agda Unicode input
# neither `[Backslash]` nor `capslock+u` work
# taken from the record keys function from the shortcut editor
{
key = "[Backslash]";
command = "-agda-mode.input-symbol[Activate]";
}
{
key = "["; # this is what Neo2 ß registers as
command = "agda-mode.input-symbol[Activate]";
when = "editorTextFocus && !editorHasSelection && editorLangId == 'agda'";
}
{
key = "ctrl+x ctrl+=";
command = "-agda-mode.lookup-symbol";
}
{
key = "ctrl+c ctrl+s";
command = "agda-mode.lookup-symbol";
when = "editorTextFocus && !editorHasSelection && editorLangId == 'agda'";
}
];
userSettings = {
# ======== General ========
"workbench.commandPalette.experimental.suggestCommands" = true;
"security.workspace.trust.enabled" = false;
"update.showReleaseNotes" = false;
"extensions.autoUpdate" = false;
# Themes
"workbench.colorTheme": "Kimbie Dark"
"workbench.iconTheme" = "material-icon-theme";
"workbench.productIconTheme" = "material-product-icons";
"workbench.cloudChanges.continueOn" = "off";
"workbench.cloudChanges.autoResume" = "off";
"workbench.startupEditor" = "none";
"update.mode" = "start";
"window.menuBarVisibility": "compact",
# ======== Telemetry ========
"continue.telemetryEnabled" = false;
"allowAnonymousTelemetry" = false;
"telemetry.telemetryLevel" = "off";
"aws.telemetry" = false;
"redhat.telemetry.enabled" = false;
"aws.codeWhisperer.shareCodeWhispererContentWithAWS" = false;
"code-runner.enableAppInsights" = false;
"workbench.enableExperiments" = false;
"typescript.tsserver.experimental.enableProjectDiagnostics" = false;
"keyboard.dispatch" = "keyCode";
# ======== Terminal ========
"terminal.integrated.splitCwd" = "workspaceRoot";
"terminal.integrated.confirmOnKill" = "always";
"terminal.integrated.copyOnSelection" = true;
"terminal.integrated.tabs.hideCondition" = "never";
"terminal.integrated.scrollback" = 5000;
"terminal.integrated.cursorStyle" = "line";
"terminal.integrated.cursorBlinking" = "solid";
"terminal.integrated.cursorWidth" = 1;
"terminal.integrated.fontFamily" = "Geist";
"terminal.integrated.fontSize" = 14;
"terminal.integrated.lineHeight" = 1.2;
"terminal.integrated.rightClickBehavior" = "default";
"terminal.integrated.minimumContrastRatio" = 1;
# ===== Linux =====
/*
vscode fixes colors in the termial to meet certain contrast ratios
I just want the original colors
*/
# "terminal.integrated.shell.linux" = "${pkgs.fish}/bin/fish";
# "terminal.integrated.shellArgs.linux" = [
# "--login"
# "-c"
# "set -x EDITOR vim"
# ];
"terminal.integrated.defaultProfile.linux" = "zsh";
"terminal.integrated.profiles.linux" = {
"zsh" = {
"path" = "${pkgs.zsh}/bin/zsh";
};
};
"terminal.external.linuxExec" = "#!/bin/bash";
# ===== Win =====
"terminal.integrated.defaultProfile.windows" = "Git Bash";
"terminal.integrated.profiles.windows" = {
"Custom Init" = {
"path" = "pwsh.exe";
"args" = [
"-noexit";
"-file";
"${env:APPDATA}\\PowerShell\\custom-init.ps1"
]
}
};
"terminal.integrated.env.windows" = {
"CHERE_INVOKING" = "1"
};
# "terminal.integrated.defaultProfile.windows" = "PowerShell";
# "terminal.integrated.shell.windows" = "${pkgs.pwsh}/bin/pwsh.exe";
# "terminal.integrated.shellArgs.windows" = [
# "-NoLogo"
# "-NoProfile"
# "-Command"
# "set-location ${pkgs.pwsh}"
# "-Command"
# "set-location ${pkgs.pwsh}"
# "-Command"
# "set EDITOR vim"
# ];
# ===== Explorer =====
"explorer.confirmDelete" = false;
"explorer.confirmDragAndDrop" = false;
# ===== Files =====
"files.defaultLanguage" = "javascript";
"files.enableTrash" = true;
"files.insertFinalNewline" = true;
"files.trimTrailingWhitespace" = false;
# ===== Git =====
"git.autofetch" = "all"; # regularly fetch from all remotes of the repo
"git.autofetchPeriod" = 120;
"git.closeDiffOnOperation" = true; # close diff editors on commits etc.
"git.confirmForcePush" = false;
"git.confirmSync" = false;
"git.allowForcePush" = true;
"git.path" = "";
"git.enableSmartCommit" = false; # commit all if nothing staged
# ===== Editor =====
"editor.inlineSuggest.enabled" = true;
"editor.links" = true;
"editor.codeLens" = true;
"editor.autoIndent" = "advanced";
"editor.detectIndentation" = true;
"editor.hover.enabled" = true;
# allow various mathematical symbols for use in stuff like TeX and Agda
"editor.unicodeHighlight.allowedCharacters" = builtins.listToAttrs (map (x: { name = x; value = true; }) [
"" "" "" "" "α" "γ" "ρ" "σ" "ι" "" "" ""
]);
"editor.hover.delay" = 150;
"editor.suggest.preview" = true;
"editor.suggestFontSize" = 12;
"editor.fontFamily" = "Geist";
"editor.fontSize" = 15;
"editor.fontLigatures" = true;
"editor.rulers" = [ 100 ];
"editor.wordWrapColumn" = 100; # column to wrap at; ignored by default due to wordWrap, relevant e.g. for markdown
"editor.wordWrap" = "on"; # by default, wrap at the viewport
"rewrap.wrappingColumn" = 100; # rewrap text with rewrap extension at column 100
"editor.renderWhitespace" = "boundary";
"editor.guides.bracketPairs" = true;
"editor.language.brackets" = [
[ "[" "]" ]
[ "{" "}" ]
[ "(" ")" ]
[ "" "" ]
];
# by default, I use tabs for indentation for accessibility reasons
"editor.insertSpaces" = false;
"editor.tabSize" = 4;
"editor.detectIndentation" = true;
"editor.scrollbar.vertical" = "visible";
"editor.minimap.showSlider" = "always";
"editor.minimap.size" = "fill";
"editor.minimap.maxColumn" = 100;
# DiffEditor
"diffEditor.experimental.showMoves" = true;
"diffEditor.ignoreTrimWhitespace" = false;
"diffEditor.diffAlgorithm" = "advanced";
# Files
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true;
"files.insertFinalNewline" = true;
"files.watcherExclude" = {
"**/.bloop" = true;
"**/.metals" = true;
"**/.ammonite" = true;
};
# === JS/TS ===
"[javascript]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"
};
"[typescript]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"
};
"javascript.format.enable" = true;
"javascript.format.semicolons" = "insert";
"debug.javascript.codelens.npmScripts" = "all";
"javascript.suggestionActions.enabled" = true;
# "debug.javascript.autoAttachSmartPattern" = [
# "${workspaceFolder}/**";
# "!**/node_modules/**";
# "**/$KNOWN_TOOLS$/**"
# ];
"typescript.updateImportsOnFileMove.enabled" = "always";
"typescript.implementationsCodeLens.enabled" = true;
"typescript.tsserver.log" = "off";
"typescript.tsserver.enableTracing" = false;
"typescript.format.placeOpenBraceOnNewLineForFunctions" = true;
"typescript.implementationsCodeLens.showOnInterfaceMethods" = true;
"typescript.tsserver.useSyntaxServer" = "always";
"typescript.tsserver.maxTsServerMemory" = 2048;
"typescript.tsserver.web.projectWideIntellisense.enabled" = true;
"typescript.format.enable" = true;
"javascript.referencesCodeLens.enabled" = false;
"javascript.referencesCodeLens.showOnAllFunctions" = true;
"javascript.inlayHints.parameterNames.enabled" = "all";
"javascript.inlayHints.parameterTypes.enabled" = true;
"javascript.updateImportsOnFileMove.enabled" = "always";
"npm.fetchOnlinePackageInfo" = true;
# Svelte + Web dev
"svelte.plugin.typescript.hover.enable" = true;
"svelte.plugin.typescript.enable" = true;
"svelte.enable-ts-plugin" = true;
"css.hover.documentation" = true;
"html.hover.documentation" = true;
# === Rust ===
"rust.show_hover_context" = true;
# === Golang ===
"go.useLanguageServer" = true;
"go.lintTool" = "golangci-lint";
# === Py ===
"[python]" = {
"editor.formatOnType" = true
};
"python.missingPackage.severity" = "Warning";
"python.languageServer" = "Jedi";
"python.experiments.enabled" = false;
"python.experiments.optOutFrom" = [
"All"
];
# Haskell
"haskell.manageHLS"= "PATH";
# TODO Tree
#"todo-tree.general.showActivityBarBadge" = true;
#"todo-tree.general.tags" = [ "TODO" "FIXME" ];
# Marky Markdown
"markyMarkdown.statsShowReadingTime" = false;
"markyMarkdown.statsShowWords" = true;
"markyMarkdown.statsShowCharacters" = true;
"markyMarkdown.statsItemSeparator" = " / ";
"languageToolLinter.lintOnOpen" = true;
# https://github.com/davidlday/vscode-languagetool-linter/issues/603
# "languageToolLinter.languageTool.ignoredWordHint" = false;
"languageToolLinter.languageTool.preferredVariants" = "en-US,de-DE,nl-NL";
"languageToolLinter.languageTool.ignoredWordsGlobal" = [
"iirc" "eisfunke" "eisfunkelab" "kb" "nebelhorn" "agda" "dir"
];
# === IaC, Devops ===
"terraform.experimentalFeatures.prefillRequiredFields" = true;
"terraform.experimentalFeatures.validateOnSave" = true;
"[ansible]" = {
"editor.detectIndentation" = true;
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
"editor.quickSuggestions" = {
"comments" = true;
"other" = true;
"strings" = true
};
"editor.autoIndent" = "advanced"
};
"ansible.lightspeed.enabled" = false;
"yaml.hover" = true;
"yaml.completion" = true;
# === Nix ===
"nix.enableLanguageServer" = true; // Enable LSP.
"nix.serverPath" = "nil"; // The path to the LSP server executable.
# === advanced
"nix.serverSettings" = {
"nil" = {
"formatting" = { "command" = ["nixpkgs-fmt"] }
}
};
#"agdaMode.inputMethod.activationKey" = "ß";
# language specific indentation settings
"[html]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"
};
"[jsonc]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"
};
"[json]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode"
};
"[latex]" = {
"editor.defaultFormatter" = "esbenp.prettier-vscode";
"editor.formatOnPaste" = false;
"editor.suggestSelection" = "recentlyUsedByPrefix"
};
"[svelte]" = {
"editor.acceptSuggestionOnCommitCharacter" = true;
"editor.acceptSuggestionOnEnter" = "off"
};
"[scala]" = { # follow Scala style guide
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
};
"[markdown]" = { # indent markdown with spaces so YAML frontmatter doesn't break
"editor.wordWrap" = "bounded"; # wrap markdown files at line width
"editor.insertSpaces" = true;
"editor.tabSize" = 2;
};
"[haskell]"."editor.insertSpaces" = true; # GHC warns when using tabs
"[python]"."editor.insertSpaces" = true; # black forces spaces
"[agda]"."editor.insertSpaces" = true; # agda forces spaces
};
};
}