Skip to content

Commit

Permalink
Merge pull request #1 from changsi-an/user/cha/variable_processing
Browse files Browse the repository at this point in the history
Allows the child debug adapter to override some variable handling logic.
  • Loading branch information
changsi-an authored Feb 7, 2018
2 parents a4118f6 + ba5bb2a commit 3d48a2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {IChromeDebugAdapterOpts, ChromeDebugSession} from './chromeDebugSession'
import {ChromeConnection} from './chromeConnection';
import * as ChromeUtils from './chromeUtils';
import Crdp from '../../crdp/crdp';
import {PropertyContainer, ScopeContainer, ExceptionContainer, isIndexedPropName} from './variables';
import {PropertyContainer, ScopeContainer, ExceptionContainer, isIndexedPropName, IVariableContainer} from './variables';
import * as variables from './variables';
import {formatConsoleArguments, formatExceptionDetails} from './consoleHelper';
import {StoppedEvent2, ReasonType} from './stoppedEvent';
Expand Down Expand Up @@ -2236,7 +2236,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
}

const evaluateName = ChromeUtils.getEvaluateName(parentEvaluateName, name);
const variablesReference = this._variableHandles.create(new PropertyContainer(object.objectId, evaluateName), context);
const variablesReference = this._variableHandles.create(this.createPropertyContainer(object, evaluateName), context);
return propCountP.then(({ indexedVariables, namedVariables }) => (<DebugProtocol.Variable>{
name,
value,
Expand All @@ -2248,6 +2248,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
}));
}

protected createPropertyContainer(object: Crdp.Runtime.RemoteObject, evaluateName: string): IVariableContainer {
return new PropertyContainer(object.objectId, evaluateName);
}

public createPrimitiveVariable(name: string, object: Crdp.Runtime.RemoteObject, parentEvaluateName?: string, stringify?: boolean): DebugProtocol.Variable {
const value = variables.getRemoteObjectPreview_primitive(object, stringify);
const variable = this.createPrimitiveVariableWithValue(name, value, parentEvaluateName);
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from './debugAdapterInterfaces';

import * as utils from './utils';
import * as telemetry from './telemetry';
import * as variables from './chrome/variables';
import {NullLogger} from './nullLogger';

import Crdp from '../crdp/crdp';
Expand All @@ -43,6 +44,7 @@ export {

utils,
telemetry,
variables,
NullLogger,

Crdp
Expand Down

0 comments on commit 3d48a2c

Please sign in to comment.