VS Code

About

Visual Studio Code is built on the Electron framework, which allows developers to create desktop applications using web APIs, standards, and technologies like JavaScript, HTML, and CSS.

Electron essentially combines the Chromium rendering engine and the Node.js runtime, enabling the development of cross-platform applications.

Web APIs utilized by VS Code:

  1. DOM APIs: Even though it's a desktop application, VS Code uses HTML and CSS for rendering its interface, which means it relies on the Document Object Model (DOM) APIs for dynamic content updates and UI manipulations.

  2. Web Storage API: VS Code uses storage mechanisms like localStorage or sessionStorage for persisting state and settings between sessions, similar to web applications.

  3. Fetch API/WebSockets: These are used for network communication. For instance, extensions in VS Code can use these APIs to communicate with external services, fetch data, or interact with web-based services.

  4. Web Workers: These are used to run (javascript) scripts in background threads, allowing VS Code to perform heavy tasks without blocking the UI, enhancing performance and responsiveness.

Install

Windows methods ordered by preference:

  1. CLI: Chocolatey: choco install vscode
  2. GUI: Download (.msi)

Add "Open with ..." to Explorer Context Menu

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

Disable Telemetry

@ Menu: File > Preferences > Settings > Search > telemetry

@ settings.JSON: "telemetry.enableTelemetry": "false",
If by GUI, adds: "telemetry.telemetryLevel": "off",  (instead)

Depricated or Obsolete

VS Code has improved over the years. The following installation and configuration methods are no longer used or advised.

Install per User setup by downloading from MS site

VSCodeUserSetup-x64-v.vv.v.exe @ https://code.visualstudio.com/

Chocolatey installs as System setup, but okay to use choco upgrade if a proper JUNCTION POINT exists.

JUNCTION POINT

"%ProgramFiles%\VS-Code"

is required by File Explorer REG entries, and by openedit.bat

:: @ System setup
symlink.bat j "%ProgramFiles%\VS-Code" "%ProgramFiles%\Microsoft VS Code" 
:: @ User setup
symlink.bat j "%ProgramFiles%\VS-Code" "%USERPROFILE%\AppData\Local\Programs\Microsoft VS Code" 
symlink.bat j "%ProgramFiles%\Microsoft VS Code" "%USERPROFILE%\AppData\Local\Programs\Microsoft VS Code"  

v1.46.0, FAIL @ downloading Extensions, unless via VPN adapter.

"Unable to open extension ..."

FIX:

Enable IPv6 @ Gateway Router
IPv6 > Enable > Native

NOT FIX:

Set interface metric of TAP to higher number than desired interface. At PowerShell:

  1. Get-NetIPInterface
  2. Set-NetIPInterface -InterfaceIndex 19 -InterfaceMetric 100

NOT FIX:

Reset IPv6

ipconfig /flushdns
nbtstat –r
netsh int ip reset
netsh winsock reset
netsh winsock reset catalog
netsh int ipv6 reset reset.log

User interface

Shortcut Keys

CTRL + SHIFT + TAB    Files [Cycle]
CTRL + P              Files Menu
CTRL + F4             Close File

CTRL + `              Terminal [Toggle]
CTRL + ,              User Settings
CTRL + SHIFT + P      Command Pallete
F11                   Full Screen [Toggle]

Format Code [w/ Beautify extension installed]

SHIFT + ALT + F       Windows 
SHIFT + OPTION + F    Mac
CTRL + SHIFT + I      Ubuntu

User Settings (settings.json)

%UserProfile%\AppData\Roaming\Code\User

Terminal (CTRL+)

Uses Git-for-Windows, but invokes .bashrc NOT .bash_profile (@USERPROFILE)

Extensions

To Rollback/Specify Version : Extensions side bar
> settings (icon) > "Install Another Version"

Vim

by vscodevim

File > Preferences > Keyboard Extensions > "Vim emulation ..."

ISSUE @ publisher:"vscodevim" https://github.com/Microsoft/vscode/issues/40260

Everytime we push an update, we always seem to see cases where the extension fails to load. The recommendation I've been giving folks is to delete ~/.vscode/extensions/vscodevim and reinstall.

So, on fail, delete:

and then reinstall.

Remote Development

by Microsoft

Remote - WSL

DEPRICATED DO NOT INSTALL this extension

Use WSL or broader Remote Development extension instead.

Go extension

Install from Git Bash [MINGW64]

Requires .git folders of all Golang source intact, else go get -u -v PKG fails.

Install Golang unstall using Chocolatey, which installs to C:\tools\go