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
37
38
39
40
41
42
43
44
45
46
{
// 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.debug.logLevel": "error", // 调试器日志级别
"java.errors.incompleteClasspath.severity": "ignore", // 类路径不完整时忽略错误

// 编辑器配置
"editor.unicodeHighlight.ambiguousCharacters": false, // 去除中文字符警告
"[java]": {
"editor.defaultFormatter": "redhat.java", // 默认格式化工具
"editor.suggest.snippetsPreventQuickSuggestions": false // 快速建议不阻止片段提示
},

// Gradle 支持
"java.import.gradle.enabled": false, // 禁用 Gradle 导入
"java.import.gradle.wrapper.enabled": false, // 禁用 Gradle Wrapper 支持

// 高亮与 JDK
"java.semanticHighlighting.enabled": true, // 语法高亮
"java.jdk.ls.java.home": "D:\\java\\jdk-17", // Language Server 使用的 JDK
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "D:\\java\\jdk-8",
"default": true
}
],
"java.home": "D:\\java\\jdk-17", // 默认 JDK

// 文件排除
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
}
}

Golang 工作区配置文件

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
{
"[go]": {
// 缩进和格式化
"editor.insertSpaces": false, // 使用 Tab 而不是空格
"editor.formatOnSave": true, // 保存时自动格式化
"editor.formatOnType": true, // 输入时自动格式化

// 组织导入
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit" // 保存时自动整理导入
},

// 代码提示
"editor.suggest.snippetsPreventQuickSuggestions": false // 不阻止快速片段提示
},

// Go 工具链路径(可选)
// "go.gopath": "${workspaceFolder}/.go", // 工作区 GOPATH
"go.useLanguageServer": true, // 启用 gopls
"go.formatTool": "gofmt", // 默认格式化工具
// "go.lintTool": "golangci-lint", // 默认 Linter
// "go.buildOnSave": "package", // 保存时构建当前包
// "go.testOnSave": true, // 保存时自动运行测试

// 禁用旧工具的安装提示
"go.toolsManagement.autoUpdate": false, // 禁用自动更新工具
"go.toolsManagement.checkForUpdates": "off", // 关闭工具更新检查

// 禁用除 gopls 外的所有工具
"go.alternateTools": {
"go": "",
"go-outline": "",
"gopkgs": "",
"guru": "",
"gorename": "",
"gotests": "",
"gomodifytags": "",
"impl": "",
"fillstruct": "",
"goplay": "",
"godoctor": "",
"godef": "",
"goreturns": "",
"golint": "",
"dlv": "",
"staticcheck": ""
}
}

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
34
35
36
37
38
39
40
41
42
43
{
// Python 解释器
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", // 默认解释器路径
"python.analysis.extraPaths": ["${workspaceFolder}/.venv/lib/python3.10/site-packages"], // 模块搜索路径

// 代码分析
"python.analysis.logLevel": "Error", // 分析日志级别
"python.analysis.autoSearchPaths": true, // 自动搜索自定义模块路径
"python.analysis.completeFunctionParens": true, // 自动补全括号
"python.analysis.autoImportCompletions": true, // 自动导入缺失模块
"python.analysis.typeCheckingMode": "off", // 类型检查模式
"python.analysis.useLibraryCodeForTypes": true, // 使用第三方库类型信息
"python.analysis.indexing": false, // 禁用索引加快启动
"python.analysis.importFormat": "absolute", // 使用绝对路径导入
"python.analysis.inlayHints.variableTypes": true, // 显示变量类型提示
"python.analysis.inlayHints.functionReturnTypes": true, // 显示函数返回值类型提示

// 终端环境
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},

// 编辑器配置
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8", // 默认格式化工具
"editor.formatOnType": true, // 输入时自动格式化
"editor.formatOnSave": true // 保存时自动格式化
},

// Linting
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.mypyEnabled": true
}

PHP 工作区配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
// PHP 可执行文件路径
"php.validate.executablePath": "D:\\php\\php.exe",

// PHP 代码检查
"php.validate.enable": true,
"php.suggest.basic": true,

// PHP 格式化(需安装 PHP Intelephense 插件)
"[php]": {
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client",
"editor.formatOnSave": true
},

