vscode下写pyhton的settings.json 配置

vscode下写pyhton的settings.json 配置

改自c/c++配置待完善

{
    // 控制字体大小(像素)
    "editor.fontSize": 16,
    // 在 #editor.wordWrap# 为 wordWrapColumn 或 bounded 时,控制编辑器的折行列。100 列后换行
    "editor.wordWrapColumn": 100,
    // 控制tab键是空格还是制表符  true 空格  false制表符
    "editor.detectIndentation": true,  
    // tab 对应空格大小	  
	"editor.tabSize": 4,    
    // 在保存时格式化文件。
    "editor.formatOnSave": false,
    // 开启 vscode 文件路径导航
    "breadcrumbs.enabled": true,
    // prettier 是否在每行末尾添加分号 ,C_cpp有用
    "prettier.semi": false,
    // prettier 设置强制单引号
    "prettier.singleQuote": true,
    // 尽可能控制尾随逗号的输出。 有效选项: none - 无尾随逗号  es5 - 在ES5中有效的尾随逗号(对象,数组等) all - 尾随逗号 尽可能(函数参数)
    "prettier.trailingComma": "none",
    // 定义函数参数括号前的空格处理方式。
    "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
    // 鼠标滚轮缩放
    "editor.mouseWheelZoom": true,
     

	"C_Cpp_Runner.cStandard": "c11",

    "astyle.additional_languages": [
        "python",
    ],

    "astyle.cmd_options": [
        "--style=allman",		//Kernighan&Ritchie 风格格式和缩进
        "--indent=spaces=4",	//缩进4个空格  -indent=tab
        // "--indent=tab=4",		
        "--convert-tabs",
        "--align-pointer=name",
        "--align-reference=name",
        "--keep-one-line-statements",
        "--pad-header",
        "--pad-oper",			//操作符两端插入一个空格
    ],

    // "astyle.executable": "D:\AStyle\bin\astyle.exe",
    "astyle.executable": "astyle",
    "files.encoding":"utf8",

    "[c]": {
        "editor.defaultFormatter": "ms-vscode.cpptools"
    },
    "editor.minimap.enabled": false,
    "[cpp]": {
        "editor.defaultFormatter": "ms-vscode.cpptools"
    },
    "editor.defaultFormatter": "ms-vscode.cpptools",

    // "workbench.colorTheme": "One Dark Pro",
    
    // "terminal.integrated.shell.linux": "/mnt/d/ubuntu/cCode",
    // "terminal.integrated.shell.windows": "C:WINDOWSSystem32wsl.exe",
    // "python.defaultInterpreterPath": "python3",
    // "code-runner.executorMap": {
    // 	// 加上-u(unbuffered)参数后会强制其标准输出也同标准错误一样不通过缓存直接打印到屏幕
    //     "python":"python3 -u $fullFileName"
    // },  
    "terminal.integrated.defaultProfile.linux": "bash",
    // "terminal.integrated.shell.linux": "C:WINDOWSSystem32wsl.exe",
    "code-runner.runInTerminal": true,
    // "code-runner.terminalRoot": "/mnt/d/ubuntu/cCode",
    "files.associations": {
        "companylist.h": "c",
        "stdlib.h": "c"
    },

}

tasks.json 配置

{
	// See https://go.microsoft.com/fwlink/?LinkId=733558
	// for the documentation about the tasks.json format
	"version": "2.0.0",
	"tasks": [
		{
			"label": " Python ",
			"type": "shell",
			"command": "python3",
			"args": [
				"${file}"
			],
			"problemMatcher": [],
			"group": {
				"kind": "build",
				"isDefault": true
			}
		},
		// {
		// 	"label": "Ubuntu Python3 APP",
		// 	"type": "shell",
		// 	"command": "python3",
		// 	"args": [
		// 		"${workspaceFolder}/testPython/app.py"   //记得加上目录名${fileDirname} ${relativeFileDirname} ${workspaceFolder} 
		// 	],
		// 	"problemMatcher": [],
		// 	"group": {
		// 		"kind": "build",
		// 		"isDefault": true
		// 	}
		// }		
	]
}
经验分享 程序员 微信小程序 职场和发展