A Visual Studio Code extension providing intellisense, debug, and build support for Cordova and Ionic projects.
Перейти к файлу
Rob ab87a72423 Get rid of "opendebug" name 2015-11-04 21:02:13 -08:00
.vscode Get rid of "opendebug" name 2015-11-04 21:02:13 -08:00
adapter Use promise.reject with an Error object instead of string, to ensure we get a stack. 2015-11-04 16:52:15 -08:00
common Implement diagnostic logging to console 2015-11-03 19:50:46 -08:00
test Use promise.reject with an Error object instead of string, to ensure we get a stack. 2015-11-04 16:52:15 -08:00
testapp Get rid of "opendebug" name 2015-11-04 21:02:13 -08:00
typings Trying sinon 2015-10-27 14:09:46 -07:00
webkit Get rid of "opendebug" name 2015-11-04 21:02:13 -08:00
.gitignore init 2015-08-09 13:25:34 -07:00
LICENSE.txt Legal files 2015-11-03 09:53:37 -08:00
README.md Update README with 0.10 changes, fix test 2015-11-04 12:24:16 -08:00
ThirdPartyNotices.txt Legal files 2015-11-03 09:53:37 -08:00
gulpfile.js Fix sourcemaps 2015-10-26 15:36:35 -07:00
package.json Get rid of "opendebug" name 2015-11-04 21:02:13 -08:00
tsconfig.json Exclude node_modules from VS Code checking 2015-11-04 15:53:52 -08:00
tsd.json Sourcemaps for setBreakpointsRequest (for source.path) and testapp with TS 2015-10-10 16:02:36 -07:00
tslint.json Add reversedArr test 2015-10-22 09:36:06 -07:00

README.md

vscode-webkit-debug

A Visual Studio Code extension to debug your Javascript code on targets that support the WebKit Debug Protocol, such as the Chrome browser.

When this extension is published to the Code extension gallery, installing will be easy! Until then, you need to follow these steps to install it yourself to your user extension directory.

Install

  • Install VS Code from code.visualstudio.com
  • Install Python 2.7 (needed to build one of the npm packages)
  • Install Chrome
  • Install Node

Windows

  • In C:/Users/<username>/.vscode/extensions/, git clone this repository

OS X

  • git clone this repository
  • Run ln -s <path to repo> ~/.vscode/extensions/vsc-webkit
  • You could clone it to the extensions directory if you want, but working with hidden folders in OS X can be a pain.

Then...

  1. cd to the folder you just cloned
  2. Run npm install and npm install -g gulp
  3. Run gulp build

Starting

The extension operates in two modes - it can launch an instance of Chrome navigated to your app, or it can attach to a running instance of Chrome. Just like when using the Node debugger, you configure these modes with a .vscode/launch.json file in the root directory of your project. You can create this file manually, or Code will create one for you if you try to run your project, and it doesn't exist yet.

To use this extension, you must open the folder containing the project you want to work on. (File > Open Folder).

Launch

An example launch.json config.

{
    "version": "0.1.0",
    "configurations": [
        {
            // Name your config something useful
            "name": "launch chrome to index.html",
            // This is required to use this extension
            "type": "webkit",
            // To launch Chrome
            "request": "launch",
            // Set either "file" or "url" - "file" if you want to open a local file using the file:/// protocol, or "url" if you want to open a url.
            "file": "out/client/index.html",
            //"url": ["http://localhost:8080/out/client/index.html"],
            // You can set breakpoints in and debug your source files if this is true
            "sourceMaps": true,
            // Required if sourceMaps is enabled, if your output files are not in the same directory as your source files
            "outDir": "out"
        }
    ]
}

If you want to use Chrome from a different directory, you can also set the "runtimeExecutable" field with a path to the Chrome app.

Attach

You must launch Chrome with remote debugging enabled in order for the extension to attach to it.

  • Right click the Chrome shortcut
  • Click properties
  • In the "target" field, append --remote-debugging-port=9222
  • TODO Directions for OS X?

Launch Chrome and navigate to your page.

An example launch.json config.

{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "attach to chrome",
            "type": "webkit",
            // Or whatever port you used in the step above
            "port": 9222,
            "request": "attach"
        }
    ]
}

Usage

When your launch config is set up, you can debug your project! Pick a launch config from the dropdown on the Debug pane in Code. Press the play button or F5 to start.

Things that should work

  • Setting breakpoints, including in source files when source maps are enabled
  • Stepping, including with the buttons on the Chrome page
  • The Locals pane
  • Debugging eval scripts, script tags, and scripts that are added dynamically
  • Watches
  • The debug console
  • Most console APIs

Unsupported scenarios

  • Debugging webworkers