II. 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
III. Pitfalls
- Node
- Wrong Node version
- Use LTS (latest stable version), which in 2016 is roughly 4.5 (not 5+)
- Wrong Node version
- 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
IV. Technique: Starting
- Open from command prompt
- Type "code ."
V. 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
- F1 or Ctrl-P
- Search
- Ctrl-P
- Search/Navigate for file
- Ctrl-Shift-F
- Search within all files in current folder
- Ctrl-Shift-J
- Advanced search option settings
- Ctrl-P
- Definitions
- F12
- Go to definition
- Alt-F12
- Peek Definition
- F12
- 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
- Ctrl-B
- 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)
- Shift-Alt-F
VI. Technique: IDE Customization in General
- Extension
- Type "extension"
- Helpful extensions
- Angular 2 Snippets
- Path Intellisense
- 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"
VII. 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)
- Close all chrome instances before Running
- References
- References
VIII. 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