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"
	}
}
相关推荐
ACGkaka_4 小时前
Mac(十)设置右键文件夹使用 idea、vscode 打开
vscode·macos·intellij-idea
Hard but lovely6 小时前
vim的使用
linux·编辑器·vim
lincats1 天前
一步一步学习使用FireMonkey动画(6) 用实例理解动画的运行状态
ide·delphi·livebindings·delphi 12.3·firemonkey
404Clukay1 天前
VS Code进行.NET开发时使用断点和热重载
vscode
@Demi1 天前
vsCode或Cursor 使用remote-ssh插件链接远程终端
服务器·ide·vscode·ssh
lincats1 天前
一步一步学习使用FireMonkey动画(5) 动画图解11种动画插值类型
ide·移动开发·delphi 12.3·firedac·firemonkey
王伯爵1 天前
Visual Studio Code (VS Code) 工作区配置文件的作用
ide·vscode·状态模式
南风里1 天前
Android Studio下载gradle文件很慢的捷径之路
android·ide·android studio
后天han2 天前
vscode中launch.json中定义的编译文件名于生成的不一致修改
ide·vscode·编辑器
direction__2 天前
Java Main无法初始化主类的原因与解决方法(VsCode工具)
java·vscode