🆚

大学生、Visual Studio Codeのsettings.jsonを整える

に公開

文量が多くなったので『大学生、Windowsにおける快適な操作環境を思案』に書いていた内容を移しました。
Neovimやmicroなどの設定を行っていたら、このような記事を見つけました。
https://zenn.dev/yutotnh/articles/1577b6dc5ab7d9
https://zenn.dev/ap_com/articles/vscode-must-have-settings
ということでVisual Studio Code(以降、VSCodeと表記する)のsettings.jsonを編集していきたいと思います。
なお、この記事では設定の説明を行いません。こういうのもあるのかという感覚で読んでください。

初期の状態

普段はGUIで設定しています。そのため、settings.jsonの中身は汚いと思っていたら案の定でした。
今は必要ない設定もありそうですね。

setting.json
{
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "Developer Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [
                "/k",
                "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\VsDevCmd.bat"
            ],
            "overrideName": true
        },
        "Windows PowerShell": {
            "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        }
    },
    "workbench.colorCustomizations": {
        "titleBar.activeBackground": "#101010",
        "editorIndentGuide.background1": "#b22222",
        "editorIndentGuide.background2": "#ff4500",
        "editorIndentGuide.background3": "#ffd700",
        "editorIndentGuide.background4": "#228b22",
        "editorIndentGuide.background5": "#000080",
        "editorIndentGuide.background6": "#8b008b",
        "editorIndentGuide.activeBackground1": "#ffffff",
        "editorIndentGuide.activeBackground2": "#ffffff",
        "editorIndentGuide.activeBackground3": "#ffffff",
        "editorIndentGuide.activeBackground4": "#ffffff",
        "editorIndentGuide.activeBackground5": "#ffffff",
        "editorIndentGuide.activeBackground6": "#ffffff"
    },
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.startupEditor": "none",
    "remote.SSH.remotePlatform": {
        "fserv04.cs.priv.teu.ac.jp": "linux"
    },
    "hediet.vscode-drawio.resizeImages": null,
    "sequence.replaceSelection": true,
    "explorer.confirmDelete": false,
    "explorer.confirmDragAndDrop": false,
    "files.autoGuessEncoding": true,
    "files.defaultLanguage": "plaintext",
    "markdown.extension.toc.levels": "2..6",
    "markdownlint.config": {
        "MD004": false,
        "MD012": false,
        "MD022": false,
        "MD024": {
            "siblings_only": true
        },
        "MD025": false,
        "MD026": false,
        "MD029": false,
        "MD031": false,
        "MD032": false,
        "MD033": false,
        "MD034": false,
        "MD040": false,
        "MD047": false,
        "MD049": false,
        "MD050": false
    },
    "rust-analyzer.debug.engineSettings": {
    },
    "[python]": {
        "editor.formatOnType": true,
    },
    "python.venvFolders": [
        ".venv",
        ".pyenv",
        "envs",
        ".direnv"
    ],
    "launch": {
        "configurations": [],
        "compounds": []
    },
    "git.confirmSync": false,
    "git.enableSmartCommit": true,
    "editor.unicodeHighlight.nonBasicASCII": false,
    "editor.unicodeHighlight.ambiguousCharacters": false,
    "explorer.confirmPasteNative": false,
    "jupyter.askForKernelRestart": false,
    "cmake.configureOnOpen": true,
    "code-runner.runInTerminal": true,
    "terminal.integrated.stickyScroll.enabled": true,
    "python.venvPath": "C:\\Users\\ユーザー名\\Documents\\.venv",
    "settingsSync.ignoredSettings": [
        "-python.venvPath"
    ],
    "markdown-preview-enhanced.codeBlockTheme": "darcula.css",
    "markdown-preview-enhanced.previewTheme": "atom-dark.css",
    "markdown-preview-enhanced.revealjsTheme": "moon.css",
    "markdown-preview-enhanced.enablePreviewZenMode": false,
    "markdown.preview.breaks": true,
    "markdown-pdf.breaks": true,
    "[markdown]": {
        "editor.defaultFormatter": "yzhang.markdown-all-in-one"
    },
    "python.defaultInterpreterPath": "C:\\Users\\ユーザー名\\Documents\\.venv\\noob_3.11.5\\Scripts\\python.exe",
    "editor.fontFamily": "'UDEV Gothic JPDOC', 'Cascadia Mono', Consolas",
    "editor.codeLensFontFamily": "default",
    "workbench.editor.enablePreview": false,
    "githubPullRequests.createOnPublishBranch": "never",
    "window.confirmSaveUntitledWorkspace": false,
    "extensions.experimental.affinity": {
        "asvetliakov.vscode-neovim": 1
    },
    "better-comments.tags": [

        {
            "tag": "!",
            "color": "#FF2D00",
            "strikethrough": false,
            "underline": false,
            "backgroundColor": "transparent",
            "bold": false,
            "italic": false
        },
        {
            "tag": "?",
            "color": "#3498DB",
            "strikethrough": false,
            "underline": false,
            "backgroundColor": "transparent",
            "bold": false,
            "italic": false
        },
        {
            "tag": "//",
            "color": "#474747",
            "strikethrough": true,
            "underline": false,
            "backgroundColor": "transparent",
            "bold": false,
            "italic": false
        },
        {
            "tag": "$",
            "color": "#FF8C00",
            "strikethrough": false,
            "underline": false,
            "backgroundColor": "transparent",
            "bold": false,
            "italic": false
        },
        {
            "tag": "*",
            "color": "#98C379",
            "strikethrough": false,
            "underline": false,
            "backgroundColor": "transparent",
            "bold": false,
            "italic": false
        }
    ],
    "color-highlight.markerType": "dot-before",
    "color-highlight.markRuler": false,
    "d.servedPath": "C:\\Users\\ユーザー名\\AppData\\Roaming\\code-d\\bin\\serve-d.exe",
    "d.dmdPath": "C:\\Program Files\\D\\dmd2\\windows\\bin64",
    "diffEditor.hideUnchangedRegions.enabled": true,
    "terminal.integrated.enableMultiLinePasteWarning": false,
    "powermode.enabled": true,
    "projectManager.tags": [
        "個人",
        "大学",
        "仕事",
        "Python",
        "Rust"
    ],
    "notebook.editorOptionsCustomizations": {
        "editor.tabSize": 4,
        "editor.indentSize": 4,
        "editor.insertSpaces": true
    },
    "dev.containers.executeInWSL": true,
    "terminal.integrated.defaultProfile.windows": "Windows PowerShell",
    "debug.onTaskErrors": "debugAnyway",
    "cmake.configureSettings": {

    },
    "editor.guides.bracketPairs": "active",
    "editor.renderWhitespace": "boundary",
    "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?、。「」【】『』()!?てにをはがのともへでや",
    "liveServer.settings.donotShowInfoMsg": true,
    "hediet.vscode-drawio.codeLinkActivated": false,
    "vsnotes.defaultNotePath": "c:\\Users\\ユーザー名\\Documents\\My_Data\\notes\\vscode",
    "liveServer.settings.donotVerifyTags": true,
    "workbench.editorAssociations": {
        "*.zip": "default"
    },
    "explorer.fileNesting.patterns": {
        "*.ts": "${capture}.js",
        "*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts",
        "*.jsx": "${capture}.js",
        "*.tsx": "${capture}.ts",
        "tsconfig.json": "tsconfig.*.json",
        "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb",
        "Cargo.toml": "Cargo.lock",
        "*.sqlite": "${capture}.${extname}-*",
        "*.db": "${capture}.${extname}-*",
        "*.sqlite3": "${capture}.${extname}-*",
        "*.db3": "${capture}.${extname}-*",
        "*.sdb": "${capture}.${extname}-*",
        "*.s3db": "${capture}.${extname}-*"
    },
    "workbench.iconTheme": "material-icon-theme",
    "workbench.colorTheme": "Default Dark+",
    "git.openRepositoryInParentFolders": "never",
    "codeium.enableCodeLens": false,
    "editor.inlayHints.enabled": "offUnlessPressed",
    "C_Cpp.default.customConfigurationVariables": {},
    "editor.fontSize": 15,
}

