mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
Merge from vscode bd0efff9e3f36d6b3e1045cee9887003af8034d7
This commit is contained in:
@@ -1477,12 +1477,12 @@ export async function pathsToEditors(paths: IPathData[] | undefined, fileService
|
||||
const editors = await Promise.all(paths.map(async path => {
|
||||
const resource = URI.revive(path.fileUri);
|
||||
if (!resource || !fileService.canHandleResource(resource)) {
|
||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert after strictnullchecks
|
||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser strict-null-checks
|
||||
}
|
||||
|
||||
const exists = (typeof path.exists === 'boolean') ? path.exists : await fileService.exists(resource);
|
||||
if (!exists && path.openOnlyIfExists) {
|
||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser revert after strictnullchecks
|
||||
return undefined; // {{SQL CARBON EDIT}} @anthonydresser strict-null-checks
|
||||
}
|
||||
|
||||
const options: ITextEditorOptions = (exists && typeof path.lineNumber === 'number') ? {
|
||||
|
||||
@@ -663,7 +663,7 @@ export class EditorGroup extends Disposable {
|
||||
return null;
|
||||
}));
|
||||
|
||||
this.mru = data.mru.map(i => this.editors[i]);
|
||||
this.mru = coalesce(data.mru.map(i => this.editors[i]));
|
||||
|
||||
this.active = this.mru[0];
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { isErrorWithActions } from 'vs/base/common/errorsWithActions';
|
||||
import { find, equals } from 'vs/base/common/arrays';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
import { parseLinkedText, LinkedText } from 'vs/base/common/linkedText';
|
||||
|
||||
export interface INotificationsModel {
|
||||
@@ -220,7 +220,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
|
||||
}
|
||||
|
||||
private findNotification(item: INotificationViewItem): INotificationViewItem | undefined {
|
||||
return find(this._notifications, notification => notification.equals(item));
|
||||
return this._notifications.find(notification => notification.equals(item));
|
||||
}
|
||||
|
||||
private createViewItem(notification: INotification): INotificationViewItem | undefined {
|
||||
|
||||
@@ -21,6 +21,7 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { SetMap } from 'vs/base/common/collections';
|
||||
import { IProgressIndicator } from 'vs/platform/progress/common/progress';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
|
||||
|
||||
export const TEST_VIEW_CONTAINER_ID = 'workbench.view.extension.test';
|
||||
|
||||
@@ -86,7 +87,7 @@ export interface IViewContainersRegistry {
|
||||
*
|
||||
* @returns the registered ViewContainer.
|
||||
*/
|
||||
registerViewContainer(viewContainerDescriptor: IViewContainerDescriptor, location: ViewContainerLocation): ViewContainer;
|
||||
registerViewContainer(viewContainerDescriptor: IViewContainerDescriptor, location: ViewContainerLocation, isDefault?: boolean): ViewContainer;
|
||||
|
||||
/**
|
||||
* Deregisters the given view container
|
||||
@@ -110,6 +111,11 @@ export interface IViewContainersRegistry {
|
||||
* Returns the view container location
|
||||
*/
|
||||
getViewContainerLocation(container: ViewContainer): ViewContainerLocation;
|
||||
|
||||
/**
|
||||
* Return the default view container from the given location
|
||||
*/
|
||||
getDefaultViewContainer(location: ViewContainerLocation): ViewContainer | undefined;
|
||||
}
|
||||
|
||||
interface ViewOrderDelegate {
|
||||
@@ -126,13 +132,14 @@ class ViewContainersRegistryImpl extends Disposable implements IViewContainersRe
|
||||
private readonly _onDidDeregister = this._register(new Emitter<{ viewContainer: ViewContainer, viewContainerLocation: ViewContainerLocation }>());
|
||||
readonly onDidDeregister: Event<{ viewContainer: ViewContainer, viewContainerLocation: ViewContainerLocation }> = this._onDidDeregister.event;
|
||||
|
||||
private viewContainers: Map<ViewContainerLocation, ViewContainer[]> = new Map<ViewContainerLocation, ViewContainer[]>();
|
||||
private readonly viewContainers: Map<ViewContainerLocation, ViewContainer[]> = new Map<ViewContainerLocation, ViewContainer[]>();
|
||||
private readonly defaultViewContainers: ViewContainer[] = [];
|
||||
|
||||
get all(): ViewContainer[] {
|
||||
return flatten(values(this.viewContainers));
|
||||
}
|
||||
|
||||
registerViewContainer(viewContainerDescriptor: IViewContainerDescriptor, viewContainerLocation: ViewContainerLocation): ViewContainer {
|
||||
registerViewContainer(viewContainerDescriptor: IViewContainerDescriptor, viewContainerLocation: ViewContainerLocation, isDefault?: boolean): ViewContainer {
|
||||
const existing = this.get(viewContainerDescriptor.id);
|
||||
if (existing) {
|
||||
return existing;
|
||||
@@ -141,6 +148,9 @@ class ViewContainersRegistryImpl extends Disposable implements IViewContainersRe
|
||||
const viewContainer: ViewContainer = viewContainerDescriptor;
|
||||
const viewContainers = getOrSet(this.viewContainers, viewContainerLocation, []);
|
||||
viewContainers.push(viewContainer);
|
||||
if (isDefault) {
|
||||
this.defaultViewContainers.push(viewContainer);
|
||||
}
|
||||
this._onDidRegister.fire({ viewContainer, viewContainerLocation });
|
||||
return viewContainer;
|
||||
}
|
||||
@@ -171,6 +181,10 @@ class ViewContainersRegistryImpl extends Disposable implements IViewContainersRe
|
||||
getViewContainerLocation(container: ViewContainer): ViewContainerLocation {
|
||||
return keys(this.viewContainers).filter(location => this.getViewContainers(location).filter(viewContainer => viewContainer.id === container.id).length > 0)[0];
|
||||
}
|
||||
|
||||
getDefaultViewContainer(location: ViewContainerLocation): ViewContainer | undefined {
|
||||
return this.defaultViewContainers.find(viewContainer => this.getViewContainerLocation(viewContainer) === location);
|
||||
}
|
||||
}
|
||||
|
||||
Registry.add(Extensions.ViewContainersRegistry, new ViewContainersRegistryImpl());
|
||||
@@ -443,22 +457,24 @@ export interface IView {
|
||||
}
|
||||
|
||||
export const IViewsService = createDecorator<IViewsService>('viewsService');
|
||||
|
||||
export interface IViewsService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
// View Container APIs
|
||||
readonly onDidChangeViewContainerVisibility: Event<{ id: string, visible: boolean, location: ViewContainerLocation }>;
|
||||
isViewContainerVisible(id: string): boolean;
|
||||
openViewContainer(id: string, focus?: boolean): Promise<IPaneComposite | null>;
|
||||
closeViewContainer(id: string): void;
|
||||
getVisibleViewContainer(location: ViewContainerLocation): ViewContainer | null;
|
||||
|
||||
// View APIs
|
||||
readonly onDidChangeViewVisibility: Event<{ id: string, visible: boolean }>;
|
||||
|
||||
isViewVisible(id: string): boolean;
|
||||
|
||||
getActiveViewWithId<T extends IView>(id: string): T | null;
|
||||
|
||||
openView<T extends IView>(id: string, focus?: boolean): Promise<T | null>;
|
||||
|
||||
closeView(id: string): void;
|
||||
|
||||
getProgressIndicator(id: string): IProgressIndicator | undefined;
|
||||
getActiveViewWithId<T extends IView>(id: string): T | null;
|
||||
getViewProgressIndicator(id: string): IProgressIndicator | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -473,35 +489,31 @@ export interface IViewDescriptorService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
readonly onDidChangeContainer: Event<{ views: IViewDescriptor[], from: ViewContainer, to: ViewContainer }>;
|
||||
readonly onDidChangeLocation: Event<{ views: IViewDescriptor[], from: ViewContainerLocation, to: ViewContainerLocation }>;
|
||||
readonly onDidChangeContainerLocation: Event<{ viewContainer: ViewContainer, from: ViewContainerLocation, to: ViewContainerLocation }>;
|
||||
|
||||
moveViewContainerToLocation(viewContainer: ViewContainer, location: ViewContainerLocation): void;
|
||||
|
||||
moveViewToLocation(view: IViewDescriptor, location: ViewContainerLocation): void;
|
||||
|
||||
moveViewsToContainer(views: IViewDescriptor[], viewContainer: ViewContainer): void;
|
||||
// ViewContainers
|
||||
readonly viewContainers: ReadonlyArray<ViewContainer>;
|
||||
readonly onDidChangeViewContainers: Event<{ added: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }>, removed: ReadonlyArray<{ container: ViewContainer, location: ViewContainerLocation }> }>;
|
||||
|
||||
getDefaultViewContainer(location: ViewContainerLocation): ViewContainer | undefined;
|
||||
getViewContainerById(id: string): ViewContainer | null;
|
||||
getDefaultViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null;
|
||||
getViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null;
|
||||
getViewContainersByLocation(location: ViewContainerLocation): ViewContainer[];
|
||||
getViewContainerModel(viewContainer: ViewContainer): IViewContainerModel;
|
||||
|
||||
readonly onDidChangeContainerLocation: Event<{ viewContainer: ViewContainer, from: ViewContainerLocation, to: ViewContainerLocation }>;
|
||||
moveViewContainerToLocation(viewContainer: ViewContainer, location: ViewContainerLocation): void;
|
||||
|
||||
// Views
|
||||
getViewDescriptorById(id: string): IViewDescriptor | null;
|
||||
|
||||
getViewContainerByViewId(id: string): ViewContainer | null;
|
||||
|
||||
getViewContainerById(id: string): ViewContainer | null;
|
||||
|
||||
getViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null;
|
||||
|
||||
getDefaultViewContainerLocation(viewContainer: ViewContainer): ViewContainerLocation | null;
|
||||
|
||||
getDefaultContainerById(id: string): ViewContainer | null;
|
||||
|
||||
getViewLocationById(id: string): ViewContainerLocation | null;
|
||||
|
||||
getViewContainersByLocation(location: ViewContainerLocation): ViewContainer[];
|
||||
readonly onDidChangeContainer: Event<{ views: IViewDescriptor[], from: ViewContainer, to: ViewContainer }>;
|
||||
moveViewsToContainer(views: IViewDescriptor[], viewContainer: ViewContainer): void;
|
||||
|
||||
getViewContainers(): ViewContainer[];
|
||||
readonly onDidChangeLocation: Event<{ views: IViewDescriptor[], from: ViewContainerLocation, to: ViewContainerLocation }>;
|
||||
moveViewToLocation(view: IViewDescriptor, location: ViewContainerLocation): void;
|
||||
}
|
||||
|
||||
// Custom views
|
||||
|
||||
Reference in New Issue
Block a user