|
目录1.python.json配置2.setting.json配置3.解决中文乱码4.实现效果1.python.json配置 python.json获取步骤:文件->首选项->配置用户代码片段->python 此为VSCode的头文件设置,复制以下内容到python.json{"HEADER":{"prefix":"pyheader","body":["#!/usr/bin/envpython3","#_*_coding:UTF-8_*_","#开发团队:ALL","#开发人员:Admin","#开发时间:$CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE$CURRENT_HOURCURRENT_MINUTECURRENT_SECOND","#文件名称:$TM_FILENAME","#开发工具:VisualStudioCode","","","","if__name__=='__main__':","$0"],}}用法:编辑一个.py文件,输入pyheader,就可以补全以下内容啦#!/usr/bin/envpython3#_*_coding:UTF-8_*_#开发团队:ST#开发人员:Jly#开发时间:2024/02/1919:30:06#文件名称:code_statistics.py#开发工具:VisualStudioCodeif__name__=='__main__':2.setting.json配置 setting.json获取步骤:文件->首选项->设置 此为VSCode的头文件设置,涉及到环境配置、代码颜色、行间距、字体粗细、中文环境配置等等{"security.workspace.trust.untrustedFiles":"open","workbench.colorTheme":"OceanicNext(dimmedbg)","workbench.iconTheme":"material-icon-theme","bracket-pair-colorizer-2.depreciation-notice":false,"editor.lineHeight":24,//控制行间距"editor.fontWeight":"normal",//控制字体粗细"editor.tokenColorCustomizations":{"comments":"#00ff7f","keywords":"#eb6689","numbers":"#00eeff","functions":"#ea65f9"},//控制字体颜色"python.defaultInterpreterPath":"D:\\soft\\Anaconda3\\python.exe",//"python.linting.flake8Enabled":true,//"python.formatting.provider":"yapf",//"python.linting.flake8Args":["--max-line-length=248"],//"python.linting.pylintEnabled":false,"python.autoComplete.extraPaths":["D:/soft/Anaconda3/lib/site-packages",],"python.analysis.extraPaths":["D:/soft/Anaconda3",],//"vsicons.dontShowNewVersionMessage":true,//配置python语言正常输出中文的环境"code-runner.executorMap":{"python":"setPYTHONIOENCODING=utf8&$pythonPath-u$fullFileName"},"code-runner.respectShebang":false,"editor.unicodeHighlight.includeStrings":false,"editor.unicodeHighlight.includeComments":false,//终端颜色配置"terminal.integrated.inheritEnv":false,"workbench.colorCustomizations":{"terminal.background":"#200707","terminal.foreground":"#b4d6af","terminalCursor.background":"#D8D8D8","terminalCursor.foreground":"#D8D8D8","terminal.ansiBlack":"#181818","terminal.ansiBlue":"#0b5e7c","terminal.ansiBrightBlack":"#585858",//终端命令行lm@os:"terminal.ansiBrightBlue":"#39b9e7","terminal.ansiBrightCyan":"#86C1B9","terminal.ansiBrightGreen":"#ca530f","terminal.ansiBrightMagenta":"#BA8BAF","terminal.ansiBrightRed":"#AB4642","terminal.ansiBrightWhite":"#F8F8F8","terminal.ansiBrightYellow":"#f788f7","terminal.ansiCyan":"#86C1B9","terminal.ansiGreen":"#b57b6c","terminal.ansiMagenta":"#BA8BAF","terminal.ansiRed":"#AB4642","terminal.ansiWhite":"#D8D8D8","terminal.ansiYellow":"#F7CA88","terminal.integrated.cursorBlinking":true,"terminal.integrated.lineHeight":1.6,"terminal.integrated.letterSpacing":0.1,"terminal.integrated.fontFamily":"LucidaConsole",//字体设置"terminal.integrated.shell.linux":"/bin/zsh",},"[python]":{"editor.formatOnType":true},"vsicons.dontShowNewVersionMessage":true,"settingsSync.ignoredExtensions":[],"settingsSync.ignoredSettings":[],"window.zoomLevel":-1,"editor.codeActionsOnSave":{}}3.解决中文乱码 在setting.json文件里面增加以下内容即可//配置python语言正常输出中文的环境"code-runner.executorMap":{"python":"setPYTHONIOENCODING=utf8&$pythonPath-u$fullFileName"},"code-runner.respectShebang":false},4.实现效果
|
|