Merge from vscode 61d5f2b82f17bf9f99f56405204caab88a7e8747

This commit is contained in:
ADS Merger
2020-03-19 06:57:07 +00:00
parent 03ce5d1ba7
commit 84f67f61c4
137 changed files with 13234 additions and 796 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ICodeEditor, isCodeEditor, isDiffEditor } from 'vs/editor/browser/editorBrowser';
import { ICodeEditor, isCodeEditor, isDiffEditor, isCompositeEditor } from 'vs/editor/browser/editorBrowser';
import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServiceImpl';
import { ScrollType } from 'vs/editor/common/editorCommon';
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
@@ -32,10 +32,15 @@ export class CodeEditorService extends CodeEditorServiceImpl {
return activeTextEditorControl.getModifiedEditor();
}
const activeControl = this.editorService.activeEditorPane?.getControl();
if (isCompositeEditor(activeControl) && isCodeEditor(activeControl.activeCodeEditor)) {
return activeControl.activeCodeEditor;
}
return null;
}
openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null> {
async openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise<ICodeEditor | null> {
// Special case: If the active editor is a diff editor and the request to open originates and
// targets the modified side of it, we just apply the request there to prevent opening the modified
@@ -55,7 +60,7 @@ export class CodeEditorService extends CodeEditorServiceImpl {
const textOptions = TextEditorOptions.create(input.options);
textOptions.apply(targetEditor, ScrollType.Smooth);
return Promise.resolve(targetEditor);
return targetEditor;
}
// Open using our normal editor service

View File

@@ -21,7 +21,7 @@ import { IResourceEditorInputType, SIDE_GROUP, IResourceEditorReplacement, IOpen
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Disposable, IDisposable, dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { coalesce, distinct } from 'vs/base/common/arrays';
import { isCodeEditor, isDiffEditor, ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { isCodeEditor, isDiffEditor, ICodeEditor, IDiffEditor, isCompositeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorGroupView, IEditorOpeningEvent, EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
import { ILabelService } from 'vs/platform/label/common/label';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@@ -400,6 +400,9 @@ export class EditorService extends Disposable implements EditorServiceImpl {
if (isCodeEditor(activeControl) || isDiffEditor(activeControl)) {
return activeControl;
}
if (isCompositeEditor(activeControl) && isCodeEditor(activeControl.activeCodeEditor)) {
return activeControl.activeCodeEditor;
}
}
return undefined;

View File

@@ -105,12 +105,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
@memoize
get userDataSyncHome(): URI { return joinPath(this.userRoamingDataHome, 'sync'); }
@memoize
get settingsSyncPreviewResource(): URI { return joinPath(this.userDataSyncHome, 'settings.json'); }
@memoize
get keybindingsSyncPreviewResource(): URI { return joinPath(this.userDataSyncHome, 'keybindings.json'); }
@memoize
get userDataSyncLogResource(): URI { return joinPath(this.options.logsPath, 'userDataSync.log'); }

View File

@@ -251,7 +251,7 @@ export class ProgressService extends Disposable implements IProgressService {
return toDisposable(() => promiseResolve());
};
const createNotification = (message: string, increment?: number): INotificationHandle => {
const createNotification = (message: string, silent: boolean, increment?: number): INotificationHandle => {
const notificationDisposables = new DisposableStore();
const primaryActions = options.primaryActions ? Array.from(options.primaryActions) : [];
@@ -294,7 +294,8 @@ export class ProgressService extends Disposable implements IProgressService {
message,
source: options.source,
actions: { primary: primaryActions, secondary: secondaryActions },
progress: typeof increment === 'number' && increment >= 0 ? { total: 100, worked: increment } : { infinite: true }
progress: typeof increment === 'number' && increment >= 0 ? { total: 100, worked: increment } : { infinite: true },
silent
});
// Switch to window based progress once the notification
@@ -302,8 +303,7 @@ export class ProgressService extends Disposable implements IProgressService {
// Remove that window based progress once the notification
// shows again.
let windowProgressDisposable: IDisposable | undefined = undefined;
notificationDisposables.add(notification.onDidChangeVisibility(visible => {
const onVisibilityChange = (visible: boolean) => {
// Clear any previous running window progress
dispose(windowProgressDisposable);
@@ -311,7 +311,11 @@ export class ProgressService extends Disposable implements IProgressService {
if (!visible && !progressStateModel.done) {
windowProgressDisposable = createWindowProgress();
}
}));
};
notificationDisposables.add(notification.onDidChangeVisibility(onVisibilityChange));
if (silent) {
onVisibilityChange(false);
}
// Clear upon dispose
Event.once(notification.onDidClose)(() => notificationDisposables.dispose());
@@ -346,10 +350,10 @@ export class ProgressService extends Disposable implements IProgressService {
// create notification now or after a delay
if (typeof options.delay === 'number' && options.delay > 0) {
if (typeof notificationTimeout !== 'number') {
notificationTimeout = setTimeout(() => notificationHandle = createNotification(titleAndMessage!, step?.increment), options.delay);
notificationTimeout = setTimeout(() => notificationHandle = createNotification(titleAndMessage!, !!options.silent, step?.increment), options.delay);
}
} else {
notificationHandle = createNotification(titleAndMessage, step?.increment);
notificationHandle = createNotification(titleAndMessage, !!options.silent, step?.increment);
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SyncStatus, SyncResource, IUserDataSyncService, UserDataSyncError } from 'vs/platform/userDataSync/common/userDataSync';
import { SyncStatus, SyncResource, IUserDataSyncService, UserDataSyncError, SyncResourceConflicts } from 'vs/platform/userDataSync/common/userDataSync';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { Disposable } from 'vs/base/common/lifecycle';
import { Emitter, Event } from 'vs/base/common/event';
@@ -25,10 +25,10 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
get onDidChangeLocal(): Event<SyncResource> { return this.channel.listen<SyncResource>('onDidChangeLocal'); }
private _conflictsSources: SyncResource[] = [];
get conflictsSources(): SyncResource[] { return this._conflictsSources; }
private _onDidChangeConflicts: Emitter<SyncResource[]> = this._register(new Emitter<SyncResource[]>());
readonly onDidChangeConflicts: Event<SyncResource[]> = this._onDidChangeConflicts.event;
private _conflicts: SyncResourceConflicts[] = [];
get conflicts(): SyncResourceConflicts[] { return this._conflicts; }
private _onDidChangeConflicts: Emitter<SyncResourceConflicts[]> = this._register(new Emitter<SyncResourceConflicts[]>());
readonly onDidChangeConflicts: Event<SyncResourceConflicts[]> = this._onDidChangeConflicts.event;
private _lastSyncTime: number | undefined = undefined;
get lastSyncTime(): number | undefined { return this._lastSyncTime; }
@@ -52,7 +52,7 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
return userDataSyncChannel.listen(event, arg);
}
};
this.channel.call<[SyncStatus, SyncResource[], number | undefined]>('_getInitialData').then(([status, conflicts, lastSyncTime]) => {
this.channel.call<[SyncStatus, SyncResourceConflicts[], number | undefined]>('_getInitialData').then(([status, conflicts, lastSyncTime]) => {
this.updateStatus(status);
this.updateConflicts(conflicts);
if (lastSyncTime) {
@@ -61,7 +61,7 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
this._register(this.channel.listen<SyncStatus>('onDidChangeStatus')(status => this.updateStatus(status)));
this._register(this.channel.listen<number>('onDidChangeLastSyncTime')(lastSyncTime => this.updateLastSyncTime(lastSyncTime)));
});
this._register(this.channel.listen<SyncResource[]>('onDidChangeConflicts')(conflicts => this.updateConflicts(conflicts)));
this._register(this.channel.listen<SyncResourceConflicts[]>('onDidChangeConflicts')(conflicts => this.updateConflicts(conflicts)));
this._register(this.channel.listen<[SyncResource, Error][]>('onSyncErrors')(errors => this._onSyncErrors.fire(errors.map(([source, error]) => ([source, UserDataSyncError.toUserDataSyncError(error)])))));
}
@@ -73,8 +73,8 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
return this.channel.call('sync');
}
accept(source: SyncResource, content: string): Promise<void> {
return this.channel.call('accept', [source, content]);
acceptConflict(conflict: URI, content: string): Promise<void> {
return this.channel.call('acceptConflict', [conflict, content]);
}
reset(): Promise<void> {
@@ -102,8 +102,14 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
this._onDidChangeStatus.fire(status);
}
private async updateConflicts(conflicts: SyncResource[]): Promise<void> {
this._conflictsSources = conflicts;
private async updateConflicts(conflicts: SyncResourceConflicts[]): Promise<void> {
// Revive URIs
this._conflicts = conflicts.map(c =>
({
syncResource: c.syncResource,
conflicts: c.conflicts.map(({ local, remote }) =>
({ local: URI.revive(local), remote: URI.revive(remote) }))
}));
this._onDidChangeConflicts.fire(conflicts);
}

View File

@@ -445,11 +445,6 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
}
moveViewToLocation(view: IViewDescriptor, location: ViewContainerLocation): void {
const previousContainer = this.getViewContainer(view.id);
if (previousContainer && this.getViewContainerLocation(previousContainer) === location) {
return;
}
let container = this.getDefaultContainer(view.id)!;
if (this.getViewContainerLocation(container) !== location) {
container = this.registerViewContainerForSingleView(view, location);