Visual Studio Code
- Sign in to GitHub account.
Open from terminal for folder
To shell profile on Mac add alias code="open -a 'Visual Studio Code'".
Then open in terminal like code .
Shortcuts
CMD + J- Hide terminalSHIFT + CMD + F- Search (everywhere)SHIFT + CMD + E- File explorerSHIFT + CMD + P- PreferencesSHIFT + CMD + O- Search in code (variables, functions, ...)CTRL + SHIFT + G- Open Source Control (git)CMD + P- Search for a file by name, line, symbol ...SHIFT + CMD + B- BuildCMD + B- Toggle file explorerCMD + D- Select the next occurrence of the current word for multi-editSHIFT + CMD + M- Error in code tabCTRL + R- Open Recent window + filtered searchOPTION + SHIFT + UP/DOWN- Duplicate the current line
Extensions
ansible and ansible-lint is needed. Install for macOS:
brew install ansible ansible-lint
- Open Ansible Extension settings -
Command Palette- fillSettings, openAnsible: Open Ansible Extension Settings -
- in
Basic Configurationenter path to Ansible binary:/usr/local/bin/ansible
- in
Ansible Lint Settings
Do not show long lines warning - create .ansible-lint.yml in the root of the repository with content:
skip_list:
- yaml[line-length]
Go / golang - do not format on type/save
CMD + SHIFT + P > settings.json
In case of remote development / Remote SSH choose Open Remote Settings SSH ...
{
"[go]": {
"editor.formatOnType": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
}
}
Remote SSH development
- Install Visual Studio Code Remote Development Extension Pack
- Read Remote Development with VS Code on Mac in 5 simple steps
-
- In Extensions search for remote development extension pack and install
-
- In the command pallete (
CMD + SHIFT + P) selectRemote-SSH: Add New SSH Host...and use user@hostname ...
- In the command pallete (
-
- Select
Remote-SSH: Connect to Host...from the Command Palette. From the drop-down choose the already added host
- Select
-
-
- You can edit type of the server (Windows, Linux, Mac) in vscode settings (Code > Preferences > Settings) by updating
remote.SSH.remotePlatformproperty
- You can edit type of the server (Windows, Linux, Mac) in vscode settings (Code > Preferences > Settings) by updating
-
vscode-server on Linux
Home folder is .vscode-server
Stop Server: CMD + SHIFT + P > Kill VS Code Server on Host
-
Sometimes I do it 2x or disconnect and try it again. It will start next time I connect or project is oppened.
ps -elf | grep -i vscode-server kill $(pidof node)
In case HTTP proxy is needed for vscode-server
export HTTP_PROXY=http://proxy:port
export HTTPS_PROXY=${HTTP_PROXY}
Code-Server on WEB
Install
This will install DEB package
curl -fsSL https://code-server.dev/install.sh | sh
Enable & Start code-server
sudo systemctl enable --now code-server@${USER}
Or run it in foreground
code-server
Config
- /home/${USER}/.config/code-server/config.yaml
Warning! This configuration is for local private LAN or with usage of another authentication like required client certificate, because security of code-server is DISABLED using this:
bind-addr: 0.0.0.0:8888
# auth: password
auth: none
password: <PASSWORD>
cert: false
Update
To update code-server, install the new version over the old version using one-liner in Install section. All user data is in ~/.local/share/code-server so they are preserved between installations.
My way:
### snapshot
ansible-playbook guest-dev.yml --tags updateVSCode
### delete snapshot if everything works