--- title: VSCode 筆記 tags: Note --- # VSCode 筆記 ## Install 在MacOS安裝 ``` brew install --cask visual-studio-code ``` 在Ubuntu安裝 ``` sudo snap install --classic code ``` ## 外掛 **目前使用的主題:** - Theme: Nord Dark Pro - File icon theme: MonokaiPro <!--  -->  ▲ 結果呈現如上圖 **推薦必裝外掛:** - Auto Close Tag - Setting Sync: 用來在多台電腦同步vscode設定,非常方便[(設定教學)](https://ephrain.net/vscode-%E4%BD%BF%E7%94%A8-settings-sync-%E5%A4%96%E6%8E%9B%EF%BC%8C%E5%9C%A8%E4%B8%8D%E5%90%8C%E9%9B%BB%E8%85%A6%E9%96%93%E5%90%8C%E6%AD%A5-vscode-%E8%A8%AD%E5%AE%9A/) - Guides: 使用Guides標示目前所在程式碼區段的線,搭配內建的設定,反白目前所在的括號 > (雖然很多人推薦用Bracket Pair Colorizer,裡面就附帶標示括號顏色、兩個括號區間線的功能,但這套件對我來說有點太繽紛) - Prettier - Git Graph - GitLens: 在各行程式碼中顯示git history - gitignore 1. gitignore Generator:透過點選的方式產生`.gitignore`,將一些系統文件自動加入,不用自己手動添加 3. gitignore : 對該檔案按右鍵直接將檔案加入gitignore **非必須:** - 有了vscode外掛,還需要裝什麼diff工具😏 1. Compare Folders (diff two **folders**) 2. compareit (diff two **files**) 3. ==Partial Diff== (diff two **selected lines**) - File Utils:透過指令做到新增、複製、刪除、移動檔案,重新命名等功能,雙手再也不用離開鍵盤! - TODO註解相關 1. TODO Highlight 2. Todo Tree **開發用:**(依據自己開發需求安裝) - Docker - Python - DotENV - PHP Debug - AREPL for python: 即時顯示output **前端開發用:** - Live server: 即時顯示網頁 - Live Sass Compiler **有趣的外掛:** - Live share:可以即時跟其他人一起編輯檔案 - [Chat](https://marketplace.visualstudio.com/items?itemName=karigari.chat): 可以跟Slack 或 Discord teams 成員直接在vscode裡面聊天 **AI:** - Cody AI **待試** - Material Design Palette Generator ## 快捷鍵 ### 萬用的 ctrl + p ### 重名系 f2 => 整個專案內變數 reference 一次重新命名,按下後輸入要修改的名稱再按 shirt + enter,神技! ctrl + f2 => 將該檔案內已選取單一內容,一口氣全部選取 crtl + d => 將該檔案內已選取單一內容,點一下再多選一個 ### 檢查系 f8 => 檔案裡出現多個錯誤或警告時,可以依序查看 ### 整理系 alt + shift + 0 => 整理並刪除無用 import,神技! Alt + ↑ or ↓ 快速移動整行程式碼 ### 開關系 ctrl + k + 0 => 檔案內容全收合,按 1 2 其他數字可以決定關到第幾層 ctrl + k + j => 檔案內容全展開 ctrl + k + w => 還在一個一個檔案點著關? 直接給你全關 ctrl + \ => 當前檔案開出新 tab ctrl + shift + t => 叫回不小心手殘關掉的檔案,神技! ctrl + space + i => 重新開啟提示,例如有個 [] 在按下 . 時會跳出它的方法提示,但如果點到其他地方再點回來提示就沒了,這可以再度開啟 ### 跳轉系 ctrl + g => 還在滾滾輪? 直接輸入行數跳過去 ctrl + p => 還在檔案列表慢慢翻? 直接輸入檔名跳過去 ctrl + shift + e => file list ctrl + shift + f => global search ctrl + shift + g => git ctrl + shift + x => extension ## `settings.json` 設定 ### Python pylint 在import外部套件時會有紅線,但是不影響執行 解決: 在settings.json設定讓pylint忽略此錯誤即可 ``` "python.linting.pylintArgs": [ "--errors-only", "--disable=E0401" ], ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up