This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into WIP/eager
- Loading branch information
Showing
8 changed files
with
414 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
import * as DebugProtocol from 'vscode-debugadapter'; | ||
|
||
import {ChromeDebugAdapter} from './chromeDebugAdapter'; | ||
import * as Chrome from './chromeDebugProtocol.d'; | ||
|
||
export interface IVariableContainer { | ||
objectId: string; | ||
expand(adapter: ChromeDebugAdapter, filter?: string, start?: number, count?: number): Promise<DebugProtocol.Variable[]>; | ||
setValue(adapter: ChromeDebugAdapter, name: string, value: string): Promise<string>; | ||
} | ||
|
||
export abstract class BaseVariableContainer implements IVariableContainer { | ||
constructor(public objectId: string) { | ||
} | ||
|
||
public expand(adapter: ChromeDebugAdapter, filter?: string, start?: number, count?: number): Promise<DebugProtocol.Variable[]> { | ||
return adapter.getVariablesForObjectId(this.objectId, filter, start, count); | ||
} | ||
|
||
public abstract setValue(adapter: ChromeDebugAdapter, name: string, value: string): Promise<string>; | ||
} | ||
|
||
export class PropertyContainer extends BaseVariableContainer { | ||
public setValue(adapter: ChromeDebugAdapter, name: string, value: string): Promise<string> { | ||
return adapter._setPropertyValue(this.objectId, name, value); | ||
} | ||
} | ||
|
||
export class ScopeContainer extends BaseVariableContainer { | ||
public thisObj: Chrome.Runtime.RemoteObject; | ||
|
||
private _frameId: string; | ||
private _scopeIndex: number; | ||
|
||
public constructor(frameId: string, scopeIndex: number, objectId: string, thisObj?: Chrome.Runtime.RemoteObject) { | ||
super(objectId); | ||
this.thisObj = thisObj; | ||
this._frameId = frameId; | ||
this._scopeIndex = scopeIndex; | ||
} | ||
|
||
/** | ||
* Call super then insert the 'this' object if needed | ||
*/ | ||
public expand(adapter: ChromeDebugAdapter, filter?: string, start?: number, count?: number): Promise<DebugProtocol.Variable[]> { | ||
// No filtering in scopes right now | ||
return super.expand(adapter, 'all', start, count).then(variables => { | ||
if (this.thisObj) { | ||
// If this is a scope that should have the 'this', prop, insert it at the top of the list | ||
return adapter.propertyDescriptorToVariable(<any>{ name: 'this', value: this.thisObj }).then(thisObjVar => { | ||
variables.unshift(thisObjVar); | ||
return variables; | ||
}); | ||
} else { | ||
return variables; | ||
} | ||
}); | ||
} | ||
|
||
public setValue(adapter: ChromeDebugAdapter, name: string, value: string): Promise<string> { | ||
return adapter._setVariableValue(this._frameId, this._scopeIndex, name, value); | ||
} | ||
} | ||
|
||
export function isIndexedPropName(name: string): boolean { | ||
return !isNaN(parseInt(name, 10)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"spaces" | ||
], | ||
"align": [ | ||
true, | ||
false, | ||
"statements" | ||
], | ||
"ban": false, | ||
|