vscode 配置与插件记录

vscode插件

python

  • Python
  • Python Debugger
  • ruff
  • isort
  • Pylance
  • Jupyter
  • Jupyter Keymap
  • Jupyter Slide Show
  • Jupyter Cell Tags
  • autoDocstring - Python Docstring Generator

ruff + isort

pylance

autodocsting

在setting.json里这么配置,这样你保存时就会自动format。(不用右键了)

"【python】": {

"editor.defaultFormatter": "charliermarsh.ruff",

"editor.codeActionsOnSave": {

"source.organizeImports.ruff": "explicit"

}

},

另外把默认格式化器放在python scope下,就不会影响其他默认格式化器(比如js项目的eslint或者prettier)

通用

  • GitLens
  • IntelliCode
  • IntelliCode API Usage Examples
  • Material Icon Theme
  • markdownlint
  • Markdown All in One

代码段

File->Preferences->Configure User Snippets

以python为例

这里用header触发开头的utf

用main触发if name

json 复制代码
{
	// Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// "Print to console": {
	// 	"prefix": "log",
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"HEADER":{
        "prefix": "header",
        "body": [
        "#!/usr/bin/env python",
        "# -*- encoding: utf-8 -*-",
		"",
        // "'''",
        // "@File    :   $TM_FILENAME",
        // "@Time    :   $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
        // "@Author  :   python",
        // "@Version :   1.0",
        // "@Contact :   python@qq.com",
        // "@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA",
        // "@Desc    :   None",
        
        // "'''",
        // "",
        // "# here put the import lib",
        // "$0"
        ],
    },
	"Print to console": {
		"prefix": "main",
		"body": [
			"if __name__ == '__main__':",
			"    ${1:pass}",
			""
		],
		"description": "python--main"
	}
}
相关推荐
浮尘笔记9 小时前
JetBrains差异设置被自动勾选的排查与根治实录
经验分享·程序人生·编辑器·intellij idea·phpstorm·webstorm
Dream-Y.ocean12 小时前
鸿蒙PC平台逻控 PLC 编辑器适配实战:基于 Electron 壳方案的纯 JavaScript 梯形图编程与仿真引擎开发
javascript·编辑器·harmonyos
独隅17 小时前
WebStorm macOS 安装部署与高效调优实战指南
ide·macos·webstorm
golang学习记18 小时前
IDEA 2026.3 远程开发迎来重磅升级
java·ide·intellij-idea·远程开发
NextTech_2 天前
不想学 vim,怎么改服务器上的配置文件?
服务器·编辑器·vim
别问!问就是全会2 天前
Jupyter Notebook 安装包下载|单元格分块运行,图表直接内嵌
ide·python·其他·jupyter
ITKEY_3 天前
emacs 文件管理Dired, the Directory Editor
linux·编辑器·emacs
1024奇点3 天前
【仓颉语言入门 · 第二篇 第 22 课】
开发语言·ide·开源
Solange__4 天前
图片转3D导出GLB、FBX还是OBJ?按5类任务比较材质、动画与可编辑性
人工智能·3d·ai·自然语言处理·编辑器·blender·材质
techpupil4 天前
IDEA基础配置及开发基础插件
java·ide·intellij-idea