- 下载 JetBrains Mono 字体 (https://www.jetbrains.com/lp/mono/),并安装
- 在插件市场,下载
Black Formatter
,Material Icon Theme
,Pylint
ctrl+shift+p
,搜索Open User Setting (JSON)
,替换或新增以下配置字段,
"editor.defaultFormatter": "ms-python.black-formatter",
"notebook.defaultFormatter": "ms-python.black-formatter",
"workbench.iconTheme": "material-icon-theme",
"explorer.autoReveal": false,
"workbench.tree.indent": 24,
"editor.fontWeight": "450",
"python.analysis.inlayHints.callArgumentNames": "partial",
"editor.fontSize": 14,
"editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New', monospace",
解释如下:
"editor.defaultFormatter": "ms-python.black-formatter"
设置默认代码格式化工具为 Black(ms-python.black-formatter),适用于 Python 代码。
"notebook.defaultFormatter": "ms-python.black-formatter"
设置 Jupyter Notebook 环境中的代码格式化工具为 Black,确保 Notebook 代码与普通 Python 文件使用相同的格式化风格。
"workbench.iconTheme": "material-icon-theme"
更改 VSCode 的图标主题为 Material Icon Theme,这个主题可以让资源管理器中的文件和文件夹图标更直观、更美观。
"explorer.autoReveal": false
关闭 自动展开文件,防止当前打开的文件在资源管理器中自动定位,避免频繁滚动和展开文件树。
"workbench.tree.indent": 24
设置资源管理器(文件树)的 缩进宽度 为 24 像素,使层级结构更加清晰(默认值通常是 8 或 12)。
"editor.fontWeight": "450"
设置编辑器文本的 字体粗细 为 450,比普通 400(标准权重)稍粗,但比 500(中等粗细)要细一点。
"python.analysis.inlayHints.callArgumentNames": "partial"
启用 Python 参数名称内嵌提示,"partial" 表示仅在某些情况下显示(例如可选参数或关键字参数),提高代码可读性。
"editor.fontSize": 14
设置编辑器的 字体大小 为 14 像素
"editor.fontFamily": "JetBrains Mono, Consolas, 'Courier New', monospace"
设置 代码字体,优先使用 JetBrains Mono(现代编程字体,支持连字),如果不可用则回退到 Consolas 或 'Courier New',最后使用系统默认的 monospace(等宽字体)。