前言:
基于Arduio配置ESP32开发环境...
目录
前言:
1.0 安装Python
2.0 安装VSCode
3.0 VSCode实用插件
4.0 替换VSCode配置(可选)
后记
1.0 安装Python
在windows操作系统的搜索框中搜索Microsoft Store
点击获取
安装完成后
安装
按钮消失
WIN + R 打开命令行窗口输入CMD
命令框中输入python
注:出现版本信息表示安装成功
2.0 安装VSCode
安装参考:https://blog.csdn.net/msdcp/article/details/127033151
3.0 VSCode实用插件
第一次打开VSCode,有可能右下角会提示是否安装中文语言包,如果有提示,直接点击安装;如果没有提示点击左边Extension
图标,搜索中文
,安装简体中文插件
注:这是一个简单的中文插件,对国人来说非常友好,安装完成后,需要重启Vscode中文才会生效,右下角会有重启提示,如果不提示,自己重启VScode即可
按照同样的方法,搜索platformio
插件,并安装,稍等几秒钟,即可安装成功
你会发现 VSCode
自动开始下载platformio
依赖的各种资源,观察右下角提示信息,当出现如下图所示的提示信息时,果断关闭Vscode
程序
这里果断关闭VScode终止下载,是因为后续的下载速度很慢,并且就算这一步成功下载了,后续创建esp32
的项目时,仍然需要下载更多资源,使用VSCode下载的资源时间比较长,大部分人接受不了,所以接下来我们采用离线安装的方式进行安装。以下是专属的资源包,用百度网盘的方式提供出来
链接: https://pan.baidu.com/s/1YOjoZaW0urQmff6-xWKgWg?pwd=v5th
提取码: v5th
将下载下来的压缩包解压后,出现如下内容
将以下内容进行复制
至此,再次打开VSCode
,点击左边的蚂蚁头
图标,左边操作选项很快就能加载出来,说明platformio
需要的离线资源已经全部准备完毕。
Prettier - Code formatter插件安装
插件市场搜索Prettier - Code formatter
,按照之前的方法安装,该插件能够快速将代码格式化,代码编写过程中,按下键盘ctrl+s
即可自动格式化代码,保持整洁的代码格式。
安装Error Lens插件
插件市场搜索Error Lens
,按照之前的方法安装,该插件能够将错误信息报告得更详细,比如你在写代码时,将英文分号写成了中文分号,该插件会明确提示你。
安装Codesnap插件
插件市场搜索Codesnap
,按照之前的方式安装,该插件可以很方便地把所选代码制作成优美图片,便于代码分享。
4.0 替换VSCode配置(可选)
{
"files.autoSave": "afterDelay",
"files.autoGuessEncoding": true,
"workbench.list.smoothScrolling": true,
"editor.cursorSmoothCaretAnimation": "on",
"editor.smoothScrolling": true,
"editor.cursorBlinking": "smooth",
"editor.mouseWheelZoom": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"editor.formatOnSave": true,
"editor.wordWrap": "on",
"editor.guides.bracketPairs": true,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.acceptSuggestionOnEnter": "smart",
"editor.suggestSelection": "recentlyUsed",
"window.dialogStyle": "custom",
"debug.showBreakpointsInOverviewRuler": true,
"workbench.startupEditor": "none",
"editor.fontSize": 25,
"editor.fontFamily": "Consolas, 'Courier New', monospace",
"prettier.tabWidth": 4
}
设置vscode快捷键(可选)
快捷键能大幅提高工作效率,下面我个人用了很多年的快捷键设置,有需要的可以自取(Mac系统将下面的ctrl替换成cmd即可)
// 将键绑定放在此文件中以覆盖默认值auto[]
[
{
"key": "ctrl+d",
"command": "editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "shift+ctrl+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "alt+left",
"command": "-cursorWordLeft",
"when": "textInputFocus"
},
{
"key": "alt+left",
"command": "-breadcrumbs.focusPreviousWithPicker",
"when": "breadcrumbsActive && breadcrumbsVisible && listFocus && !inputFocus"
},
{
"key": "shift+ctrl+f",
"command": "-workbench.view.search",
"when": "workbench.view.search.active && neverMatch =~ /doesNotMatch/"
},
{
"key": "shift+ctrl+f",
"command": "-workbench.action.findInFiles"
},
{
"key": "shift+ctrl+f",
"command": "-workbench.action.terminal.searchWorkspace",
"when": "terminalFocus && terminalProcessSupported && terminalTextSelected"
},
{
"key": "shift+ctrl+f",
"command": "-filesExplorer.findInFolder",
"when": "explorerResourceIsFolder && filesExplorerFocus"
},
{
"key": "shift+ctrl+f",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
},
{
"key": "alt+ctrl+l",
"command": "-editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
},
{
"key": "shift+alt+f",
"command": "-editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
},
{
"key": "alt+ctrl+l",
"command": "-editor.action.formatDocument.none",
"when": "editorTextFocus && !editorHasDocumentFormattingProvider && !editorReadonly"
},
{
"key": "alt+right",
"command": "workbench.action.navigateForward",
"when": "canNavigateForward"
},
{
"key": "alt+left",
"command": "workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "alt+ctrl+right",
"command": "-workbench.action.navigateForward",
"when": "canNavigateForward"
},
{
"key": "ctrl+]",
"command": "-workbench.action.navigateForward",
"when": "canNavigateForward"
},
{
"key": "ctrl+-",
"command": "-workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "ctrl+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+d",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorHasSelection && !editorReadonly"
},
{
"key": "shift+alt+up",
"command": "-editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+down",
"command": "-editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "alt+up",
"command": "-editor.action.smartSelect.grow",
"when": "editorTextFocus"
},
{
"key": "alt+down",
"command": "-notebook.cell.moveDown",
"when": "notebookEditorFocused && !inputFocus"
},
{
"key": "alt+down",
"command": "-editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
{
"key": "alt+left",
"command": "-cursorWordLeft",
"when": "editorTextFocus && !config.intellij-idea-keybindings.useCamelHumpsWords"
},
{
"key": "alt+left",
"command": "-cursorWordPartStartLeft",
"when": "config.intellij-idea-keybindings.useCamelHumpsWords && editorTextFocus"
},
{
"key": "alt+right",
"command": "-cursorWordPartRight",
"when": "config.intellij-idea-keybindings.useCamelHumpsWords && editorTextFocus"
},
{
"key": "alt+right",
"command": "-cursorWordRight",
"when": "editorTextFocus && !config.intellij-idea-keybindings.useCamelHumpsWords"
},
{
"key": "alt+right",
"command": "-breadcrumbs.focusNextWithPicker",
"when": "breadcrumbsActive && breadcrumbsVisible && listFocus && !inputFocus"
},
{
"key": "alt+right",
"command": "-cursorWordEndRight",
"when": "textInputFocus"
},
{
"key": "alt+left",
"command": "-breadcrumbs.focusPrevious",
"when": "breadcrumbsActive && breadcrumbsVisible"
},
{
"key": "alt+right",
"command": "-breadcrumbs.focusNext",
"when": "breadcrumbsActive && breadcrumbsVisible"
}
]
将以上的内容复制到快捷键设置中
点击左下角设置按钮,打开键盘快捷方式,然后转换成json配置形式,全选替换成上述内容即可
快捷键用法
● 删除光标所在行,ctrl+d
● 将光标所在行上移一行,alt+↑
● 将光标所在行下移一行,alt+↓
● 向上复制光标所在行,ctrl+↑
● 向下复制光标所在行,ctrl+↓
● 光标所在位置后退,alt+←
● 光标坐在位置前进,alt+→
后记
个人学习总结,仅供学习参考......