mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Merge remote-tracking branch 'origin/master' into rebornix/notebook
This commit is contained in:
@@ -20,11 +20,17 @@ export class MainThreadAuthenticationProvider {
|
||||
public readonly displayName: string
|
||||
) { }
|
||||
|
||||
getSessions(): Promise<ReadonlyArray<modes.Session>> {
|
||||
return this._proxy.$getSessions(this.id);
|
||||
async getSessions(): Promise<ReadonlyArray<modes.AuthenticationSession>> {
|
||||
return (await this._proxy.$getSessions(this.id)).map(session => {
|
||||
return {
|
||||
id: session.id,
|
||||
accountName: session.accountName,
|
||||
accessToken: () => this._proxy.$getSessionAccessToken(this.id, session.id)
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
login(scopes: string[]): Promise<modes.Session> {
|
||||
login(scopes: string[]): Promise<modes.AuthenticationSession> {
|
||||
return this._proxy.$login(this.id, scopes);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID } from 'vs/workbench/contrib/output/common/output';
|
||||
import { IOutputService, IOutputChannel, OUTPUT_VIEW_ID } from 'vs/workbench/contrib/output/common/output';
|
||||
import { Extensions, IOutputChannelRegistry } from 'vs/workbench/services/output/common/output';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { MainThreadOutputServiceShape, MainContext, IExtHostContext, ExtHostOutputServiceShape, ExtHostContext } from '../common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { UriComponents, URI } from 'vs/base/common/uri';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IViewsService } from 'vs/workbench/common/views';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadOutputService)
|
||||
export class MainThreadOutputService extends Disposable implements MainThreadOutputServiceShape {
|
||||
@@ -21,28 +20,24 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
|
||||
|
||||
private readonly _proxy: ExtHostOutputServiceShape;
|
||||
private readonly _outputService: IOutputService;
|
||||
private readonly _layoutService: IWorkbenchLayoutService;
|
||||
private readonly _panelService: IPanelService;
|
||||
private readonly _viewsService: IViewsService;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IOutputService outputService: IOutputService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IPanelService panelService: IPanelService
|
||||
@IViewsService viewsService: IViewsService
|
||||
) {
|
||||
super();
|
||||
this._outputService = outputService;
|
||||
this._layoutService = layoutService;
|
||||
this._panelService = panelService;
|
||||
this._viewsService = viewsService;
|
||||
|
||||
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostOutputService);
|
||||
|
||||
const setVisibleChannel = () => {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
const visibleChannel = panel && panel.getId() === OUTPUT_PANEL_ID ? this._outputService.getActiveChannel() : undefined;
|
||||
const visibleChannel = this._viewsService.isViewVisible(OUTPUT_VIEW_ID) ? this._outputService.getActiveChannel() : undefined;
|
||||
this._proxy.$setVisibleChannel(visibleChannel ? visibleChannel.id : null);
|
||||
};
|
||||
this._register(Event.any<any>(this._outputService.onActiveOutputChannel, this._panelService.onDidPanelOpen, this._panelService.onDidPanelClose)(() => setVisibleChannel()));
|
||||
this._register(Event.any<any>(this._outputService.onActiveOutputChannel, Event.filter(this._viewsService.onDidChangeViewVisibility, ({ id }) => id === OUTPUT_VIEW_ID))(() => setVisibleChannel()));
|
||||
setVisibleChannel();
|
||||
}
|
||||
|
||||
@@ -86,11 +81,10 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
|
||||
}
|
||||
|
||||
public $close(channelId: string): Promise<void> | undefined {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
if (panel && panel.getId() === OUTPUT_PANEL_ID) {
|
||||
if (this._viewsService.isViewVisible(OUTPUT_VIEW_ID)) {
|
||||
const activeChannel = this._outputService.getActiveChannel();
|
||||
if (activeChannel && channelId === activeChannel.id) {
|
||||
this._layoutService.setPanelHidden(true);
|
||||
this._viewsService.closeView(OUTPUT_VIEW_ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,8 +202,8 @@ class MainThreadSCMProvider implements ISCMProvider {
|
||||
const icon = icons[0];
|
||||
const iconDark = icons[1] || icon;
|
||||
const decorations = {
|
||||
icon: icon ? URI.parse(icon) : undefined,
|
||||
iconDark: iconDark ? URI.parse(iconDark) : undefined,
|
||||
icon: icon ? URI.revive(icon) : undefined,
|
||||
iconDark: iconDark ? URI.revive(iconDark) : undefined,
|
||||
tooltip,
|
||||
strikeThrough,
|
||||
faded
|
||||
|
||||
@@ -33,10 +33,6 @@ import { ExtHostContext, ExtHostDocumentSaveParticipantShape, IExtHostContext }
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
|
||||
export interface ICodeActionsOnSaveOptions {
|
||||
[kind: string]: boolean;
|
||||
}
|
||||
|
||||
export interface ISaveParticipantParticipant {
|
||||
participate(model: IResolvedTextFileEditorModel, env: { reason: SaveReason }, progress: IProgress<IProgressStep>, token: CancellationToken): Promise<void>;
|
||||
}
|
||||
@@ -242,11 +238,10 @@ class CodeActionOnSaveParticipant implements ISaveParticipantParticipant {
|
||||
if (env.reason === SaveReason.AUTO) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const model = editorModel.textEditorModel;
|
||||
|
||||
const settingsOverrides = { overrideIdentifier: model.getLanguageIdentifier().language, resource: editorModel.resource };
|
||||
const setting = this._configurationService.getValue<ICodeActionsOnSaveOptions>('editor.codeActionsOnSave', settingsOverrides);
|
||||
const setting = this._configurationService.getValue<{ [kind: string]: boolean }>('editor.codeActionsOnSave', settingsOverrides);
|
||||
if (!setting) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -380,9 +375,10 @@ export class SaveParticipant implements ISaveParticipant {
|
||||
cancellable: true,
|
||||
delay: model.isDirty() ? 3000 : 5000
|
||||
}, async progress => {
|
||||
// undoStop before participation
|
||||
model.textEditorModel.pushStackElement();
|
||||
|
||||
for (let p of this._saveParticipants.getValue()) {
|
||||
|
||||
if (cts.token.isCancellationRequested) {
|
||||
break;
|
||||
}
|
||||
@@ -394,6 +390,8 @@ export class SaveParticipant implements ISaveParticipant {
|
||||
}
|
||||
}
|
||||
|
||||
// undoStop after participation
|
||||
model.textEditorModel.pushStackElement();
|
||||
}, () => {
|
||||
// user cancel
|
||||
cts.dispose(true);
|
||||
|
||||
@@ -9,12 +9,12 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { MainContext, MainThreadTimelineShape, IExtHostContext, ExtHostTimelineShape, ExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { ITimelineService, TimelineItem, TimelineProviderDescriptor } from 'vs/workbench/contrib/timeline/common/timeline';
|
||||
import { ITimelineService, TimelineItem, TimelineProviderDescriptor, TimelineChangeEvent } from 'vs/workbench/contrib/timeline/common/timeline';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadTimeline)
|
||||
export class MainThreadTimeline implements MainThreadTimelineShape {
|
||||
private readonly _proxy: ExtHostTimelineShape;
|
||||
private readonly _providerEmitters = new Map<string, Emitter<URI | undefined>>();
|
||||
private readonly _providerEmitters = new Map<string, Emitter<TimelineChangeEvent>>();
|
||||
|
||||
constructor(
|
||||
context: IExtHostContext,
|
||||
@@ -29,41 +29,41 @@ export class MainThreadTimeline implements MainThreadTimelineShape {
|
||||
}
|
||||
|
||||
$registerTimelineProvider(provider: TimelineProviderDescriptor): void {
|
||||
this.logService.trace(`MainThreadTimeline#registerTimelineProvider: source=${provider.source}`);
|
||||
this.logService.trace(`MainThreadTimeline#registerTimelineProvider: id=${provider.id}`);
|
||||
|
||||
const proxy = this._proxy;
|
||||
|
||||
const emitters = this._providerEmitters;
|
||||
let onDidChange = emitters.get(provider.source);
|
||||
let onDidChange = emitters.get(provider.id);
|
||||
if (onDidChange === undefined) {
|
||||
onDidChange = new Emitter<URI | undefined>();
|
||||
emitters.set(provider.source, onDidChange);
|
||||
onDidChange = new Emitter<TimelineChangeEvent>();
|
||||
emitters.set(provider.id, onDidChange);
|
||||
}
|
||||
|
||||
this._timelineService.registerTimelineProvider({
|
||||
...provider,
|
||||
onDidChange: onDidChange.event,
|
||||
provideTimeline(uri: URI, token: CancellationToken) {
|
||||
return proxy.$getTimeline(provider.source, uri, token);
|
||||
return proxy.$getTimeline(provider.id, uri, token);
|
||||
},
|
||||
dispose() {
|
||||
emitters.delete(provider.source);
|
||||
emitters.delete(provider.id);
|
||||
onDidChange?.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$unregisterTimelineProvider(source: string): void {
|
||||
this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: source=${source}`);
|
||||
$unregisterTimelineProvider(id: string): void {
|
||||
this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: id=${id}`);
|
||||
|
||||
this._timelineService.unregisterTimelineProvider(source);
|
||||
this._timelineService.unregisterTimelineProvider(id);
|
||||
}
|
||||
|
||||
$emitTimelineChangeEvent(source: string, uri: URI | undefined): void {
|
||||
this.logService.trace(`MainThreadTimeline#emitChangeEvent: source=${source}, uri=${uri?.toString(true)}`);
|
||||
$emitTimelineChangeEvent(e: TimelineChangeEvent): void {
|
||||
this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${e.id}, uri=${e.uri?.toString(true)}`);
|
||||
|
||||
const emitter = this._providerEmitters.get(source);
|
||||
emitter?.fire(uri);
|
||||
const emitter = this._providerEmitters.get(e.id!);
|
||||
emitter?.fire(e);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
||||
@@ -235,7 +235,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
|
||||
for (const viewContainer of viewContainersRegistry.all) {
|
||||
if (viewContainer.extensionId && removedExtensions.has(ExtensionIdentifier.toKey(viewContainer.extensionId))) {
|
||||
// move only those views that do not belong to the removed extension
|
||||
const views = this.viewsRegistry.getViews(viewContainer).filter((view: ICustomViewDescriptor) => !removedExtensions.has(ExtensionIdentifier.toKey(view.extensionId)));
|
||||
const views = this.viewsRegistry.getViews(viewContainer).filter(view => !removedExtensions.has(ExtensionIdentifier.toKey((view as ICustomViewDescriptor).extensionId)));
|
||||
if (views.length) {
|
||||
this.viewsRegistry.moveViews(views, this.getDefaultViewContainer());
|
||||
}
|
||||
@@ -290,7 +290,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
|
||||
const viewsToMove: IViewDescriptor[] = [];
|
||||
for (const existingViewContainer of existingViewContainers) {
|
||||
if (viewContainer !== existingViewContainer) {
|
||||
viewsToMove.push(...this.viewsRegistry.getViews(existingViewContainer).filter((view: ICustomViewDescriptor) => view.originalContainerId === descriptor.id));
|
||||
viewsToMove.push(...this.viewsRegistry.getViews(existingViewContainer).filter(view => (view as ICustomViewDescriptor).originalContainerId === descriptor.id));
|
||||
}
|
||||
}
|
||||
if (viewsToMove.length) {
|
||||
@@ -314,6 +314,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
|
||||
[id, `${id}.state`, { mergeViewWithContainerWhenSingleView: true }]
|
||||
),
|
||||
hideIfEmpty: true,
|
||||
order,
|
||||
icon,
|
||||
}, ViewContainerLocation.Sidebar);
|
||||
|
||||
@@ -424,7 +425,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution {
|
||||
private removeViews(extensions: readonly IExtensionPointUser<ViewExtensionPointType>[]): void {
|
||||
const removedExtensions: Set<string> = extensions.reduce((result, e) => { result.add(ExtensionIdentifier.toKey(e.description.identifier)); return result; }, new Set<string>());
|
||||
for (const viewContainer of this.viewContainersRegistry.all) {
|
||||
const removedViews = this.viewsRegistry.getViews(viewContainer).filter((v: ICustomViewDescriptor) => v.extensionId && removedExtensions.has(ExtensionIdentifier.toKey(v.extensionId)));
|
||||
const removedViews = this.viewsRegistry.getViews(viewContainer).filter(v => (v as ICustomViewDescriptor).extensionId && removedExtensions.has(ExtensionIdentifier.toKey((v as ICustomViewDescriptor).extensionId)));
|
||||
if (removedViews.length) {
|
||||
this.viewsRegistry.deregisterViews(removedViews, viewContainer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user