mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d (#5949)
* Merge from vscode 81d7885dc2e9dc617e1522697a2966bc4025a45d * Fix vs unit tests and hygiene issue * Fix strict null check issue
This commit is contained in:
@@ -8,7 +8,7 @@ import { IListMouseEvent, IListTouchEvent, IListRenderer, IListVirtualDelegate }
|
||||
import { IPagedRenderer, PagedList } from 'vs/base/browser/ui/list/listPaging';
|
||||
import { DefaultStyleController, IListOptions, IMultipleSelectionController, IOpenController, isSelectionRangeChangeEvent, isSelectionSingleChangeEvent, List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { combinedDisposable, Disposable, dispose, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Disposable, dispose, IDisposable, toDisposable, DisposableStore, combinedDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { ITree, ITreeConfiguration, ITreeOptions } from 'vs/base/parts/tree/browser/tree';
|
||||
@@ -78,7 +78,7 @@ export class ListService implements IListService {
|
||||
this._lastFocusedWidget = widget;
|
||||
}
|
||||
|
||||
const result = combinedDisposable([
|
||||
return combinedDisposable(
|
||||
widget.onDidFocus(() => this._lastFocusedWidget = widget),
|
||||
toDisposable(() => this.lists.splice(this.lists.indexOf(registeredList), 1)),
|
||||
widget.onDidDispose(() => {
|
||||
@@ -87,9 +87,7 @@ export class ListService implements IListService {
|
||||
this._lastFocusedWidget = undefined;
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
return result;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,18 +198,18 @@ class WorkbenchOpenController extends Disposable implements IOpenController {
|
||||
}
|
||||
|
||||
function toWorkbenchListOptions<T>(options: IListOptions<T>, configurationService: IConfigurationService, keybindingService: IKeybindingService): [IListOptions<T>, IDisposable] {
|
||||
const disposables: IDisposable[] = [];
|
||||
const disposables = new DisposableStore();
|
||||
const result = { ...options };
|
||||
|
||||
if (options.multipleSelectionSupport !== false && !options.multipleSelectionController) {
|
||||
const multipleSelectionController = new MultipleSelectionController(configurationService);
|
||||
result.multipleSelectionController = multipleSelectionController;
|
||||
disposables.push(multipleSelectionController);
|
||||
disposables.add(multipleSelectionController);
|
||||
}
|
||||
|
||||
const openController = new WorkbenchOpenController(configurationService, options.openController);
|
||||
result.openController = openController;
|
||||
disposables.push(openController);
|
||||
disposables.add(openController);
|
||||
|
||||
if (options.keyboardNavigationLabelProvider) {
|
||||
const tlp = options.keyboardNavigationLabelProvider;
|
||||
@@ -222,7 +220,7 @@ function toWorkbenchListOptions<T>(options: IListOptions<T>, configurationServic
|
||||
};
|
||||
}
|
||||
|
||||
return [result, combinedDisposable(disposables)];
|
||||
return [result, disposables];
|
||||
}
|
||||
|
||||
let sharedListStyleSheet: HTMLStyleElement;
|
||||
@@ -283,7 +281,7 @@ export class WorkbenchList<T> extends List<T> {
|
||||
|
||||
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
|
||||
|
||||
this.disposables.push(combinedDisposable([
|
||||
this.disposables.push(
|
||||
this.contextKeyService,
|
||||
(listService as ListService).register(this),
|
||||
attachListStyler(this, themeService),
|
||||
@@ -301,7 +299,7 @@ export class WorkbenchList<T> extends List<T> {
|
||||
|
||||
this.listHasSelectionOrFocus.set(selection.length > 0 || focus.length > 0);
|
||||
})
|
||||
]));
|
||||
);
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
@@ -324,7 +322,7 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
||||
readonly contextKeyService: IContextKeyService;
|
||||
private readonly configurationService: IConfigurationService;
|
||||
|
||||
private disposables: IDisposable[];
|
||||
private readonly disposables: DisposableStore;
|
||||
|
||||
private _useAltAsMultipleSelectionModifier: boolean;
|
||||
|
||||
@@ -351,7 +349,8 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
||||
}
|
||||
);
|
||||
|
||||
this.disposables = [workbenchListOptionsDisposable];
|
||||
this.disposables = new DisposableStore();
|
||||
this.disposables.add(workbenchListOptionsDisposable);
|
||||
|
||||
this.contextKeyService = createScopedContextKeyService(contextKeyService, this);
|
||||
this.configurationService = configurationService;
|
||||
@@ -361,17 +360,15 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
||||
|
||||
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(configurationService);
|
||||
|
||||
this.disposables.push(combinedDisposable([
|
||||
this.contextKeyService,
|
||||
(listService as ListService).register(this),
|
||||
attachListStyler(this, themeService)
|
||||
]));
|
||||
this.disposables.add(this.contextKeyService);
|
||||
this.disposables.add((listService as ListService).register(this));
|
||||
this.disposables.add(attachListStyler(this, themeService));
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
this.disposables.push(this.configurationService.onDidChangeConfiguration(e => {
|
||||
this.disposables.add(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(multiSelectModifierSettingKey)) {
|
||||
this._useAltAsMultipleSelectionModifier = useAltAsMultipleSelectionModifier(this.configurationService);
|
||||
}
|
||||
@@ -385,7 +382,7 @@ export class WorkbenchPagedList<T> extends PagedList<T> {
|
||||
dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
this.disposables = dispose(this.disposables);
|
||||
this.disposables.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -533,7 +530,7 @@ function massageControllerOptions(options: IControllerOptions): IControllerOptio
|
||||
*/
|
||||
export class WorkbenchTreeController extends DefaultController {
|
||||
|
||||
protected disposables: IDisposable[] = [];
|
||||
protected readonly disposables = new DisposableStore();
|
||||
|
||||
constructor(
|
||||
options: IControllerOptions,
|
||||
@@ -549,7 +546,7 @@ export class WorkbenchTreeController extends DefaultController {
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
this.disposables.push(this.configurationService.onDidChangeConfiguration(e => {
|
||||
this.disposables.add(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration(openModeSettingKey)) {
|
||||
this.setOpenMode(this.getOpenModeSetting());
|
||||
}
|
||||
@@ -561,7 +558,7 @@ export class WorkbenchTreeController extends DefaultController {
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
this.disposables.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user