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"
	}
}
相关推荐
aningxiaoxixi43 分钟前
vscode 中的 mermaid
网络·ide·vscode
旷世奇才李先生1 小时前
Eclipse 安装使用教程
java·ide·eclipse
百锦再2 小时前
Rider 全面解析:跨平台 .NET IDE 的核心技术与高效实践指南
linux·ide·.net·sdk·core·rider
EmpressBoost2 小时前
System.getenv()拿不到你配置的环境变量
java·ide·intellij-idea
定偶6 小时前
C语言中整数编码方式(原码、反码、补码)
c语言·数据结构·编辑器
霖0013 小时前
FPGA通信设计十问
运维·人工智能·经验分享·vscode·fpga开发·编辑器
学习3人组13 小时前
在 IntelliJ IDEA 系列中phpstorm2025设置中文界面
java·ide·intellij-idea
zenithdev115 小时前
Sublime Text下载教程Sublime Text 4 保姆级安装步骤(附安装包)
其他·编辑器·sublime text
张紫娃18 小时前
idea 常用快捷键
java·ide·intellij-idea
chhei.1 天前
使用Pycharm集成开发工具远程调试部署在虚拟机上的flask项目:超级详细的完整指南
ide·pycharm·flask