windows中vscode配置文件

本文详细介绍了Visual Studio Code的配置和个性化设置,包括编辑器的字体大小、自动换行、终端字体和程序选择,以及代码格式化规则。此外,还涉及了Git集成、智能提示、文件排除、主题选择等多个方面,旨在提升开发效率和工作舒适度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

{
	//editor相关
	"editor.fontSize": 18,
    "editor.wordWrap": "on", // 自动换行
    "explorer.confirmDelete": false,
    "editor.detectIndentation": false,
    "editor.tabSize": 4,
    "editor.autoIndent": "advanced",
    "editor.formatOnPaste": true, // 粘贴时格式化
    "editor.formatOnSave": true, // 保存时格式化
    "editor.formatOnType": true, // 键入时格式化
	// terminal相关
    "terminal.integrated.fontFamily": "consolas", //指定终端的字体
    "terminal.integrated.fontSize": 16, //指定终端字大小
    "terminal.integrated.shell.windows": "C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\WindowsApps\\ubuntu.exe", //指定终端使用的程序
    // https://clang.llvm.org/docs/ClangFormatStyleOptions.html
    "C_Cpp.updateChannel": "Insiders",
    "C_Cpp.clang_format_style": "{ BasedOnStyle: Google, IndentWidth: 4, AccessModifierOffset: -4, AlignTrailingComments: true, ColumnLimit: 0 }", // 格式化代码,大括号
    "editor.autoClosingBrackets": "beforeWhitespace",
    // "terminal.integrated.shell.osx": "/bin/zsh",
    
    "git.enableSmartCommit": true,
    "explorer.confirmDragAndDrop": false,
    "editor.hover.delay": 100,
    "remote.SSH.showLoginTerminal": true,
    "git.ignoreLegacyWarning": true,
    "C_Cpp.clang_format_sortIncludes": false,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    },
    "go.alternateTools": {},
    "go.useLanguageServer": true,
    "breadcrumbs.enabled": true,
    "editor.renderWhitespace": "none",
    "editor.minimap.enabled": false,
    "workbench.editor.enablePreview": false,
    "plantuml.commandArgs": [],
    "plantuml.server": "http://www.plantuml.com/plantuml",
    "search.exclude": {
        "**/*.log": true
    },
    "files.exclude": {
        "**/*.log": true,
    },
    "workbench.colorTheme": "One Monokai",
    "workbench.iconTheme": "material-icon-theme",
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    //python相关
    "python.autoComplete.addBrackets": true,
    "python.autoComplete.extraPaths": [
        "C:/Program Files/Python38/Scripts",
        "C:/Program Files/Python38/Lib/site-packages",
    ],
    "python.analysis.extraPaths": [
        "C:/Program Files/Python38/Scripts",
        "C:/Program Files/Python38/Lib/site-packages"
    ],
    "python.analysis.completeFunctionParens": true,
    "python.formatting.provider": "none",
    "python.formatting.yapfPath": "none",
    "python.formatting.blackPath": "none",
    "python.formatting.autopep8Path": "none",
    "files.trimTrailingWhitespace": true,
    "prettier.semi": true,
    "go.toolsManagement.autoUpdate": true,
    "liveServer.settings.donotShowInfoMsg": true,
    "terminal.integrated.tabs.enabled": true,
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "vetur.format.defaultFormatterOptions": {
        "js-beautify-html": {
            "wrap_line_length": 120,
            "wrap_attributes": "auto",
            "end_with_newline": false
        },
        "prettier": {
            // 不加分号
            "semi": false,
            // 用单引号
            "singleQuote": true,
            // 禁止随时添加逗号
            "trailingComma": "none"
        }
    },
    // go代码自动补全括号
    "go.useCodeSnippetsOnFunctionSuggest": true,
    // 自动完成未导入的包
    "go.autocompleteUnimportedPackages": true,
    "go.docsTool": "gogetdoc",
    "go.formatTool": "goimports",
    // 文件自动保存
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 2000,
    "workbench.startupEditor": "none",
    "security.workspace.trust.untrustedFiles": "open",
    "explorer.autoReveal": false
}
### 配置 `.vscode` 文件夹 `.vscode` 文件夹用于存储项目特定的配置文件,这些文件对于项目的构建、调试和其他开发任务至关重要。为了在 Linux 中正确配置 VSCode 的 `.vscode` 文件夹,需关注几个主要方面。 #### 创建并编辑 `launch.json` 此文件定义了启动配置项,允许开发者自定义程序运行方式和参数。可以通过点击菜单中的 **运行->启动调试** 来创建或修改该文件,在这过程中会出现 `.vscode` 文件夹及其内部结构[^1]。例如: ```json { "version": "0.2.0", "configurations": [ { "name": "(gdb) Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/main", "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", "environment": [], "externalConsole": true, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "Build" } ] } ``` #### 编辑 `tasks.json` 这个 JSON 文件描述了一组可执行的任务列表,通常用来编译源代码或其他预处理工作流。它同样位于 `.vscode` 下面,并且可以根据具体需求定制化设置[^2]。下面是一个简单的 C++ 构建任务例子: ```json { "version": "2.0.0", "tasks": [ { "label": "Build", "type": "shell", "command": "/usr/bin/g++", "args": [ "-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": ["$gcc"], "detail": "Generated task." } ] } ``` #### 设置环境变量与路径映射 当涉及到跨平台开发时,比如使用 Windows 上的 VSCode 对接远程 Linux 机器上的 MySQL 数据库,则可能需要调整一些环境变量或是指定额外的包含路径来确保工具链能找到必要的头文件和库文件[^3]。可以在 `c_cpp_properties.json` 或者通过扩展插件实现这一点。 #### 清理不必要的缓存数据 有时过多的历史记录可能会占用大量磁盘空间影响性能,定期清理不再使用的缓存有助于保持良好的工作效率。VSCode 在 Linux 上的缓存位置一般是在用户的家目录下的隐藏文件夹中,即 `~/.config/Code/User/workspaceStorage`[^5]。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值