1565 views
owned this note
# VSCode 推薦套件清單
###### tags: `MCL Notebook` `vscode`
VSCode 有許多擴充套件可以使用,善用套件也可以幫助開發並且大大提升工作效率。
> #### 參考文件
> * [VSCode 如何提高我的寫扣效率](https://larrylu.blog/vscode-tips-fe3320f9032a)
> 一個從 Vim 轉換到 VSCode 的使用者,會介紹在 Vim 常用的功能在 VSCode 會如何實現。
## 語言相關
### Python 環境
建議 Python 和 Python for VSCode 擇一安裝,兩套件有時候會衝突。
* [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
* [Python for VSCode](https://marketplace.visualstudio.com/items?itemName=tht13.python)
* [Python Extended](https://marketplace.visualstudio.com/items?itemName=tushortz.python-extended-snippets) (補字有時候會怪怪的)
#### 參考設定
1. `Python` 將 formatter 指定成 `yapf` (Google style format provider)
```json
{
"python.formatting.provider": "yapf",
}
```
2. `Python` 儲存時自動套用 formatter
```json
{
"editor.formatOnSave": true,
}
```
3. `Python` 禁止自動啟動 `jupyter` (看個人喜好)
```json
{
"python.dataScience.sendSelectionToInteractiveWindow": false,
"python.dataScience.disableJupyterAutoStart": true
}
```
4. `pylint` 修正 `unsubscriptable-object` 錯誤回報
```bash
# https://github.com/PyCQA/pylint/issues/3139
python3 -m pip install pylint==2.3 astroid==2.2 --user
```
### C/C++ 環境
* [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
* launch.json 範例
* debug 設定
```json
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) C",
"type": "cppdbg",
"request": "launch",
// 選擇要 debug 的 執行檔
"program": "${workspaceRoot}/${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
// gdb 位置
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}],
// 要先產生執行檔才能 debug , 這裡的 buildC 對應 tasks.json 中的 label
// 名字可自訂
"preLaunchTask": "buildC"
}
]
```
* tasks.json 範例
```
"version": "2.0.0",
"tasks": [
{
"label": "buildC",
"type": "shell",
"command": "gcc",
"args": [ "-g" , "${file}", "-o", ${fileBasenameNoExtension}.exe"
]
}
```
* C++ 自己設定
### Markdown
* [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one)
* [HackMD](https://marketplace.visualstudio.com/items?itemName=HackMD.vscode-hackmd)
## 協助工具
### 按鍵集
* [Sublime Text Keymap and Settings Importer](https://marketplace.visualstudio.com/items?itemName=ms-vscode.sublime-keybindings)
* [Vim](https://marketplace.visualstudio.com/items?itemName=vscodevim.vim)
> Vim 的設定可以參考[另外一篇文件](https://hackmd.mcl.math.ncu.edu.tw/s/zsiPBYKDa)
### 補字
* [TabNine](https://marketplace.visualstudio.com/items?itemName=TabNine.tabnine-vscode) (全語言智慧補字套件)
* [Path Intellisense](https://marketplace.visualstudio.com/items?itemName=christian-kohler.path-intellisense)
* [autoDocstring](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)
### 版本控制
* [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
* [Git History](https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory)
* [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree)
### 遠端開發
* [Remote Development](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack) ([官方教學文件](https://code.visualstudio.com/docs/remote/ssh))
* [Native Debug](https://marketplace.visualstudio.com/items?itemName=webfreak.debug)
### 括號顏色
* [Bracket Pair Colorizer](https://marketplace.visualstudio.com/items?itemName=CoenraadS.bracket-pair-colorizer)