// 文件排除
"files.exclude": {
"**/vendor": true,
"**/.phpunit": true
}
}

前端工作区配置文件

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
57
58
59
60
61
62
63
64
65
{
// ========== 编辑器缩进 ==========
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": false,

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

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

// ========== 各语言特定配置 ==========
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},

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

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

// ========== 文件保存处理 ==========
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,

// ========== TypeScript 自动导入 ==========
"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
}
}

整合配置

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
{
"folders": [{ "path": "." }],
"settings": {
// ===================== 通用编辑器 =====================
"editor.tabSize": 4,
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,

// 通用文件排除
"files.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/dist": true,
"**/.venv": true,
"**/target": true,
"**/.idea": true,
"**/.settings": true
},
"files.watcherExclude": {
"**/node_modules/**": true,
"**/dist/**": true,
"**/.git/**": true,
"**/.venv/**": true,
"**/target/**": true
},

// ===================== Java =====================
"maven.executable.options": "D:\\java\\apache-maven-3.8.4\\bin\\mvn",
"java.configuration.maven.userSettings": "D:\\java\\apache-maven-3.8.4\\conf\\settings.xml",
"java.completion.chain.enabled": true,
"java.completion.matchCase": "off",
"java.signatureHelp.description.enabled": true,
"java.dependency.showMembers": true,
"java.debug.logLevel": "error",
"java.errors.incompleteClasspath.severity": "ignore",
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"java.semanticHighlighting.enabled": true,
"java.jdk.ls.java.home": "D:\\java\\jdk-17",
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "D:\\java\\jdk-8",
"default": true
}
],
"java.home": "D:\\java\\jdk-17",
"java.import.gradle.enabled": false,
"java.import.gradle.wrapper.enabled": false,

// ===================== Go =====================
"[go]": {
// 缩进和格式化
"editor.insertSpaces": false, // 使用 Tab 而不是空格
"editor.formatOnSave": true, // 保存时自动格式化
"editor.formatOnType": true, // 输入时自动格式化

// 组织导入
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit" // 保存时自动整理导入
},

// 代码提示
"editor.suggest.snippetsPreventQuickSuggestions": false // 不阻止快速片段提示
},

// Go 工具链路径(可选)
// "go.gopath": "${workspaceFolder}/.go", // 工作区 GOPATH
"go.useLanguageServer": true, // 启用 gopls
"go.formatTool": "gofmt", // 默认格式化工具
// "go.lintTool": "golangci-lint", // 默认 Linter
// "go.buildOnSave": "package", // 保存时构建当前包
// "go.testOnSave": true, // 保存时自动运行测试

// 禁用旧工具的安装提示
"go.toolsManagement.autoUpdate": false, // 禁用自动更新工具
"go.toolsManagement.checkForUpdates": "off", // 关闭工具更新检查

// 禁用除 gopls 外的所有工具
"go.alternateTools": {
"go": "",
"go-outline": "",
"gopkgs": "",
"guru": "",
"gorename": "",
"gotests": "",
"gomodifytags": "",
"impl": "",
"fillstruct": "",
"goplay": "",
"godoctor": "",
"godef": "",
"goreturns": "",
"golint": "",
"dlv": "",
"staticcheck": ""
}

// ===================== Python =====================
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.analysis.extraPaths": ["${workspaceFolder}/.venv/lib/python3.10/site-packages"],
"python.analysis.logLevel": "Error",
"python.analysis.autoSearchPaths": true,
"python.analysis.completeFunctionParens": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "off",
"python.analysis.useLibraryCodeForTypes": true,
"python.analysis.indexing": false,
"python.analysis.importFormat": "absolute",
"python.analysis.inlayHints.variableTypes": true,
"python.analysis.inlayHints.functionReturnTypes": true,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.mypyEnabled": true,
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}",
"PYTHONDONTWRITEBYTECODE": "1"
},

// ===================== PHP =====================
"php.validate.executablePath": "D:\\php\\php.exe",
"php.validate.enable": true,
"php.suggest.basic": true,
"[php]": {
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client",
"editor.formatOnSave": true
},

// ===================== 前端 =====================
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.requireConfig": true,
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[javascriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
"eslint.validate": [
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"vue"
],
"eslint.run": "onType",
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
}