綺麗にして分かりやすくしましょう。

参考にした記事

下の記事を参考にしてsetting.jsonを変えていきましょう。
https://zenn.dev/ap_com/articles/vscode-must-have-settings
https://qiita.com/WGG_SH/items/82f83ba91ca0d7f5c8b7
https://zenn.dev/yumemi_inc/articles/396265425c9740
https://zenn.dev/ro_komatsuna/articles/vscode_reveal

変更した状態

修正後のsetting.jsonがこちらになります。

setting.json
{
    //* Visual Studio Code きほんせってい *//

    // Visual Studio Code 設定
    "workbench.startupEditor": "welcomePageInEmptyWorkbench",
    "update.showReleaseNotes": false,
    "explorer.confirmDelete": false,
    "explorer.confirmPasteNative": false,
    "explorer.confirmDragAndDrop": false,
    "workbench.editor.closeOnFileDelete": true,
    "window.confirmSaveUntitledWorkspace": false,
    "telemetry.telemetryLevel": "error",

    // ターミナル 設定
    "terminal.integrated.defaultProfile.windows": "PowerShell",
    "terminal.integrated.suggest.enabled": true,
    "terminal.integrated.enableVisualBell": true,
    "terminal.integrated.stickyScroll.enabled": true,

    // Visual Studio Code 画面 設定
    "window.zoomLevel": -0.75,
    "chat.commandCenter.enabled": false,
    "workbench.navigationControl.enabled": false,
    "workbench.colorTheme": "Default Dark+",
    "workbench.iconTheme": "material-icon-theme",
    "workbench.colorCustomizations": {
        /* エディタ */
        "editor.background": "#1e1e20",
        /* インデントハイライト */
        "editorIndentGuide.background1":"#FF0000",
        "editorIndentGuide.background2":"#FFA500",
        "editorIndentGuide.background3":"#FFFF00",
        "editorIndentGuide.background4":"#008000",
        "editorIndentGuide.background5":"#0000FF",
        "editorIndentGuide.background6":"#800080",
        "editorIndentGuide.activeBackground1":"#ffffff",
        "editorIndentGuide.activeBackground2":"#ffffff",
        "editorIndentGuide.activeBackground3":"#ffffff",
        "editorIndentGuide.activeBackground4":"#ffffff",
        "editorIndentGuide.activeBackground5":"#ffffff",
        "editorIndentGuide.activeBackground6":"#ffffff",
        "editorBracketPairGuide.activeBackground1":"#FFFFFF",
        "editorBracketPairGuide.activeBackground2":"#FFFFFF",
        "editorBracketPairGuide.activeBackground3":"#FFFFFF",
        "editorBracketPairGuide.activeBackground4":"#FFFFFF",
        "editorBracketPairGuide.activeBackground5":"#FFFFFF",
        "editorBracketPairGuide.activeBackground6":"#FFFFFF",
    },
        // 禅モード 設定
        "zenMode.restore": false,

    // フォント 設定
    "editor.fontFamily":"'UDEV Gothic JPDOC', 'Cascadia Mono', Consolas, 'Courier New', monospace",
    "editor.fontSize":16,
    "debug.console.fontSize":16,
    "terminal.integrated.fontSize":16,
    "editor.letterSpacing": -0.1,

    // ディレクトリツリー 設定
    "explorer.autoReveal": false,
    "explorer.autoOpenDroppedFile": false,
    "explorer.fileNesting.enabled": true,
    "explorer.fileNesting.expand": false,
    "explorer.fileNesting.patterns": {},
    "workbench.view.alwaysShowHeaderActions": true,
    "workbench.tree.renderIndentGuides": "always",
    "workbench.tree.indent":12,

    // エディタ 設定
    "editor.insertSpaces": true,
    "editor.tabSize": 4,
    "editor.cursorSmoothCaretAnimation":"off",
    "editor.guides.bracketPairs": "active",
    "editor.renderLineHighlight": "all",
    "editor.minimap.maxColumn": 60,
    "files.trimTrailingWhitespace": true,
    "editor.minimap.showSlider": "always",
    "editor.showFoldingControls": "always",
    "editor.inlayHints.enabled": "offUnlessPressed",
    "editor.wrappingIndent": "indent",
    "editor.renderWhitespace": "boundary",
    "editor.acceptSuggestionOnEnter": "off",
    "editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?、。!?「」【】『』()とはのやをが",
        // 検索結果 設定
        "search.showLineNumbers": true,

    //* 言語設定 *//

    // C 設定
    "[c]": {
        "editor.insertSpaces": false,
        "editor.tabSize": 4,
    },

    // Python 設定
    "python.venvPath": "C:\\Users\\ユーザ名\\Documents\\.venv",
    "[python]": {
        "editor.tabSize": 4,
        "editor.formatOnType": true
    },

    // Rust 設定
    "[rust]": {
        "editor.tabSize": 4,
    },
    "rust-analyzer.check.command": "clippy",
    "rust-analyzer.check.extraArgs": [
        "--",
        "-A",
        "clippy::needless_return",
        "needless_return_with_question_mark",
    ],

    // Markdown 設定
    "markdown.preview.breaks": true,

    //* 拡張機能設定 *//

    // Codeium 設定
    "codeium.enableCodeLens": "hide_x",

    // input-sequence 設定
    "sequence.replaceSelection": true,

    // Git 設定
    "git.confirmSync":false,
    "diffEditor.hideUnchangedRegions.enabled": true,

    // markdown 設定
    "markdown.extension.toc.levels": "2..6",
    "markdownlint.config": {
        "MD004":false,
        "MD012":false,
        "MD022":false,
        "MD024":{
            "siblings_only": true
        },
        "MD025":false,
        "MD026":false,
        "MD029":false,
        "MD031":false,
        "MD032":false,
        "MD033":false,
        "MD034":false,
        "MD040":false,
        "MD047":false,
        "MD049":false,
        "MD050":false,
    },

    // markdown-preview-enhanced 設定
    "markdown-preview-enhanced.revealjsTheme": "black.css",
    "markdown-preview-enhanced.previewTheme": "github-dark.css",
    "markdown-preview-enhanced.codeBlockTheme": "github-dark.css",

    // markdown-pdf 設定
    "markdown-pdf.breaks": true,

    // Godot 設定
    "godotTools.editorPath.godot4": "C:\\Users\\ユーザ名\\Documents\\Software\\Godot_v4.4.1-stable_mono_win64\\Godot_v4.4.1-stable_mono_win64.exe",
    "godotTools.lsp.headless": true,
    "godotTools.lsp.serverPort": 6005,

}

見やすくなって分かりやすくなりましたね。

終わり

特に書くこともありませんが、普段から使っているものは綺麗にするというのは大事かもしれません。以上。

Discussion