|
@@ -13,7 +13,7 @@ export class Variables extends Panel {
|
|
constructor(options: Variables.IOptions = {}) {
|
|
constructor(options: Variables.IOptions = {}) {
|
|
super();
|
|
super();
|
|
|
|
|
|
- this.model = new Variables.IModel(MOCK_DATA_ROW.scopes);
|
|
|
|
|
|
+ this.model = new Variables.IModel();
|
|
this.addClass('jp-DebuggerVariables');
|
|
this.addClass('jp-DebuggerVariables');
|
|
this.title.label = 'Variables';
|
|
this.title.label = 'Variables';
|
|
|
|
|
|
@@ -54,9 +54,9 @@ export namespace Variables {
|
|
export interface IModel {}
|
|
export interface IModel {}
|
|
|
|
|
|
export class IModel implements IModel {
|
|
export class IModel implements IModel {
|
|
- constructor(model: IScope[]) {
|
|
|
|
|
|
+ constructor(model?: IScope[] | null) {
|
|
this._state = model;
|
|
this._state = model;
|
|
- this._currentScope = this._state[0];
|
|
|
|
|
|
+ this._currentScope = !!this._state ? this._state[0] : null;
|
|
}
|
|
}
|
|
|
|
|
|
get currentScope(): IScope {
|
|
get currentScope(): IScope {
|
|
@@ -68,13 +68,18 @@ export namespace Variables {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._currentScope = value;
|
|
this._currentScope = value;
|
|
- this._variablesChanged.emit(value.variables);
|
|
|
|
|
|
+ const variables = !!value ? value.variables : [];
|
|
|
|
+ this._variablesChanged.emit(variables);
|
|
}
|
|
}
|
|
|
|
|
|
get currentChanged(): ISignal<this, IVariable> {
|
|
get currentChanged(): ISignal<this, IVariable> {
|
|
return this._currentChanged;
|
|
return this._currentChanged;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ get scopesChanged(): ISignal<this, IScope[]> {
|
|
|
|
+ return this._scopesChanged;
|
|
|
|
+ }
|
|
|
|
+
|
|
get currentVariable(): IVariable {
|
|
get currentVariable(): IVariable {
|
|
return this._currentVariable;
|
|
return this._currentVariable;
|
|
}
|
|
}
|
|
@@ -94,19 +99,28 @@ export namespace Variables {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this._filterState = value;
|
|
this._filterState = value;
|
|
- this._variablesChanged.emit(this._filterVariables());
|
|
|
|
|
|
+ if (this._currentScope) {
|
|
|
|
+ this._variablesChanged.emit(this._filterVariables());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
get scopes(): IScope[] {
|
|
get scopes(): IScope[] {
|
|
return this._state;
|
|
return this._state;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ set scopes(scopes: IScope[]) {
|
|
|
|
+ this._state = scopes;
|
|
|
|
+ this._scopesChanged.emit(scopes);
|
|
|
|
+ this.currentScope = !!scopes ? scopes[0] : null;
|
|
|
|
+ }
|
|
|
|
+
|
|
get variables(): IVariable[] {
|
|
get variables(): IVariable[] {
|
|
if (this._filterState) {
|
|
if (this._filterState) {
|
|
return this._filterVariables();
|
|
return this._filterVariables();
|
|
}
|
|
}
|
|
- return this._currentScope.variables;
|
|
|
|
|
|
+ return this._currentScope ? this._currentScope.variables : [];
|
|
}
|
|
}
|
|
|
|
+
|
|
set variables(variables: IVariable[]) {
|
|
set variables(variables: IVariable[]) {
|
|
this._currentScope.variables = variables;
|
|
this._currentScope.variables = variables;
|
|
}
|
|
}
|
|
@@ -134,83 +148,8 @@ export namespace Variables {
|
|
private _filterState: string = '';
|
|
private _filterState: string = '';
|
|
protected _state: IScope[];
|
|
protected _state: IScope[];
|
|
private _currentScope: IScope;
|
|
private _currentScope: IScope;
|
|
|
|
+ private _scopesChanged = new Signal<this, IScope[]>(this);
|
|
}
|
|
}
|
|
|
|
|
|
export interface IOptions extends Panel.IOptions {}
|
|
export interface IOptions extends Panel.IOptions {}
|
|
}
|
|
}
|
|
-
|
|
|
|
-const MOCK_DATA_ROW = {
|
|
|
|
- scopes: [
|
|
|
|
- {
|
|
|
|
- name: 'local',
|
|
|
|
- variables: [
|
|
|
|
- {
|
|
|
|
- name: 'test 1',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def test1(): return 0'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'Classtest',
|
|
|
|
- value: 'class',
|
|
|
|
- type: 'class',
|
|
|
|
- variablesReference: 1,
|
|
|
|
- description: 'def test2(): return 0'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'test 3',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def test1(): return 0'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'test 4',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def test2(): return 0'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'test 5',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def test1(): return 0'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'test 6',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def test2(): return 0'
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'global',
|
|
|
|
- variables: [
|
|
|
|
- {
|
|
|
|
- name: 'exampleGlobal',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def exampleGlobal(): return 0'
|
|
|
|
- }
|
|
|
|
- ] as Variables.IVariable[]
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: 'built-in',
|
|
|
|
- variables: [
|
|
|
|
- {
|
|
|
|
- name: 'exmapleBuiltIn',
|
|
|
|
- value: 'function()',
|
|
|
|
- type: 'function',
|
|
|
|
- variablesReference: 0,
|
|
|
|
- description: 'def texmapleBuiltIn(): return 0'
|
|
|
|
- }
|
|
|
|
- ] as Variables.IVariable[]
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
-};
|
|
|