VS Code


VS Code

 
 
 

VS Code

VS Code(Visual Studio Code)是由微軟研發的一款免費、開源的跨平台文本(代碼)編輯器。幾乎完美的編輯器。

官網:https://code.visualstudio.com

文檔:https://code.visualstudio.com/docs

源碼:https://github.com/Microsoft/vscode

本文所使用VS Code版本:1.2.0,1.3.1

集成Git

支持git提交

vscode默認已集成git,支持git提交,查看修改列表。

image

Git History

地址:https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory

安裝:ext install githistory

Features

  • View the details of a commit, such as author name, email, date, committer name, email, date and comments.
  • View a previous copy of the file or compare it against the local workspace version or a previous version.
  • View the changes to the active line in the editor (Git Blame).
  • Configure the information displayed in the list
  • Use keyboard shortcuts to view history of a file or line

同步vs code 擴展和設置

讓vs code的設置,偏好,快捷鍵設置,擴展等等數據在多台機器上保持同步。

把vs code的數據托管在github的gist服務器,其它機器就可以同步配置和擴展。

擴展:settings sync

文檔:https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

安裝:ext install code-settings-sync

1. 上傳配置到gist

1、Shift + Alt + u 輸入在github為vs code創建的 Personal Access Tokens,回車

2、保存 gist id

3、Shift + Alt + u 保存過一次之后,再按此快捷鍵就是同步數據

更換電腦之后,可以繼續使用之前創建的personal access tokens

 

2. 下載配置到本地

1、Shift + Alt + d 打開輸入框,[輸入在github為vs code創建的 Personal Access Tokens,回車] vscode 1.10版本無需此步驟

2、輸入 gist id

3、等待配置及擴展同步到本地

image

github的gist服務

如何看待 Github Gist這個服務,怎樣更好的利用?

創建Personal Access Tokens:https://github.com/settings/tokens

使用感受

1. github創建的Personal Access Tokens ,創建成功之后是可以再次編輯的

2. 一定要保存好 github創建的 Personal Access Tokens

2. 一定要保存好 code setting sync的gist id。這個id用於在多台機器上保持同步。

文本編輯及快捷鍵

多列編輯

Shift + Alt +鼠標左鍵

Markdown

默認已支持實時預覽,我使用的vs code1.2版本

預覽:Ctrl + K ,V 在右側窗口打開預覽,支持實時預覽改動部分

Ctrl + Shift + V 快速預覽當前文檔

文檔:https://code.visualstudio.com/docs/languages/markdown

配置或查看快捷鍵

選擇 文件 - 首選項 - 鍵盤快捷方式 打開keybinding.json,可以修改或查看vscode的快捷鍵

image

打開命令行 (>)

Ctrl + Shift + P

常用快捷鍵

Ctrl + P  打開擴展管理器

Ctrl + Shift + K 刪除當前行

Ctrl + B  顯示/隱藏側邊欄

離線安裝vs code擴展

以安裝 vscode-instant-markdown 為例:https://marketplace.visualstudio.com/items?itemName=dbankier.vscode-instant-markdown

Mac & Linux

cd $HOME/.vscode/extensions
git clone https://github.com/dbankier/vscode-instant-markdown.git
cd vscode-instant-markdown
npm install

Windows

cd %USERPROFILE%\.vscode\extensions
git clone https://github.com/dbankier/vscode-instant-markdown.git
cd vscode-instant-markdown
npm install

image

'npm' 不是內部或外部命令…

如果你在安裝時,出現上述提示,那么你需要安裝nodejs

1. 打開nodejs的官網下載:https://nodejs.org/en/

2. 運行安裝程序,進行安裝,會自動配置環境變量和安裝npm package manager

3. 再次安裝vs code 擴展

image

vs code 擴展

1. vs code安裝擴展

1、在vs code中按 Ctrl + P,打開擴展管理器

2、輸入安裝代碼: ext install 擴展名 ,鍵盤選擇要安裝的擴展,按回車

image

3、安裝完成后,會提示重啟

image

2. 瀏覽插件庫

https://marketplace.visualstudio.com/VSCode

3. csharp

地址:https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp

安裝:ext install csharp

安裝之后報錯:The .NET CLI tools cannot be located. .NET Core debugging will not be enabled. Make sure .NET CLI tools are installed and are on the path.

image

4. HTML CSS Class Completion

說明:我安裝的vs code默認已支持css,javascript。可檢查css,html語法錯誤

地址:https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion

安裝:ext install html-css-class-completion

5. PowerShell

地址:https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell

安裝:ext install PowerShell

6. Lua

地址:https://marketplace.visualstudio.com/items?itemName=keyring.Lua

安裝:ext install Lua

7. Java Snippets

地址:https://marketplace.visualstudio.com/items?itemName=tushortz.java-snippets

安裝:ext install java-snippets

8. python

地址:https://marketplace.visualstudio.com/items?itemName=donjayamanne.python

安裝:ext install python

9. Project Manager

功能:Manage your projects right inside Visual Studio Code. Easily access and switch between them.

使用方法

1、ctrl +shift + p 打開命令行,輸入:project save ,選擇Project Manager: Save Project

image

2、輸入要保存當前工程的名字

image

3、查看或修改保存的工程

ctrl +shift + p 打開命令行,輸入:project edit,選擇Project Manager: Edit Project

image

project.json


    { 
        "label": "simpleframework", 
        "description": "d:\\Unity3D\\SimpleFramework_NGUI\\Assets" 
    } 
]

地址:https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager

安裝:ext install project-manager

10. Bookmarks

功能:Mark lines in the editor and easily jump to them.

地址:https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks

安裝:ext install Bookmarks


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM