最近由pycharm切到VScode, 记录一下项目的通用配置;
在项目目录建一个.vscode的文件夹分别创建三个文件
lunch.json python运行配置
settings.json vscode配置 包括代码校验;
sftp.json 文件服务器配置, 直接右键上传到服务器
lunch.json
{
"version": "0.2.0",
"configurations": [
{
//配置名称,将会在启动配置的下拉菜单中显示
"name": "Python: Run Server",
//配置类型
"type": "python",
//请求配置类型,可以为launch(启动)或attach(附加)
//launch: VSCode 会打开这个程序然后进入调试
//attach:你已经打开了程序,然后接通内部调试协议进行调试
"request": "launch",
"stopOnEntry": false,
"python": "/home/yp1234/.conda/envs/python38/bin/python",
//将要进行调试的程序的路径
"program": "run.py",
//调试程序时的工作目录,一般为${workspaceRoot}即代码所在目录
"env": {
// "FLASK_ENV": "development"
},
"args": [],
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"justMyCode": false,
"console": "integratedTerminal",
},
{
"name": "Python: Run This Script",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
}
]
}
settings.json
// 将设置放入此文件中以覆盖默认值和用户设置。
{
"python.defaultInterpreterPath": "/home/yp1234/.conda/envs/python38/bin/python",
// 不使用 python.languageServer,使用 pyright 作为静态检查器
// "python.languageServer": "Pylance", # 可以使用 Pylance, 底层也是 pyright
"python.languageServer": "Pylance",
"editor.suggestSelection": "recentlyUsedByPrefix",
"editor.formatOnSave": true,
// "editor.codeActionsOnSave": {
// "source.fixAll": true,
// "source.organizeImports": true
// },
// "update.mode": "none",
"search.exclude": {
"libstubs": true
},
//"python.linting.lintOnSave": false,
"python.analysis.stubPath": "libstubs",
"python.analysis.diagnosticMode": "workspace",
// "python.testing.pytestEnabled": true,
// "python.linting.enabled": true,
"python.analysis.disabled": [
"inherit-non-class"
],
"python.analysis.typeCheckingMode": "basic",
"python.autoComplete.showAdvancedMembers": false,
// "python.formatting.provider": "none",
"isort.args": [
"--profile",
"black"
],
"advancedNewFile.exclude": {
"libstubs": true
},
"git.ignoreLimitWarning": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
// "extensions.autoCheckUpdates": false
"window.zoomLevel": 1.2,
"editor.fontSize": 15
}
sftp.json
{
"name": "My Server",
"host": "192.X.X.X",
"protocol": "sftp",
"port": 22,
"username": "root",
"password": "rootttttt",
"remotePath": "/data/ceshi10",
"uploadOnSave": false,
"useTempFile": false,
"openSsh": false
}
标签:false,python,配置,vscode,json,editor,true
From: https://www.cnblogs.com/gatling/p/17888906.html