Visual Studio Code

This article introduces some useful configurations of Visual Studio Code.

Enable Command Center

Right click on Menu Bar and select Command Center to enable it:

vscode-01

Open User Settings (JSON)

Press Ctrl + Shift + P, then input Open User Settings (JSON), and open the JSON settings:

vscode-28

vscode-29

Export / Import Settings Profiles

In Command Center, input > export and select Settings Profiles: Export... to export current settings to specified file:

vscode-02

In Command Center, input > import and select Settings Profiles: Import... to import settings from specified file:

vscode-03

Show Line Numbers in Search Results

Select Settings > Search > Show Line Numbers:

vscode-04

Disable Error Squiggles

Set Settings > C/C++ > C_Cpp: Error Squiggles to Disabled:

vscode-05

Search

Use Show Search Modes... in right side of Command Center:

vscode-06

vscode-07

to:

Options Comments
... Go to File Search specified file
: Go to Line/Column Go to specified line in current file
@ Go to Symbol in Editor Search specified symbol in current file
# Go to Symbol in Workspace Search specified symbol in workspace

vscode-08

Search in current file:

  • Ctrl + F, then input keywords
  • Select keywords in current file, then Ctrl + F

Search in workspace:

  • Ctrl + Shift + F, then input keywords
  • Select keywords in current file, then Ctrl + Shift + F
  • Select keywords in current file, then select Find All References in right-click menu

Seach: Exclude

vscode-20

VSCode Remote-SSH

VSCode Remote-SSH from Windows to Linux Server:

1st, generate id_isa_<XXX> and id_isa_<XXX>.pub on Windows by executing the following commands in MobaXterm:

ssh-keygen -t rsa

2nd, copy the files id_isa_<XXX> and id_isa_<XXX>.pub to the folder C:\User\<Your-Account-on-Windows>\.ssh\ on Windows.

3rd, change properties of the file id_isa_<XXX> on Windows. That’s, keep your accout only in Group or user names field:

vscode-10

4th, copy content of the file id_isa_<XXX>.pub from Windows to the file /home/<Your-Account-on-Linux-Server>/.ssh/authorized_keys on Linux server.

5th, install VSCode extension Remote-SSH on Windows.

6th, add VSCode SSH configuration file C:\User\<Your-Account-on-Windows>\.ssh\config on Windows:

Host <Linux-Server-Name>
  HostName <Linux-Server-IP>
  User <Your-Account-on-Linux-Server>
  PreferredAuthentications publickey
  IdentityFile "C:\User\<Your-Account-on-Windows>\.ssh\id_rsa_XXX"

vscode-11

7th, to move the folder remote.SSH.serverInstallPath on a larger disk on Linux server, set it in VSCode settings remote.SSH.serverInstallPath on Windows:

vscode-13

8th, it is no need to input password anymore when VSCode on Windows connecting to the Linux server.

Open Editors: Sort Order

vscode-09

Remote-explorer: Folder Sort Order

vscode-14

Symbol order in Breadcrumbs

vscode-30

vscode-31

Fix Ctrl+Shift+F not work issue

与微软拼音输入法的简繁切换快捷键冲突,取消微软拼音输入法的简繁切换快捷键即可:

Win键 > 设置 > 时间和语言 > 语言 > 首选语言: 中文 > 选项 > 键盘: 微软拼音 > 选项 > 按键 > 快捷键: 简体/繁体中文输入切换

vscode-12

Fix Go to Definition not work issue

Install extension C/C++ to SSH remote:

vscode-21

Then, the Go to Definition can be used:

vscode-22

Turn on Rulers

vscode-15

Upload and download files

vscode-16

vscode-17

Window: Title

vscode-18

vscode-19

Terminal: Hide Tabs

vscode-24

vscode-25

Terminal: Right Click Behavior

1st. Press ctrl+,

2nd. Search right click

3rd. Set Right Click Behavior to default

vscode-26

vscode-27

Explorer: Disable Auto Reveal

Disable Auto Reveal on Explorer:

vscode-37

You can reveal the opened file in Explorer View by:

vscode-38

Trim Tailing Whitespace

vscode-39

Bracket Pairs

vscode-40

Workspace

vscode-41

Add Folder to Workspace…

Save Workspace As…

Extensions

  • C/C++
  • Remote Development
  • GitLens
  • PlantUML

vscode-23

GitLens

SOURCE CONTROL

vscode-32

COMMIT

Open View Settings:

vscode-33

User author avatars:

vscode-34

Abbreviated Sha Length:

vscode-35

SEARCH & COMPARE

vscode-36

PlantUML

References