A journal for sharing all things software development related
Visual Studio Code (VSCode / VS Code)
Tue, 25 Jun 2019 08:49 UTC by garethbrown
Visual Studio Code
Download: https://code.visualstudio.com/docs/?dv=win
Debugging multiple projects at once
Create a "compound" configuration for the two apps in launch.json
"compounds": [
{
"name": "App1AndApp2",
"configurations": ["App1", "App2"]
}
]
Enable / Disable Git
https://stackoverflow.com/questions/30331338/remove-git-integrations-from-vscode/52337432
Add this to settings.json
:
// Whether git is enabled.
"git.enabled": false,
Some other commands related to Git execution:
// Path and filename of the git executable, e.g. `C:\Program Files\Git\bin\git.exe` (Windows).
"git.path": null,
// When enabled, commits will automatically be fetched from the default remote of the current Git repository.
"git.autofetch": false,
Save all open files
Note that next to 'Open editors' you will see the number of 'unsaved' files.
In visual studio code as of today you can press Ctrl + K + S to save all unsaved files currently opened in your editor.
...
Press Ctrl key + K.
Release the Ctrl and K both keys.
Press S key.
Format text / JSON etc
S-A-f
Find and Replace
NOTE: Had some problems with this on locked down UKSBS machine - seemed to only be able to search in open files - possibly because of running as admin while searchin in user account? Installed with VSCode system installer - variant that installs for all users and the problem was resolved.
Open settings
C-,
Find in file
C-f
Replace in file
C-h
Find in workspace / directory
C-S-f
Replace in workspace / directory
C-S-h
Regular expression replace with capture retention (Single capture).
Remember to check the regex option
e.g.
Find: DateTime.SpecifyKind\((.+),\s?DateTimeKind.Utc\)
Replace: $1
Diff
In left column, right click 'Select for compare' on first file, now find the second file, right click and click 'Compare with selected'
Keyboard shortcuts
Multiline select
Multiline select with keyboard only
C-A-<arrow-key>
Multiline select with mouse click. Drag down from current cursor position or mouse click end position.
S-A-<arrow-key>
My question - how to get a column / box selection rather than multiline select
I can achieve the desired behavior by starting a selection using:
shift + alt
... and then drag the mouse left or right to start a single line selection, AND THEN start dragging down ...
or by starting a selection using:
ctrl + shift + alt
Another useful question
https://superuser.com/questions/1052795/selecting-columns-in-vs-code
Open command pallete
C-S-p
Search
In file
C-S-f
In folder / workspace
C-S-h
Note: 2019/11/12 - only seems to be working in open files?
Open terminal
C-'
Open terminal at location
Find in left nav explorer, right click > Open in Terminal
Open explorer at location (reveal)
Find in left nav explorer, C-Alt-r
Open folder
C-k-o
Opening files / folders from context menu
.NET Core / Node JS - Creating configurations
In top menu > Debug > Add Configuration
This will create .vscode folder with launch.json and tasks.json
This .vscode directory may need to be duplicated in each folder for multiple startup projects.
Have not currently worked out how to set different ports for different start up projects.
The information on this site is provided “AS IS” and without warranties of any kind either
express or implied. To the fullest extent permissible pursuant to applicable laws, the author disclaims all warranties, express or implied, including, but not limited to, implied warranties of merchantability, non-infringement and suitability for a particular purpose.