「VSCode」- 插件、配置、自定义、常用设置

配置文件

Visual Studio Code User and Workspace Settings

User Settings – Settings that apply globally to any instance of VS Code you open.
Workspace Settings – Settings stored inside your workspace and only apply when the workspace is opened.

On Windows/Linux – File > Preferences > Settings
On macOS – Code > Preferences > Settings

进入 Settings 页面,右上角,Open Settings,能够在 配置界面 与 配置文件 间相互切换;

代码编辑

代码对齐:界面调整

调整 Minimap 配色

visual studio code – Change VSCode minimap colors

问题描述:在暗色主题下,滑块的颜色不明显,我们希望能够调整;

解决方案:

{
    ...
    "workbench.colorCustomizations": {                                          # 调整滑块颜色
        "minimapSlider.background": "#0062fa1b",
        "minimapSlider.hoverBackground": "#00fa2a1b",
        "minimapSlider.activeBackground": "#00c97554",
     },
     "editor.minimap.showSlider": "always"                                      # 显示“滑块”,而非 mouseover 才显示;
     ...
}

调整 行号区域 颜色

themes – vscode change linenumber color – Super User

// 背景颜色

"workbench.colorCustomizations": {
  "editorLineNumber.foreground": "#999999"
}

// 当前行号颜色

"workbench.colorCustomizations": {
  "editorLineNumber.activeForeground": "#555555"
}

针对 Workspace 的主题

vscode settings – Different theme per window in Visual Studio Code – Stack Overflow

我们需要开启多个不同的 Workspace 窗口,但是在窗口切换时我们需要分辨出当前 Workspace 实例;

当前的解决办法是通过 Windows Title 查看 Workspace 的名称,但是这是一个缓慢的过程;

我们希望能够找到一种方法,能够快速识别出我们当前所处的 Workspace,我们决定通过采用不同的主体颜色来识别;

Open a new VSCode window.
Open the project folder where you would like to have a different color theme.
Navigate to File > Preferences > Settings.
Select the “Workspace Settings” tab at the top of the settings screen. Anything you edit in here will now be specific to this workspace.
Search for “colorTheme” and select the color theme you would like for this specific workspace.

快捷工具

地址编码、地址解码:
1)URI Encode/Decode – Visual Studio Marketplace

连接 SQL Server 数据库

https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-develop-use-vscode#connect-to-sql-server

自动检测文件编码

How to setup Visual Studio Code detect and set correct encoding on file open – Stack Overflow

File -> Preferences -> User Settings / files.autoGuessEncoding

Its default value is false

插件整理

GitLens – Git supercharged
显示谁修改当前行

Edit csv – extension to edit csv files with a table ui
Edit csv – Visual Studio Marketplace

Office Viewer(Markdown Editor) – Visual Studio Marketplace

远程开发

退出远程开发(visual studio code – How to get rid of vscode remote development?):
File > Close Remote Connection.