Merge from vscode 8c426f9f3b6b18935cc6c2ec8aa6d45ccd88021e

This commit is contained in:
ADS Merger
2020-07-23 02:21:09 +00:00
parent efc8182954
commit ede827ee82
83 changed files with 1736 additions and 829 deletions

View File

@@ -50,7 +50,7 @@ export class ContextMenuHandler {
let menu: Menu | undefined;
const anchor = delegate.getAnchor();
let shadowRootElement = isHTMLElement(delegate.domForShadowRoot) ? delegate.domForShadowRoot : undefined;
this.contextViewService.showContextView({
getAnchor: () => delegate.getAnchor(),
canRelayout: false,
@@ -133,7 +133,7 @@ export class ContextMenuHandler {
this.focusToReturn.focus();
}
}
}, !!delegate.anchorAsContainer && isHTMLElement(anchor) ? anchor : undefined);
}, shadowRootElement, !!shadowRootElement);
}
private onActionRun(e: IRunEvent): void {

View File

@@ -15,7 +15,7 @@ export interface IContextViewService extends IContextViewProvider {
readonly _serviceBrand: undefined;
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): IDisposable;
showContextView(delegate: IContextViewDelegate, container?: HTMLElement, shadowRoot?: boolean): IDisposable;
hideContextView(data?: any): void;
layout(): void;
anchorAlignment?: AnchorAlignment;

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { IContextViewService, IContextViewDelegate } from './contextView';
import { ContextView } from 'vs/base/browser/ui/contextview/contextview';
import { ContextView, ContextViewDOMPosition } from 'vs/base/browser/ui/contextview/contextview';
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
@@ -21,7 +21,7 @@ export class ContextViewService extends Disposable implements IContextViewServic
super();
this.container = layoutService.container;
this.contextView = this._register(new ContextView(this.container, false));
this.contextView = this._register(new ContextView(this.container, ContextViewDOMPosition.ABSOLUTE));
this.layout();
this._register(layoutService.onLayout(() => this.layout()));
@@ -29,20 +29,20 @@ export class ContextViewService extends Disposable implements IContextViewServic
// ContextView
setContainer(container: HTMLElement, useFixedPosition?: boolean): void {
this.contextView.setContainer(container, !!useFixedPosition);
setContainer(container: HTMLElement, domPosition?: ContextViewDOMPosition): void {
this.contextView.setContainer(container, domPosition || ContextViewDOMPosition.ABSOLUTE);
}
showContextView(delegate: IContextViewDelegate, container?: HTMLElement): IDisposable {
showContextView(delegate: IContextViewDelegate, container?: HTMLElement, shadowRoot?: boolean): IDisposable {
if (container) {
if (container !== this.container) {
this.container = container;
this.setContainer(container, true);
this.setContainer(container, shadowRoot ? ContextViewDOMPosition.FIXED_SHADOW : ContextViewDOMPosition.FIXED);
}
} else {
if (this.container !== this.layoutService.container) {
this.container = this.layoutService.container;
this.setContainer(this.container, false);
this.setContainer(this.container, ContextViewDOMPosition.ABSOLUTE);
}
}

View File

@@ -149,8 +149,25 @@ export interface IExtensionIdentifier {
uuid?: string;
}
export const EXTENSION_CATEGORIES = ['Programming Languages', 'Snippets', 'Linters', 'Themes', 'Debuggers', 'Other', 'Keymaps', 'Formatters', 'Extension Packs',
'SCM Providers', 'Azure', 'Language Packs', 'Data Science', 'Machine Learning', 'Visualization', 'Testing', 'Notebooks'];
export const EXTENSION_CATEGORIES = [
'Azure',
'Data Science',
'Debuggers',
'Extension Packs',
'Formatters',
'Keymaps',
'Language Packs',
'Linters',
'Machine Learning',
'Notebooks',
'Programming Languages',
'SCM Providers',
'Snippets',
'Themes',
'Testing',
'Visualization',
'Other',
];
export interface IExtensionManifest {
readonly name: string;

View File

@@ -194,6 +194,9 @@ class BrowserSocket implements ISocket {
this.socket.close();
}
public drain(): Promise<void> {
return Promise.resolve();
}
}

View File

@@ -82,10 +82,19 @@ class RemovedResources {
let messages: string[] = [];
if (externalRemoval.length > 0) {
messages.push(nls.localize('externalRemoval', "The following files have been closed and modified on disk: {0}.", externalRemoval.join(', ')));
messages.push(
nls.localize(
{ key: 'externalRemoval', comment: ['{0} is a list of filenames'] },
"The following files have been closed and modified on disk: {0}.", externalRemoval.join(', ')
)
);
}
if (noParallelUniverses.length > 0) {
messages.push(nls.localize('noParallelUniverses', "The following files have been modified in an incompatible way: {0}.", noParallelUniverses.join(', ')));
messages.push(
nls.localize(
{ key: 'noParallelUniverses', comment: ['{0} is a list of filenames'] },
"The following files have been modified in an incompatible way: {0}.", noParallelUniverses.join(', ')
));
}
return messages.join('\n');
}
@@ -771,10 +780,26 @@ export class UndoRedoService implements IUndoRedoService {
private _checkWorkspaceUndo(strResource: string, element: WorkspaceStackElement, editStackSnapshot: EditStackSnapshot, checkInvalidatedResources: boolean): WorkspaceVerificationError | null {
if (element.removedResources) {
return this._tryToSplitAndUndo(strResource, element, element.removedResources, nls.localize('cannotWorkspaceUndo', "Could not undo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()));
return this._tryToSplitAndUndo(
strResource,
element,
element.removedResources,
nls.localize(
{ key: 'cannotWorkspaceUndo', comment: ['{0} is a label for an operation. {1} is another message.'] },
"Could not undo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()
)
);
}
if (checkInvalidatedResources && element.invalidatedResources) {
return this._tryToSplitAndUndo(strResource, element, element.invalidatedResources, nls.localize('cannotWorkspaceUndo', "Could not undo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()));
return this._tryToSplitAndUndo(
strResource,
element,
element.invalidatedResources,
nls.localize(
{ key: 'cannotWorkspaceUndo', comment: ['{0} is a label for an operation. {1} is another message.'] },
"Could not undo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()
)
);
}
// this must be the last past element in all the impacted resources!
@@ -785,7 +810,15 @@ export class UndoRedoService implements IUndoRedoService {
}
}
if (cannotUndoDueToResources.length > 0) {
return this._tryToSplitAndUndo(strResource, element, null, nls.localize('cannotWorkspaceUndoDueToChanges', "Could not undo '{0}' across all files because changes were made to {1}", element.label, cannotUndoDueToResources.join(', ')));
return this._tryToSplitAndUndo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceUndoDueToChanges', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not undo '{0}' across all files because changes were made to {1}", element.label, cannotUndoDueToResources.join(', ')
)
);
}
const cannotLockDueToResources: string[] = [];
@@ -795,12 +828,28 @@ export class UndoRedoService implements IUndoRedoService {
}
}
if (cannotLockDueToResources.length > 0) {
return this._tryToSplitAndUndo(strResource, element, null, nls.localize('cannotWorkspaceUndoDueToInProgressUndoRedo', "Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}", element.label, cannotLockDueToResources.join(', ')));
return this._tryToSplitAndUndo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceUndoDueToInProgressUndoRedo', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}", element.label, cannotLockDueToResources.join(', ')
)
);
}
// check if new stack elements were added in the meantime...
if (!editStackSnapshot.isValid()) {
return this._tryToSplitAndUndo(strResource, element, null, nls.localize('cannotWorkspaceUndoDueToInMeantimeUndoRedo', "Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime", element.label));
return this._tryToSplitAndUndo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceUndoDueToInMeantimeUndoRedo', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime", element.label
)
);
}
return null;
@@ -881,7 +930,10 @@ export class UndoRedoService implements IUndoRedoService {
return;
}
if (editStack.locked) {
const message = nls.localize('cannotResourceUndoDueToInProgressUndoRedo', "Could not undo '{0}' because there is already an undo or redo operation running.", element.label);
const message = nls.localize(
{ key: 'cannotResourceUndoDueToInProgressUndoRedo', comment: ['{0} is a label for an operation.'] },
"Could not undo '{0}' because there is already an undo or redo operation running.", element.label
);
this._notificationService.info(message);
return;
}
@@ -942,10 +994,26 @@ export class UndoRedoService implements IUndoRedoService {
private _checkWorkspaceRedo(strResource: string, element: WorkspaceStackElement, editStackSnapshot: EditStackSnapshot, checkInvalidatedResources: boolean): WorkspaceVerificationError | null {
if (element.removedResources) {
return this._tryToSplitAndRedo(strResource, element, element.removedResources, nls.localize('cannotWorkspaceRedo', "Could not redo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()));
return this._tryToSplitAndRedo(
strResource,
element,
element.removedResources,
nls.localize(
{ key: 'cannotWorkspaceRedo', comment: ['{0} is a label for an operation. {1} is another message.'] },
"Could not redo '{0}' across all files. {1}", element.label, element.removedResources.createMessage()
)
);
}
if (checkInvalidatedResources && element.invalidatedResources) {
return this._tryToSplitAndRedo(strResource, element, element.invalidatedResources, nls.localize('cannotWorkspaceRedo', "Could not redo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()));
return this._tryToSplitAndRedo(
strResource,
element,
element.invalidatedResources,
nls.localize(
{ key: 'cannotWorkspaceRedo', comment: ['{0} is a label for an operation. {1} is another message.'] },
"Could not redo '{0}' across all files. {1}", element.label, element.invalidatedResources.createMessage()
)
);
}
// this must be the last future element in all the impacted resources!
@@ -956,7 +1024,15 @@ export class UndoRedoService implements IUndoRedoService {
}
}
if (cannotRedoDueToResources.length > 0) {
return this._tryToSplitAndRedo(strResource, element, null, nls.localize('cannotWorkspaceRedoDueToChanges', "Could not redo '{0}' across all files because changes were made to {1}", element.label, cannotRedoDueToResources.join(', ')));
return this._tryToSplitAndRedo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceRedoDueToChanges', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not redo '{0}' across all files because changes were made to {1}", element.label, cannotRedoDueToResources.join(', ')
)
);
}
const cannotLockDueToResources: string[] = [];
@@ -966,12 +1042,28 @@ export class UndoRedoService implements IUndoRedoService {
}
}
if (cannotLockDueToResources.length > 0) {
return this._tryToSplitAndRedo(strResource, element, null, nls.localize('cannotWorkspaceRedoDueToInProgressUndoRedo', "Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}", element.label, cannotLockDueToResources.join(', ')));
return this._tryToSplitAndRedo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceRedoDueToInProgressUndoRedo', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}", element.label, cannotLockDueToResources.join(', ')
)
);
}
// check if new stack elements were added in the meantime...
if (!editStackSnapshot.isValid()) {
return this._tryToSplitAndRedo(strResource, element, null, nls.localize('cannotWorkspaceRedoDueToInMeantimeUndoRedo', "Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime", element.label));
return this._tryToSplitAndRedo(
strResource,
element,
null,
nls.localize(
{ key: 'cannotWorkspaceRedoDueToInMeantimeUndoRedo', comment: ['{0} is a label for an operation. {1} is a list of filenames.'] },
"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime", element.label
)
);
}
return null;
@@ -1015,7 +1107,10 @@ export class UndoRedoService implements IUndoRedoService {
return;
}
if (editStack.locked) {
const message = nls.localize('cannotResourceRedoDueToInProgressUndoRedo', "Could not redo '{0}' because there is already an undo or redo operation running.", element.label);
const message = nls.localize(
{ key: 'cannotResourceRedoDueToInProgressUndoRedo', comment: ['{0} is a label for an operation.'] },
"Could not redo '{0}' because there is already an undo or redo operation running.", element.label
);
this._notificationService.info(message);
return;
}

View File

@@ -32,6 +32,7 @@ type AutoSyncErrorClassification = {
const enablementKey = 'sync.enable';
const disableMachineEventuallyKey = 'sync.disableMachineEventually';
const sessionIdKey = 'sync.sessionId';
const storeUrlKey = 'sync.storeUrl';
export class UserDataAutoSyncEnablementService extends Disposable {
@@ -97,15 +98,20 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
this.syncTriggerDelayer = this._register(new Delayer<void>(0));
if (userDataSyncStoreService.userDataSyncStore) {
storageService.store(storeUrlKey, userDataSyncStoreService.userDataSyncStore.url.toString(), StorageScope.GLOBAL);
if (this.isEnabled()) {
this.logService.info('Auto Sync is enabled.');
} else {
this.logService.info('Auto Sync is disabled.');
}
this.updateAutoSync();
if (this.hasToDisableMachineEventually()) {
this.disableMachineEventually();
}
this._register(userDataSyncAccountService.onDidChangeAccount(() => this.updateAutoSync()));
this._register(userDataSyncStoreService.onDidChangeDonotMakeRequestsUntil(() => this.updateAutoSync()));
this._register(Event.debounce<string, string[]>(userDataSyncService.onDidChangeLocal, (last, source) => last ? [...last, source] : [source], 1000)(sources => this.triggerSync(sources, false)));