Visual Studio Code
Good Docs
Installation
Points
- Interface overview & theming from welcome/ startup page
- Watch into videos from docs
- Default git exists
- Use inbuilt terminals
- use setting files to configure specific for project like jsconfig.json & launch settings file
Emmet syntax
Extensions Installed
- Debugger for chrome //big impact
- Beautify : to beautify spacing, indentation ..etc
- Better Comments : colored comments
- Code Spell Checker
- Document This : for JSDoc
- Import Cost : size of imported library
- node-readme : check library documentation with in editor
- npm : library versioning validation & intellisense of available library + version
- REST Client : test rest api as a normal code file
- Aurelia, Aurelia snippets: Our framework intellisense & snippets
- Path Intellisense
- open in browser (TechER)
- snippet-creator (by vincentkos)
- Markdown Table Prettifier
- HTML Preview by Thomas Haakon Townsend
- Live Server by ritwickdey
- Live Share Extension Pack by Microsoft (live editing + audio calls)
- More Info
- Video
- Git History By Don Jayamanne
ESLINT
- disable eslint indentation as it conflicts with beautify //C:\Users\xyz\AppData\Roaming\Code\User\settings.json
can use following to disable eslint for a section / file (.)
Note : eslint npm package must be globally available
Extensions later
Docker related
Remote debugging upcoming by facebook
Machine Learning related
Browser Preview : Open browser within editor
CodeQL
Time Travel Debugger
markdownlint
C:\Users\someUser\AppData\Roaming\Code\User\settings.json (or BY UI - go to settings)
Note : MarkdownLint rules
Debugging
- can add breakpoint as well as log point
- Debugging console has REPL feature
NodeJS (Direct Debug == Launch)
.vscode -> launch.json
On debugging icon click, above settings executes "node.exe -r esm --inspect-brk=46094 server.js " . Can debug within the editor.
- "request" = "launch" means launching a program with debugging mode (typical server application style)
NodeJS (attach existing Debug == attach)
.vscode -> launch.json
say execute 'npm run-script debug', which executes internally ' node --inspect-brk -r esm server.js'
We see some output like 'Debugger listening on ws://127.0.0.1:9229/15c25267-95fc-4e20-a445-702b90964386'
Now click on VS Code debug -> attach mode
Can debug within the editor.
"request" = "attach" means To attach existing node debugger to VS code
Chrome (Aurelia example)
.vscode -> launch.json
- FIrst run 'npm start' -> which executes 'au run'.
- Now click on VS CODE debug icon - it launches chrome with particular URL 'http://localhost:8080'; Can debug within the editor.
local & Remote Browser debugging aurelia app
- do local npm start
- open remote or local site in browser , open dev tools (F12), in source tab -> webpack:// -> . -> entire code exists, add break points & use it
Note : For remote debugging, dist folder should contain entire build to see webpack in dev tools
Gulp Tasks (md to html)
install globally
install locally
Note : We need to install gulp both globally (-g switch) and locally
create a gulp file at root
create tasks.json file in .vscode folder
manually run task
From VSCODE
Binding keyboard shortcuts
- sample beautify file
f1 -> keyboard shortcuts or go to file directly '\Users\someUser\AppData\Roaming\Code\User\keybindings.json'
User defined snippets
- F1 -> (type) snippets -> (select) Configure User snippets -> (select some language - say) MarkDown
Note : (check docs) for multi line content , body must be added in array form & double quotes must be escaped/ use single quote.
snippet-creator extension can be used.
- select some content, f1 -> create snippet & fill required questions
Team VS Code Settings
commands
f1 -> fold all block comments
user settings file
disable the type checks per line by adding the following comment
To disable type checks on an entire you can use
bind css to markdown files globally //currently use hosted css link in all md files (md to html will also work)
//au run issue as debugger
//https://stackoverflow.com/questions/43379296/how-to-implement-au-run-watch-task-debugging
//shared tasks globally (open issue) https://github.com/Microsoft/vscode/issues/1435
- code filename.js //in vscode terminal opens the file
- json schema is used for intellisense in VSCODE config files //can't we use that concept
- (in typescript files) right click -> format document