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"
	}
}
相关推荐
陈言必行1 天前
Unity 性能优化 之 编辑器创建资源优化( 工作流 | 场景 | 预制体)
unity·编辑器·游戏引擎
CAE虚拟与现实1 天前
VSCode中的下载VSIX是指什么?
ide·vscode·编辑器
路边闲人22 天前
vscode启用GEMINI CODE ASSIST插件
ide·vscode·gemini
小蕾Java2 天前
Java 开发工具,最新2025 IDEA使用(附详细教程)
java·ide·intellij-idea
CAE虚拟与现实2 天前
VSCode官方汉化包
ide·vscode·编辑器·vscode汉化
CAE虚拟与现实2 天前
VSCode创建Python项目和运行py文件
ide·vscode·编辑器
资讯第一线2 天前
《RAD Studio 13.0》 [DELPHI 13.0] [官方原版IOS] 下载
ide
过-眼-云-烟2 天前
新版Android Studio能打包但无法run ‘app‘,编译通过后手机中没有安装,顶部一直转圈
android·ide·android studio
Stardep2 天前
ssh远程连接服务器到vscode上“连接失败”
服务器·vscode·ssh
扯淡的闲人2 天前
多语言编码Agent解决方案(4)-Eclipse插件实现
java·ide·eclipse