Java 工作区配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
// Maven 执行选项设置
"maven.executable.options": "D:\\java\\apache-maven-3.8.4\\bin\\mvn", // Maven 可执行文件选项
"java.configuration.maven.userSettings": "D:\\java\\apache-maven-3.8.4\\conf\\settings.xml", // Maven 用户设置
"java.completion.chain.enabled": true, //启用链式代码补全功能
"java.completion.matchCase": "off", //代码补全时是否区分大小写
"java.signatureHelp.description.enabled": true, //启用方法签名帮助的描述功能
"java.dependency.showMembers": true, //在Java依赖视图中显示类的成员
"java.debug.logLevel": "error", //控制Java调试器的日志级别
"java.errors.incompleteClasspath.severity": "ignore", // 设置代码检查
"editor.unicodeHighlight.ambiguousCharacters": false, // 去除中文字符警告标识
"[java]": {
"editor.defaultFormatter": "redhat.java",
"editor.suggest.snippetsPreventQuickSuggestions": false // 设置代码提示
},
"java.import.gradle.enabled": false, // 是否启用对Gradle项目的导入和处理
"java.import.gradle.wrapper.enabled": false, // 是否启用Gradle Wrapper的支持
"java.semanticHighlighting.enabled": true, // Java 语法高亮
"java.jdk.ls.java.home": "D:\\java\\jdk-17", // Java 主目录
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "D:\\java\\jdk-8",
"default": true,
}
],
"java.home": "D:\\java\\jdk-17", // Java 主目录

// 文件排除设置
"files.exclude": { // 排除的文件
"**/.classpath": true, // 排除所有.classpath 文件
"**/.project": true, // 排除所有.project 文件
"**/.settings": true, // 排除所有.settings 文件
"**/.factorypath": true // 排除所有.factorypath 文件
},
}

Golang 工作区配置文件

1
2
3
4
5
6
7
8
9
10
11
{
// Go 语言设置
"[go]": {
"editor.insertSpaces": false, // 不插入空格
"editor.formatOnSave": false, // 保存时不格式化
"editor.codeActionsOnSave": { // 保存时的代码操作
"source.organizeImports": "explicit" // 明确组织导入
},
"editor.suggest.snippetsPreventQuickSuggestions": false // 不阻止快速建议的代码片段
},
}

Python 工作区配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", // Python 默认解释器路径
"python.analysis.extraPaths": [
"${workspaceFolder}/.venv/lib/python3.10/site-packages"
], // 额外添加的模块搜索路径
// "python.defaultInterpreterPath": "/opt/homebrew/bin/python3.12", // Python 默认解释器路径
"python.analysis.logLevel": "Error", // 仅显示错误日志,减少干扰
"python.analysis.autoSearchPaths": true, // 启用后编辑器能识别自定义模块
"python.analysis.completeFunctionParens": true, // 补全函数时自动添加括号
"python.analysis.autoImportCompletions": true, // 补全未导入的符号时自动添加导入语句
"python.analysis.typeCheckingMode": "off", // 类型检查模式:off(关闭)/basic(基础)/strict(严格)
"python.analysis.useLibraryCodeForTypes": true, // 使用第三方库的代码推断类型
"python.analysis.indexing": false, // 是否启用代码索引(影响跳转定义和补全速度)
"python.analysis.importFormat": "absolute", // 导入语句的格式:absolute(绝对路径)/relative(相对路径)
"python.analysis.inlayHints.variableTypes": true, // 在变量旁显示类型提示(需类型注解支持)
"python.analysis.inlayHints.functionReturnTypes": true, // 在函数返回值处显示类型提示
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}", // 将工作目录加入 PYTHONPATH(解决运行时模块导入问题)
"PYTHONDONTWRITEBYTECODE": "1", // 禁止生成 .pyc 字节码文件(减少干扰文件)
},
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}", // 将工作目录加入 PYTHONPATH(解决运行时模块导入问题)
"PYTHONDONTWRITEBYTECODE": "1", // 禁止生成 .pyc 字节码文件(减少干扰文件)
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}", // 将工作目录加入 PYTHONPATH(解决运行时模块导入问题)
"PYTHONDONTWRITEBYTECODE": "1", // 禁止生成 .pyc 字节码文件(减少干扰文件)
},
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8", // 默认格式化工具为 Black(需安装 black 插件)
"editor.formatOnType": true, // 输入时自动格式化
}
}

PHP 工作区配置文件

1
2
3
{
"php.validate.executablePath": "D:\\php\\php.exe", // PHP 验证可执行文件路径
}

前端工作区配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
// 编辑器配置
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": false,

// 保存时自动格式化
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},

// 默认格式化工具
"editor.defaultFormatter": "esbenp.prettier-vscode",

// TypeScript 特定配置
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},

// ESLint 配置
"eslint.validate": ["javascript", "typescript"],
"eslint.run": "onType",

// Prettier 配置
"prettier.requireConfig": true,

// 文件保存时的操作
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,

// 添加自动导入配置
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",

// 添加 TypeScript 版本配置
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,

// 排除不需要监视的文件
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/node_modules/**": true,
"**/dist/**": true
}
"[vue]": {
"editor.defaultFormatter": "Vue.volar" // Vue 插件默认格式化器为 Vue.volar
},
}