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"
	}
}
相关推荐
JavaEdge.4 小时前
IDEA卡死没反应的全部解决方案
java·ide·intellij-idea
wanzhong23337 小时前
解决vscode在win下使用cuda无法跳转库函数的问题
ide·vscode·编辑器·cuda·高性能计算
何小义的AI进阶路8 小时前
win下 vscode下 C++和opencv的配置与使用
c++·图像处理·vscode·opencv
weixin_4046793110 小时前
vscode 配置cpp调试环境
数据库·ide·vscode·编辑器
weixin_4046793110 小时前
解决vscode, cpp库包找不到问题
ide·vscode·编辑器
EasyCVR11 小时前
编辑器分发RTSP地址接入到视频汇聚平台EasyCVR离线原因排查
编辑器·音视频
人工智能训练11 小时前
Ubuntu 系统安装 VSCode 超全指南(3 种方法,适配 20.04/22.04 LTS)
linux·运维·服务器·vscode·ubuntu
程序猿小郑11 小时前
Quill 编辑器自定义视频模块:将 iframe 替换为 video 标签
编辑器·音视频
失心疯_202311 小时前
Pycharm打开Terminal终端无法自动进入项目虚拟环境
ide·python·pycharm·虚拟环境·terminal
yi个名字12 小时前
从 Vibe Coding 到 MCP 智能体:在 IDE 里搭建可部署的工作流与 API 应用
ide·人工智能