Computer
Visual Studio Code
search
Visual Studio Code
, VS Code
Precautions
Non-Medical
Not for Medical Care
The author uses several software packages and programming languages to develop FPnotebook content
For convenience, a dozen pages in FPNotebook are dedicated to quick notes on content creation
Pitfalls
Node
Wrong Node version
Use LTS (latest stable version), which in 2016 is roughly 4.5 (not 5+)
Typescript
Make sure the environ paths are correct, and that npm path precedes typesccript path
Path for typescript should be most recent version
"Edit Environmental Variables > System Variables > Paths" (Windows)
C:\Users[USERNAME]\AppData\Roaming\npm
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8
Technique
Starting
Open from command prompt
Type "code ."
Technique
IDE Navigation
Command palette
F1 or Ctrl-P
Opens command palette
?
Help (type within Command palette)
>
Show and run commands (type within Command palette)
Ctrl-Shift-P opens the palette to run tasks/commands
!
Errors and warnings (type within Command palette)
#
Open symbol (type within Command palette)
git
Run git command
task
Run task
task terminate
Terminate task
@
Go to symbol (or "@:" to go to symbol by category)
:
Go to line
Search
Ctrl-P
Search/Navigate for file
Ctrl-Shift-F
Search within all files in current folder
Ctrl-Shift-J
Advanced search option settings
Definitions
F12
Go to definition
Alt-F12
Peek Definition
Side-by-side windows
Ctrl-B
Toggle explorer side-bar visibility
Ctrl-click on a second file in the "explorer" side-bar
Open selected file in side-by-side panel
Ctrl-\
Split the current active panel into two parts
Ctrl-1, Ctrl-2, or Ctrl-3
Switch between panels
Text Editor
Shift-Alt-F
Auto-format code
Ctrl-/
Toggle line comment
Alt-Arrow (up or down)
Moves the current line (or selection) up or down
Ctrl-Space
Opens intellisense (including custom snippets for the given file type)
Technique
IDE Customization in
Gene
ral
Extension
Type "extension"
Helpful extensions
Angular 2 Snippets
https://github.com/johnpapa/vscode-angular2-snippets
Path Intellisense
https://github.com/ChristianKohler/PathIntellisense
Html tag wrap (htmltagwrap)
https://marketplace.visualstudio.com/items?itemName=bradgashler.htmltagwrap
Use Alt-W to surround with... (then type div or other tag)
Helpful settings
files.autosave
files.exclude
Exclude files from the "explorer" side bar
terminal.integrated.shell.windows
"\\windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
Technique
IDE Customization for Angular 2
Global setup
Add Snippets (
https://github.com/johnpapa/vscode-angular2-snippets
)
Angular project setup
See
AngularJs
Use a starter project
Angular quickstart github
Angular 2 CLI
Delete .git if starter project was cloned
Git install (and git add -A, git commit -m, git push origin master)
Npm install
Copy .vscode directory (launch, settings, tasks) from prior project if already setup (see below)
Set "tsconfig.json", watch=true (as below), "sourceMap": true
Start task tsc (typescript compiler) in VS Code (see below)
Once you have established a stable, customized base project, save to a git repo as base, or create Yoman project
Typescript compilation automation (change from node script to VS task that compiles on save)
Set "tsconfig.json", watch=true
Enter "Tasks: Configure Task Runner", and default TSC task will be added
Change package.json node scripts to not run tsc, as this will now be run as VS Code task
Debugging setup to launch liteserver on run (F5)
Open debug tab and click settings icon (cog) to create the launch.json file
In launch.json, set "program": "node_modules/lite-server/bin/lite-server"
Debugging setup to launch in chrome (allows for chrome breakpoints to be hit in the VS Code debug window)
Install chrome extension in VS Code
Modify tsconfig.json, setting "sourceMap": true
Add another config section to launch.json with following settings
"name": "Launch localhost with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:9222/",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
Running
Close all chrome instances before
Running
Use Task manager, powershell (stop-process -processname chrome) or cmd (killall chrome)
References
http://stackoverflow.com/questions/36494938/debug-run-angular2-typescript-with-visual-studio-code
References
https://dzone.com/articles/completing-the-angular-2-quick-start-in-vs-code-1
Technique
Tools
Git Setup
Node Tools
Install node and NPM
Task Runner
Type "configure" to "configure task runner" and this will create tasks.json
Ctrl-Shift-B runs build task
Type your search phrase here