提交 ba7170d2 编写于 作者: I isidor

debug tree adpot WorkbenchDataTree

上级 2f10e0f6
...@@ -576,12 +576,12 @@ export interface IResourceResultsNavigationOptions { ...@@ -576,12 +576,12 @@ export interface IResourceResultsNavigationOptions {
openOnFocus: boolean; openOnFocus: boolean;
} }
export class ObjectTreeResourceNavigator<T, TFilterData> extends Disposable { export class TreeResourceNavigator2<T, TFilterData> extends Disposable {
private readonly _openResource: Emitter<IOpenEvent<T>> = new Emitter<IOpenEvent<T>>(); private readonly _openResource: Emitter<IOpenEvent<T>> = new Emitter<IOpenEvent<T>>();
readonly openResource: Event<IOpenEvent<T>> = this._openResource.event; readonly openResource: Event<IOpenEvent<T>> = this._openResource.event;
constructor(private tree: WorkbenchObjectTree<T, TFilterData>, private options?: IResourceResultsNavigationOptions) { constructor(private tree: WorkbenchObjectTree<T, TFilterData> | WorkbenchDataTree<T, TFilterData>, private options?: IResourceResultsNavigationOptions) {
super(); super();
this.registerListeners(); this.registerListeners();
...@@ -633,79 +633,6 @@ export class ObjectTreeResourceNavigator<T, TFilterData> extends Disposable { ...@@ -633,79 +633,6 @@ export class ObjectTreeResourceNavigator<T, TFilterData> extends Disposable {
} }
} }
export class DataTreeResourceNavigator<T> extends Disposable {
private readonly _openResource: Emitter<IOpenResourceOptions> = new Emitter<IOpenResourceOptions>();
readonly openResource: Event<IOpenResourceOptions> = this._openResource.event;
constructor(private tree: DataTree<T, void>, private options?: IResourceResultsNavigationOptions) {
super();
this.registerListeners();
}
private registerListeners(): void {
if (this.options && this.options.openOnFocus) {
this._register(this.tree.onDidChangeFocus(e => this.onFocus(e)));
}
this._register(this.tree.onDidChangeSelection(e => this.onSelection(e)));
}
private onFocus({ payload }: any): void {
const element = this.tree.getFocus();
this.tree.setSelection(element /*, { fromFocus: true }*/);
const originalEvent: KeyboardEvent | MouseEvent = payload && payload.originalEvent;
const isMouseEvent = payload && payload.origin === 'mouse';
const isDoubleClick = isMouseEvent && originalEvent && originalEvent.detail === 2;
const preventOpen = payload && payload.preventOpenOnFocus;
if (!preventOpen && (!isMouseEvent || /*this.tree.openOnSingleClick ||*/ isDoubleClick)) {
this._openResource.fire({
editorOptions: {
preserveFocus: true,
pinned: false,
revealIfVisible: true
},
sideBySide: false,
element,
payload
});
}
}
private onSelection({ payload }: any): void {
if (payload && payload.fromFocus) {
return;
}
const originalEvent: KeyboardEvent | MouseEvent = payload && payload.originalEvent;
const isMouseEvent = payload && payload.origin === 'mouse';
const isDoubleClick = isMouseEvent && originalEvent && originalEvent.detail === 2;
if (!isMouseEvent || /*this.tree.openOnSingleClick ||*/ isDoubleClick) {
if (isDoubleClick && originalEvent) {
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const isFromKeyboard = payload && payload.origin === 'keyboard';
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey || originalEvent.altKey));
const preserveFocus = !((isFromKeyboard && (!payload || !payload.preserveFocus)) || isDoubleClick || (payload && payload.focusEditor));
this._openResource.fire({
editorOptions: {
preserveFocus,
pinned: isDoubleClick,
revealIfVisible: true
},
sideBySide,
element: this.tree.getSelection()[0],
payload
});
}
}
}
export interface IHighlighter { export interface IHighlighter {
getHighlights(tree: ITree, element: any, pattern: string): FuzzyScore; getHighlights(tree: ITree, element: any, pattern: string): FuzzyScore;
getHighlightsStorageKey?(element: any): any; getHighlightsStorageKey?(element: any): any;
......
...@@ -25,12 +25,13 @@ import { ltrim } from 'vs/base/common/strings'; ...@@ -25,12 +25,13 @@ import { ltrim } from 'vs/base/common/strings';
import { RunOnceScheduler } from 'vs/base/common/async'; import { RunOnceScheduler } from 'vs/base/common/async';
import { ResourceLabel, IResourceLabel, IResourceLabelOptions } from 'vs/workbench/browser/labels'; import { ResourceLabel, IResourceLabel, IResourceLabelOptions } from 'vs/workbench/browser/labels';
import { FileKind } from 'vs/platform/files/common/files'; import { FileKind } from 'vs/platform/files/common/files';
import { DataTree, IDataSource } from 'vs/base/browser/ui/tree/dataTree'; import { IDataSource } from 'vs/base/browser/ui/tree/dataTree';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree'; import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { DataTreeResourceNavigator } from 'vs/platform/list/browser/listService'; import { WorkbenchDataTree, IListService, TreeResourceNavigator2 } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
const SMART = true; const SMART = true;
...@@ -357,7 +358,7 @@ export class LoadedScriptsView extends ViewletPanel { ...@@ -357,7 +358,7 @@ export class LoadedScriptsView extends ViewletPanel {
private treeContainer: HTMLElement; private treeContainer: HTMLElement;
private loadedScriptsItemType: IContextKey<string>; private loadedScriptsItemType: IContextKey<string>;
private tree: DataTree<any>; private tree: WorkbenchDataTree<any>;
private changeScheduler: RunOnceScheduler; private changeScheduler: RunOnceScheduler;
private treeNeedsRefreshOnVisible: boolean; private treeNeedsRefreshOnVisible: boolean;
...@@ -368,10 +369,12 @@ export class LoadedScriptsView extends ViewletPanel { ...@@ -368,10 +369,12 @@ export class LoadedScriptsView extends ViewletPanel {
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
@IEditorService private editorService: IEditorService, @IEditorService private editorService: IEditorService,
@IContextKeyService contextKeyService: IContextKeyService, @IContextKeyService private contextKeyService: IContextKeyService,
@IWorkspaceContextService private contextService: IWorkspaceContextService, @IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService, @IEnvironmentService private environmentService: IEnvironmentService,
@IDebugService private debugService: IDebugService @IDebugService private debugService: IDebugService,
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) { ) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService); super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('loadedScriptsSection', "Loaded Scripts Section") }, keybindingService, contextMenuService, configurationService);
this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService); this.loadedScriptsItemType = CONTEXT_LOADED_SCRIPTS_ITEM_TYPE.bindTo(contextKeyService);
...@@ -385,7 +388,7 @@ export class LoadedScriptsView extends ViewletPanel { ...@@ -385,7 +388,7 @@ export class LoadedScriptsView extends ViewletPanel {
const root = new RootTreeItem(this.debugService.getModel(), this.environmentService, this.contextService); const root = new RootTreeItem(this.debugService.getModel(), this.environmentService, this.contextService);
this.tree = new DataTree(this.treeContainer, new LoadedScriptsDelegate(), this.tree = new WorkbenchDataTree(this.treeContainer, new LoadedScriptsDelegate(),
[ [
this.instantiationService.createInstance(LoadedScriptsRenderer) this.instantiationService.createInstance(LoadedScriptsRenderer)
], ],
...@@ -394,7 +397,8 @@ export class LoadedScriptsView extends ViewletPanel { ...@@ -394,7 +397,8 @@ export class LoadedScriptsView extends ViewletPanel {
accessibilityProvider: new LoadedSciptsAccessibilityProvider(), accessibilityProvider: new LoadedSciptsAccessibilityProvider(),
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'loadedScriptsAriaLabel' }, "Debug Loaded Scripts"), ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'loadedScriptsAriaLabel' }, "Debug Loaded Scripts"),
identityProvider: element => element.getId() identityProvider: element => element.getId()
} },
this.contextKeyService, this.listService, this.themeService, this.configurationService
); );
this.changeScheduler = new RunOnceScheduler(() => { this.changeScheduler = new RunOnceScheduler(() => {
...@@ -405,7 +409,7 @@ export class LoadedScriptsView extends ViewletPanel { ...@@ -405,7 +409,7 @@ export class LoadedScriptsView extends ViewletPanel {
}, 300); }, 300);
this.disposables.push(this.changeScheduler); this.disposables.push(this.changeScheduler);
const loadedScriptsNavigator = new DataTreeResourceNavigator(this.tree); const loadedScriptsNavigator = new TreeResourceNavigator2(this.tree);
this.disposables.push(loadedScriptsNavigator); this.disposables.push(loadedScriptsNavigator);
this.disposables.push(loadedScriptsNavigator.openResource(e => { this.disposables.push(loadedScriptsNavigator.openResource(e => {
if (e.element instanceof BaseTreeItem) { if (e.element instanceof BaseTreeItem) {
......
...@@ -25,12 +25,13 @@ import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/v ...@@ -25,12 +25,13 @@ import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/v
import { ILabelService } from 'vs/platform/label/common/label'; import { ILabelService } from 'vs/platform/label/common/label';
import { DebugSession } from 'vs/workbench/parts/debug/electron-browser/debugSession'; import { DebugSession } from 'vs/workbench/parts/debug/electron-browser/debugSession';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { DataTree, IDataSource } from 'vs/base/browser/ui/tree/dataTree'; import { IDataSource } from 'vs/base/browser/ui/tree/dataTree';
import { ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/abstractTree'; import { ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/abstractTree';
import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem'; import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree'; import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { DataTreeResourceNavigator } from 'vs/platform/list/browser/listService'; import { TreeResourceNavigator2, WorkbenchDataTree, IListService } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
const $ = dom.$; const $ = dom.$;
...@@ -45,7 +46,7 @@ export class CallStackView extends ViewletPanel { ...@@ -45,7 +46,7 @@ export class CallStackView extends ViewletPanel {
private ignoreSelectionChangedEvent: boolean; private ignoreSelectionChangedEvent: boolean;
private callStackItemType: IContextKey<string>; private callStackItemType: IContextKey<string>;
private dataSource: CallStackDataSource; private dataSource: CallStackDataSource;
private tree: DataTree<CallStackItem>; private tree: WorkbenchDataTree<CallStackItem>;
private contributedContextMenu: IMenu; private contributedContextMenu: IMenu;
constructor( constructor(
...@@ -57,7 +58,9 @@ export class CallStackView extends ViewletPanel { ...@@ -57,7 +58,9 @@ export class CallStackView extends ViewletPanel {
@IEditorService private editorService: IEditorService, @IEditorService private editorService: IEditorService,
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
@IMenuService menuService: IMenuService, @IMenuService menuService: IMenuService,
@IContextKeyService contextKeyService: IContextKeyService @IContextKeyService private contextKeyService: IContextKeyService,
@IThemeService private themeService: IThemeService,
@IListService private listService: IListService
) { ) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService); super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section") }, keybindingService, contextMenuService, configurationService);
this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService); this.callStackItemType = CONTEXT_CALLSTACK_ITEM_TYPE.bindTo(contextKeyService);
...@@ -100,7 +103,7 @@ export class CallStackView extends ViewletPanel { ...@@ -100,7 +103,7 @@ export class CallStackView extends ViewletPanel {
const treeContainer = renderViewTree(container); const treeContainer = renderViewTree(container);
this.dataSource = new CallStackDataSource(this.debugService); this.dataSource = new CallStackDataSource(this.debugService);
this.tree = new DataTree(treeContainer, new CallStackDelegate(), [ this.tree = new WorkbenchDataTree(treeContainer, new CallStackDelegate(), [
new SessionsRenderer(), new SessionsRenderer(),
new ThreadsRenderer(), new ThreadsRenderer(),
this.instantiationService.createInstance(StackFramesRenderer), this.instantiationService.createInstance(StackFramesRenderer),
...@@ -110,9 +113,9 @@ export class CallStackView extends ViewletPanel { ...@@ -110,9 +113,9 @@ export class CallStackView extends ViewletPanel {
], this.dataSource, { ], this.dataSource, {
accessibilityProvider: new CallStackAccessibilityProvider(), accessibilityProvider: new CallStackAccessibilityProvider(),
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel' }, "Debug Call Stack"), ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel' }, "Debug Call Stack"),
}); }, this.contextKeyService, this.listService, this.themeService, this.configurationService);
const callstackNavigator = new DataTreeResourceNavigator(this.tree); const callstackNavigator = new TreeResourceNavigator2(this.tree);
this.disposables.push(callstackNavigator); this.disposables.push(callstackNavigator);
this.disposables.push(callstackNavigator.openResource(e => { this.disposables.push(callstackNavigator.openResource(e => {
if (this.ignoreSelectionChangedEvent) { if (this.ignoreSelectionChangedEvent) {
......
...@@ -47,7 +47,7 @@ import { FocusSessionActionItem } from 'vs/workbench/parts/debug/browser/debugAc ...@@ -47,7 +47,7 @@ import { FocusSessionActionItem } from 'vs/workbench/parts/debug/browser/debugAc
import { CompletionContext, CompletionList, CompletionProviderRegistry } from 'vs/editor/common/modes'; import { CompletionContext, CompletionList, CompletionProviderRegistry } from 'vs/editor/common/modes';
import { first } from 'vs/base/common/arrays'; import { first } from 'vs/base/common/arrays';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { DataTree, IDataSource } from 'vs/base/browser/ui/tree/dataTree'; import { IDataSource } from 'vs/base/browser/ui/tree/dataTree';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { Variable, Expression, SimpleReplElement, RawObjectReplElement } from 'vs/workbench/parts/debug/common/debugModel'; import { Variable, Expression, SimpleReplElement, RawObjectReplElement } from 'vs/workbench/parts/debug/common/debugModel';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
...@@ -64,6 +64,8 @@ import { ReplCollapseAllAction } from 'vs/workbench/parts/debug/browser/debugAct ...@@ -64,6 +64,8 @@ import { ReplCollapseAllAction } from 'vs/workbench/parts/debug/browser/debugAct
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { removeAnsiEscapeCodes, isFullWidthCharacter, endsWith } from 'vs/base/common/strings'; import { removeAnsiEscapeCodes, isFullWidthCharacter, endsWith } from 'vs/base/common/strings';
import { WorkbenchDataTree, IListService } from 'vs/platform/list/browser/listService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
const $ = dom.$; const $ = dom.$;
...@@ -89,7 +91,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati ...@@ -89,7 +91,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
private static readonly REPL_INPUT_MAX_HEIGHT = 170; private static readonly REPL_INPUT_MAX_HEIGHT = 170;
private history: HistoryNavigator<string>; private history: HistoryNavigator<string>;
private tree: DataTree<IReplElement>; private tree: WorkbenchDataTree<IReplElement>;
private dataSource: ReplDataSource; private dataSource: ReplDataSource;
private container: HTMLElement; private container: HTMLElement;
private treeContainer: HTMLElement; private treeContainer: HTMLElement;
...@@ -112,7 +114,9 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati ...@@ -112,7 +114,9 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
@IModelService private modelService: IModelService, @IModelService private modelService: IModelService,
@IContextKeyService private contextKeyService: IContextKeyService, @IContextKeyService private contextKeyService: IContextKeyService,
@ICodeEditorService codeEditorService: ICodeEditorService, @ICodeEditorService codeEditorService: ICodeEditorService,
@IContextMenuService private contextMenuService: IContextMenuService @IContextMenuService private contextMenuService: IContextMenuService,
@IListService private listService: IListService,
@IConfigurationService private configurationService: IConfigurationService
) { ) {
super(REPL_ID, telemetryService, themeService, storageService); super(REPL_ID, telemetryService, themeService, storageService);
...@@ -320,7 +324,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati ...@@ -320,7 +324,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this.createReplInput(this.container); this.createReplInput(this.container);
this.dataSource = new ReplDataSource(); this.dataSource = new ReplDataSource();
this.tree = new DataTree(this.treeContainer, new ReplDelegate(), [ this.tree = new WorkbenchDataTree(this.treeContainer, new ReplDelegate(), [
this.instantiationService.createInstance(VariablesRenderer), this.instantiationService.createInstance(VariablesRenderer),
this.instantiationService.createInstance(ReplSimpleElementsRenderer), this.instantiationService.createInstance(ReplSimpleElementsRenderer),
new ReplExpressionsRenderer(), new ReplExpressionsRenderer(),
...@@ -328,7 +332,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati ...@@ -328,7 +332,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
], this.dataSource, { ], this.dataSource, {
ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel"), ariaLabel: nls.localize('replAriaLabel', "Read Eval Print Loop Panel"),
accessibilityProvider: new ReplAccessibilityProvider() accessibilityProvider: new ReplAccessibilityProvider()
}); }, this.contextKeyService, this.listService, this.themeService, this.configurationService);
this.toDispose.push(this.tree.onContextMenu(e => this.onContextMenu(e))); this.toDispose.push(this.tree.onContextMenu(e => this.onContextMenu(e)));
// Make sure to select the session if debugging is already active // Make sure to select the session if debugging is already active
......
...@@ -19,7 +19,7 @@ import { CopyValueAction, CopyEvaluatePathAction } from 'vs/workbench/parts/debu ...@@ -19,7 +19,7 @@ import { CopyValueAction, CopyEvaluatePathAction } from 'vs/workbench/parts/debu
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet'; import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { DataTree, IDataSource } from 'vs/base/browser/ui/tree/dataTree'; import { IDataSource } from 'vs/base/browser/ui/tree/dataTree';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { ITreeContextMenuEvent, ITreeMouseEvent } from 'vs/base/browser/ui/tree/abstractTree'; import { ITreeContextMenuEvent, ITreeMouseEvent } from 'vs/base/browser/ui/tree/abstractTree';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
...@@ -27,6 +27,8 @@ import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree'; ...@@ -27,6 +27,8 @@ import { ITreeRenderer, ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Emitter } from 'vs/base/common/event'; import { Emitter } from 'vs/base/common/event';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { WorkbenchDataTree, IListService } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
const $ = dom.$; const $ = dom.$;
...@@ -39,7 +41,7 @@ export class VariablesView extends ViewletPanel { ...@@ -39,7 +41,7 @@ export class VariablesView extends ViewletPanel {
private onFocusStackFrameScheduler: RunOnceScheduler; private onFocusStackFrameScheduler: RunOnceScheduler;
private needsRefresh: boolean; private needsRefresh: boolean;
private tree: DataTree<IExpression | IScope>; private tree: WorkbenchDataTree<IExpression | IScope>;
constructor( constructor(
options: IViewletViewOptions, options: IViewletViewOptions,
...@@ -48,7 +50,9 @@ export class VariablesView extends ViewletPanel { ...@@ -48,7 +50,9 @@ export class VariablesView extends ViewletPanel {
@IKeybindingService keybindingService: IKeybindingService, @IKeybindingService keybindingService: IKeybindingService,
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
@IContextKeyService private contextKeyService: IContextKeyService @IContextKeyService private contextKeyService: IContextKeyService,
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) { ) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService); super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService, configurationService);
...@@ -63,11 +67,12 @@ export class VariablesView extends ViewletPanel { ...@@ -63,11 +67,12 @@ export class VariablesView extends ViewletPanel {
dom.addClass(container, 'debug-variables'); dom.addClass(container, 'debug-variables');
const treeContainer = renderViewTree(container); const treeContainer = renderViewTree(container);
this.tree = new DataTree(treeContainer, new VariablesDelegate(), [this.instantiationService.createInstance(VariablesRenderer), new ScopesRenderer()], this.tree = new WorkbenchDataTree(treeContainer, new VariablesDelegate(),
[this.instantiationService.createInstance(VariablesRenderer), new ScopesRenderer()],
new VariablesDataSource(this.debugService), { new VariablesDataSource(this.debugService), {
ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"), ariaLabel: nls.localize('variablesAriaTreeLabel', "Debug Variables"),
accessibilityProvider: new VariablesAccessibilityProvider() accessibilityProvider: new VariablesAccessibilityProvider()
}); }, this.contextKeyService, this.listService, this.themeService, this.configurationService);
CONTEXT_VARIABLES_FOCUSED.bindTo(this.contextKeyService.createScoped(treeContainer)); CONTEXT_VARIABLES_FOCUSED.bindTo(this.contextKeyService.createScoped(treeContainer));
......
...@@ -20,12 +20,14 @@ import { Separator } from 'vs/base/browser/ui/actionbar/actionbar'; ...@@ -20,12 +20,14 @@ import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { renderExpressionValue, renderViewTree, IInputBoxOptions, AbstractExpressionsRenderer, IExpressionTemplateData } from 'vs/workbench/parts/debug/browser/baseDebugView'; import { renderExpressionValue, renderViewTree, IInputBoxOptions, AbstractExpressionsRenderer, IExpressionTemplateData } from 'vs/workbench/parts/debug/browser/baseDebugView';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet'; import { IViewletPanelOptions, ViewletPanel } from 'vs/workbench/browser/parts/views/panelViewlet';
import { DataTree, IDataSource } from 'vs/base/browser/ui/tree/dataTree'; import { IDataSource } from 'vs/base/browser/ui/tree/dataTree';
import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list'; import { IListVirtualDelegate } from 'vs/base/browser/ui/list/list';
import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget'; import { IAccessibilityProvider } from 'vs/base/browser/ui/list/listWidget';
import { ITreeContextMenuEvent, ITreeMouseEvent } from 'vs/base/browser/ui/tree/abstractTree'; import { ITreeContextMenuEvent, ITreeMouseEvent } from 'vs/base/browser/ui/tree/abstractTree';
import { VariablesRenderer, variableSetEmitter } from 'vs/workbench/parts/debug/electron-browser/variablesView'; import { VariablesRenderer, variableSetEmitter } from 'vs/workbench/parts/debug/electron-browser/variablesView';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { WorkbenchDataTree, IListService } from 'vs/platform/list/browser/listService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024; const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
...@@ -33,7 +35,7 @@ export class WatchExpressionsView extends ViewletPanel { ...@@ -33,7 +35,7 @@ export class WatchExpressionsView extends ViewletPanel {
private onWatchExpressionsUpdatedScheduler: RunOnceScheduler; private onWatchExpressionsUpdatedScheduler: RunOnceScheduler;
private needsRefresh: boolean; private needsRefresh: boolean;
private tree: DataTree<IExpression>; private tree: WorkbenchDataTree<IExpression>;
constructor( constructor(
options: IViewletViewOptions, options: IViewletViewOptions,
...@@ -42,7 +44,9 @@ export class WatchExpressionsView extends ViewletPanel { ...@@ -42,7 +44,9 @@ export class WatchExpressionsView extends ViewletPanel {
@IKeybindingService keybindingService: IKeybindingService, @IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService private instantiationService: IInstantiationService, @IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService configurationService: IConfigurationService, @IConfigurationService configurationService: IConfigurationService,
@IContextKeyService private contextKeyService: IContextKeyService @IContextKeyService private contextKeyService: IContextKeyService,
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) { ) {
super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService); super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('watchExpressionsSection', "Watch Expressions Section") }, keybindingService, contextMenuService, configurationService);
...@@ -59,11 +63,11 @@ export class WatchExpressionsView extends ViewletPanel { ...@@ -59,11 +63,11 @@ export class WatchExpressionsView extends ViewletPanel {
const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer); const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer);
this.disposables.push(expressionsRenderer); this.disposables.push(expressionsRenderer);
this.tree = new DataTree(treeContainer, new WatchExpressionsDelegate(), [expressionsRenderer, this.instantiationService.createInstance(VariablesRenderer)], this.tree = new WorkbenchDataTree(treeContainer, new WatchExpressionsDelegate(), [expressionsRenderer, this.instantiationService.createInstance(VariablesRenderer)],
new WatchExpressionsDataSource(this.debugService), { new WatchExpressionsDataSource(this.debugService), {
ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'watchAriaTreeLabel' }, "Debug Watch Expressions"), ariaLabel: nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'watchAriaTreeLabel' }, "Debug Watch Expressions"),
accessibilityProvider: new WatchExpressionsAccessibilityProvider(), accessibilityProvider: new WatchExpressionsAccessibilityProvider(),
}); }, this.contextKeyService, this.listService, this.themeService, this.configurationService);
this.tree.refresh(null); this.tree.refresh(null);
......
...@@ -27,7 +27,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c ...@@ -27,7 +27,7 @@ import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/c
import { Iterator } from 'vs/base/common/iterator'; import { Iterator } from 'vs/base/common/iterator';
import { ITreeElement, ITreeNode } from 'vs/base/browser/ui/tree/tree'; import { ITreeElement, ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { debounceEvent, Relay, Event, Emitter } from 'vs/base/common/event'; import { debounceEvent, Relay, Event, Emitter } from 'vs/base/common/event';
import { WorkbenchObjectTree, ObjectTreeResourceNavigator } from 'vs/platform/list/browser/listService'; import { WorkbenchObjectTree, TreeResourceNavigator2 } from 'vs/platform/list/browser/listService';
import { FilterOptions } from 'vs/workbench/parts/markers/electron-browser/markersFilterOptions'; import { FilterOptions } from 'vs/workbench/parts/markers/electron-browser/markersFilterOptions';
import { IExpression, getEmptyExpression } from 'vs/base/common/glob'; import { IExpression, getEmptyExpression } from 'vs/base/common/glob';
import { mixin, deepClone } from 'vs/base/common/objects'; import { mixin, deepClone } from 'vs/base/common/objects';
...@@ -314,7 +314,7 @@ export class MarkersPanel extends Panel implements IMarkerFilterController { ...@@ -314,7 +314,7 @@ export class MarkersPanel extends Panel implements IMarkerFilterController {
relatedInformationFocusContextKey.set(false); relatedInformationFocusContextKey.set(false);
})); }));
const markersNavigator = this._register(new ObjectTreeResourceNavigator(this.tree, { openOnFocus: true })); const markersNavigator = this._register(new TreeResourceNavigator2(this.tree, { openOnFocus: true }));
this._register(debounceEvent(markersNavigator.openResource, (last, event) => event, 75, true)(options => { this._register(debounceEvent(markersNavigator.openResource, (last, event) => event, 75, true)(options => {
this.openFileAtElement(options.element, options.editorOptions.preserveFocus, options.sideBySide, options.editorOptions.pinned); this.openFileAtElement(options.element, options.editorOptions.preserveFocus, options.sideBySide, options.editorOptions.pinned);
})); }));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册