Merge master -> v0.10.0
This commit is contained in:
Коммит
2db4f51d85
18
README.md
18
README.md
|
@ -4,8 +4,13 @@ A Visual Studio Code extension to debug your Javascript code on targets that sup
|
|||
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/extension/`, `git clone` this repository
|
||||
* In `C:/Users/<username>/.vscode/extensions/`, `git clone` this repository
|
||||
|
||||
### OS X
|
||||
* `git clone` this repository
|
||||
|
@ -13,8 +18,9 @@ When this extension is published to the Code extension gallery, installing will
|
|||
* 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. Run `npm install` and `npm install -g gulp`
|
||||
2. Run `gulp build`
|
||||
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.
|
||||
|
@ -32,7 +38,7 @@ An example `launch.json` config.
|
|||
"name": "test chrome",
|
||||
// This is required to use this extension
|
||||
"type": "webkit",
|
||||
// Set either "program" or "runtimeArgs" - "program" if you want to open a local file using the file:/// protocol, or "runtimeArgs" (which must be an array) if you want to open a url
|
||||
// Set either "program" or "runtimeArgs" - "program" if you want to open a local file using the file:/// protocol, or "runtimeArgs" (which must be an array of one item) if you want to open a url. This is temporary until Code supports custom fields here - later there will just be one field for files and urls.
|
||||
"program": "out/client/index.html",
|
||||
//"runtimeArgs": ["http://localhost:8080/out/client/index.html"],
|
||||
// You can set breakpoints in and debug your source files if this is true
|
||||
|
@ -44,6 +50,8 @@ An example `launch.json` config.
|
|||
}
|
||||
```
|
||||
|
||||
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
|
||||
|
@ -57,11 +65,11 @@ An example `launch.json` config.
|
|||
```
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"openDebug": "server=4712",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "attach to chrome",
|
||||
"type": "webkit",
|
||||
// Or whatever port you used in the step above
|
||||
"port": 9222
|
||||
}
|
||||
]
|
||||
|
|
|
@ -258,7 +258,7 @@ suite('WebKitDebugAdapter', () => {
|
|||
});
|
||||
|
||||
function attach(wkda: _WebKitDebugAdapter): Promise<void> {
|
||||
return wkda.attach({ address: 'localhost', port: 9222 });
|
||||
return wkda.attach({ address: '127.0.0.1', port: 9222, cwd: '.' });
|
||||
}
|
||||
|
||||
class DefaultMockWebKitConnection {
|
||||
|
|
|
@ -144,8 +144,8 @@ export class Logger {
|
|||
private _isServer: boolean;
|
||||
private _logSeparatorTimeoutToken: NodeJS.Timer;
|
||||
|
||||
public static log(msg: string): void {
|
||||
if (this._logger) this._logger._log(msg);
|
||||
public static log(msg: string, timestamp = true): void {
|
||||
if (this._logger) this._logger._log(msg, timestamp);
|
||||
}
|
||||
|
||||
public static init(isServer: boolean): void {
|
||||
|
@ -158,9 +158,15 @@ export class Logger {
|
|||
this._isServer = isServer;
|
||||
}
|
||||
|
||||
private _log(msg: string): void {
|
||||
private _log(msg: string, timestamp: boolean): void {
|
||||
if (this._isServer && Logger.ALLOW_LOGGING) {
|
||||
console.log(msg);
|
||||
if (timestamp) {
|
||||
const d = new Date();
|
||||
const timeStamp = `[${d.getMinutes()}:${d.getSeconds()}:${d.getMilliseconds()}]`;
|
||||
console.log(timeStamp + msg);
|
||||
} else {
|
||||
console.log(msg);
|
||||
}
|
||||
|
||||
if (this._logSeparatorTimeoutToken) {
|
||||
clearTimeout(this._logSeparatorTimeoutToken);
|
||||
|
@ -185,12 +191,6 @@ export function webkitUrlToClientUrl(cwd: string, url: string): string {
|
|||
return '';
|
||||
}
|
||||
|
||||
// If a file:/// url is loaded in the client, just send the absolute path of the file
|
||||
const prefix = 'file:///';
|
||||
if (url.substr(0, prefix.length) === prefix) {
|
||||
return canonicalizeUrl(url);
|
||||
}
|
||||
|
||||
// If we don't have the client workingDirectory for some reason, don't try to map the url to a client path
|
||||
if (!cwd) {
|
||||
return '';
|
||||
|
|
|
@ -128,7 +128,7 @@ export class WebKitConnection {
|
|||
}
|
||||
|
||||
public _attach(port: number): Promise<void> {
|
||||
return Utilities.retryAsync(() => getUrl(`http://localhost:${port}/json`), 7)
|
||||
return Utilities.retryAsync(() => getUrl(`http://127.0.0.1:${port}/json`), 7)
|
||||
.then(jsonResponse => {
|
||||
const pages = JSON.parse(jsonResponse).filter(target => target.type === 'page');
|
||||
if (!pages.length) return Promise.reject('No valid pages found');
|
||||
|
|
Загрузка…
Ссылка в новой задаче