Merge from vscode 7653d836944892f83ce9e1f95c1204bafa1aec31

This commit is contained in:
ADS Merger
2020-05-08 03:58:34 +00:00
parent dac1970c43
commit fa62ec1f34
209 changed files with 5131 additions and 2480 deletions

View File

@@ -26,4 +26,9 @@ export interface IActivityBarService {
* Returns id of visible viewlets following the visual order.
*/
getVisibleViewContainerIds(): string[];
/**
* Focuses the activity bar.
*/
focusActivityBar(): void;
}

View File

@@ -67,7 +67,7 @@ export class NodeTestBackupFileService extends BackupFileService {
const fileService = new FileService(logService);
const diskFileSystemProvider = new DiskFileSystemProvider(logService);
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, logService));
super(environmentService, fileService, logService);

View File

@@ -110,7 +110,7 @@ suite('ConfigurationEditingService', () => {
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
instantiationService.stub(IFileService, fileService);
instantiationService.stub(IRemoteAgentService, remoteAgentService);
const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService);

View File

@@ -110,7 +110,7 @@ suite.skip('WorkspaceContextService - Folder', () => { // {{SQL CARBON EDIT}} sk
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, new DiskFileSystemProvider(new NullLogService()), environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, new DiskFileSystemProvider(new NullLogService()), environmentService, new NullLogService()));
workspaceContextService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, new RemoteAgentService(environmentService, new RemoteAuthorityResolverService(), new SignService(undefined), new NullLogService()));
return (<WorkspaceService>workspaceContextService).initialize(convertToWorkspacePayload(URI.file(folderDir)));
});
@@ -176,7 +176,7 @@ suite.skip('WorkspaceContextService - Workspace', () => { // {{SQL CARBON EDIT}}
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService);
instantiationService.stub(IWorkspaceContextService, workspaceService);
@@ -236,7 +236,7 @@ suite.skip('WorkspaceContextService - Workspace Editing', () => { // {{SQL CARBO
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService);
instantiationService.stub(IWorkspaceContextService, workspaceService);
@@ -497,7 +497,7 @@ suite.skip('WorkspaceService - Initialization', () => { // {{SQL CARBON EDIT}} s
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService);
instantiationService.stub(IWorkspaceContextService, workspaceService);
instantiationService.stub(IConfigurationService, workspaceService);
@@ -774,7 +774,7 @@ suite.skip('WorkspaceConfigurationService - Folder', () => { // {{SQL CARBON EDI
fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
workspaceService = disposableStore.add(new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService));
instantiationService.stub(IWorkspaceContextService, workspaceService);
instantiationService.stub(IConfigurationService, workspaceService);
@@ -1199,7 +1199,7 @@ suite.skip('WorkspaceConfigurationService-Multiroot', () => { // {{SQL CARBON ED
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
const workspaceService = new WorkspaceService({ configurationCache: new ConfigurationCache(environmentService) }, environmentService, fileService, remoteAgentService);
instantiationService.stub(IWorkspaceContextService, workspaceService);
@@ -1709,7 +1709,7 @@ suite('WorkspaceConfigurationService - Remote Folder', () => {
const remoteAgentService = instantiationService.stub(IRemoteAgentService, <Partial<IRemoteAgentService>>{ getEnvironment: () => remoteEnvironmentPromise });
const fileService = new FileService(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
const configurationCache: IConfigurationCache = { read: () => Promise.resolve(''), write: () => Promise.resolve(), remove: () => Promise.resolve() };
testObject = new WorkspaceService({ configurationCache, remoteAuthority }, environmentService, fileService, remoteAgentService);
instantiationService.stub(IWorkspaceContextService, testObject);

View File

@@ -258,6 +258,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
const optionOverrides = {
preserveFocus: true,
pinned: group.isPinned(editor),
sticky: group.isSticky(editor),
index: group.getIndexOfEditor(editor),
inactive: !group.isActive(editor)
};
@@ -428,7 +429,9 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return this.getEditors(EditorsOrder.SEQUENTIAL).map(({ editor }) => editor);
}
getEditors(order: EditorsOrder): ReadonlyArray<IEditorIdentifier> {
getEditors(order: EditorsOrder.MOST_RECENTLY_ACTIVE): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder.SEQUENTIAL, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorIdentifier> {
if (order === EditorsOrder.MOST_RECENTLY_ACTIVE) {
return this.editorsObserver.editors;
}
@@ -436,7 +439,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
const editors: IEditorIdentifier[] = [];
this.editorGroupService.getGroups(GroupsOrder.GRID_APPEARANCE).forEach(group => {
editors.push(...group.getEditors(EditorsOrder.SEQUENTIAL).map(editor => ({ editor, groupId: group.id })));
editors.push(...group.getEditors(EditorsOrder.SEQUENTIAL, options).map(editor => ({ editor, groupId: group.id })));
});
return editors;
@@ -1038,7 +1041,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return this.save(this.getAllDirtyEditors(options), options);
}
async revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<void> {
async revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<boolean> {
// Convert to array
if (!Array.isArray(editors)) {
@@ -1056,9 +1059,11 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return editor.revert(groupId, options);
}));
return !uniqueEditors.some(({ editor }) => editor.isDirty());
}
async revertAll(options?: IRevertAllEditorsOptions): Promise<void> {
async revertAll(options?: IRevertAllEditorsOptions): Promise<boolean> {
return this.revert(this.getAllDirtyEditors(options), options);
}
@@ -1067,9 +1072,19 @@ export class EditorService extends Disposable implements EditorServiceImpl {
for (const group of this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
for (const editor of group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE)) {
if (editor.isDirty() && (!editor.isUntitled() || !!options?.includeUntitled)) {
editors.push({ groupId: group.id, editor });
if (!editor.isDirty()) {
continue;
}
if (!options?.includeUntitled && editor.isUntitled()) {
continue;
}
if (options?.excludeSticky && group.isSticky(editor)) {
continue;
}
editors.push({ groupId: group.id, editor });
}
}
@@ -1210,7 +1225,15 @@ export class DelegatingEditorService implements IEditorService {
get editors(): ReadonlyArray<IEditorInput> { return this.editorService.editors; }
get count(): number { return this.editorService.count; }
getEditors(order: EditorsOrder): ReadonlyArray<IEditorIdentifier> { return this.editorService.getEditors(order); }
getEditors(order: EditorsOrder.MOST_RECENTLY_ACTIVE): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder.SEQUENTIAL, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorIdentifier> {
if (order === EditorsOrder.MOST_RECENTLY_ACTIVE) {
return this.editorService.getEditors(order);
}
return this.editorService.getEditors(order, options);
}
openEditors(editors: IEditorInputWithOptions[], group?: OpenInEditorGroup): Promise<IEditorPane[]>;
openEditors(editors: IResourceEditorInputType[], group?: OpenInEditorGroup): Promise<IEditorPane[]>;
@@ -1237,8 +1260,8 @@ export class DelegatingEditorService implements IEditorService {
save(editors: IEditorIdentifier | IEditorIdentifier[], options?: ISaveEditorsOptions): Promise<boolean> { return this.editorService.save(editors, options); }
saveAll(options?: ISaveAllEditorsOptions): Promise<boolean> { return this.editorService.saveAll(options); }
revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<void> { return this.editorService.revert(editors, options); }
revertAll(options?: IRevertAllEditorsOptions): Promise<void> { return this.editorService.revertAll(options); }
revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<boolean> { return this.editorService.revert(editors, options); }
revertAll(options?: IRevertAllEditorsOptions): Promise<boolean> { return this.editorService.revertAll(options); }
registerCustomEditorViewTypesHandler(source: string, handler: ICustomEditorViewTypesHandler): IDisposable {
throw new Error('Method not implemented.');

View File

@@ -77,10 +77,6 @@ export interface EditorGroupLayout {
groups: GroupLayoutArgument[];
}
export interface ICloseEditorOptions {
preserveFocus?: boolean;
}
export interface IMoveEditorOptions {
index?: number;
inactive?: boolean;
@@ -103,12 +99,21 @@ export interface IMergeGroupOptions {
index?: number;
}
export interface ICloseEditorOptions {
preserveFocus?: boolean;
}
export type ICloseEditorsFilter = {
except?: IEditorInput,
direction?: CloseDirection,
savedOnly?: boolean
savedOnly?: boolean,
excludeSticky?: boolean
};
export interface ICloseAllEditorsOptions {
excludeSticky?: boolean;
}
export interface IEditorReplacement {
editor: IEditorInput;
replacement: IEditorInput;
@@ -419,10 +424,15 @@ export interface IEditorGroup {
readonly previewEditor: IEditorInput | null;
/**
* The number of opend editors in this group.
* The number of opened editors in this group.
*/
readonly count: number;
/**
* The number of sticky editors in this group.
*/
readonly stickyCount: number;
/**
* All opened editors in the group in sequential order of their appearance.
*/
@@ -432,8 +442,9 @@ export interface IEditorGroup {
* Get all editors that are currently opened in the group.
*
* @param order the order of the editors to use
* @param options options to select only specific editors as instructed
*/
getEditors(order: EditorsOrder): ReadonlyArray<IEditorInput>;
getEditors(order: EditorsOrder, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorInput>;
/**
* Returns the editor at a specific index of the group.
@@ -475,6 +486,11 @@ export interface IEditorGroup {
*/
isPinned(editor: IEditorInput): boolean;
/**
* Find out if the provided editor or index of editor is sticky in the group.
*/
isSticky(editorOrIndex: IEditorInput | number): boolean;
/**
* Find out if the provided editor is active in the group.
*/
@@ -517,7 +533,7 @@ export interface IEditorGroup {
*
* @returns a promise when all editors are closed.
*/
closeAllEditors(): Promise<void>;
closeAllEditors(options?: ICloseAllEditorsOptions): Promise<void>;
/**
* Replaces editors in this group with the provided replacement.
@@ -538,6 +554,24 @@ export interface IEditorGroup {
*/
pinEditor(editor?: IEditorInput): void;
/**
* Set an editor to be sticky. A sticky editor is showing in the beginning
* of the tab stripe and will not be impacted by close operations.
*
* @param editor the editor to make sticky, or the currently active editor
* if unspecified.
*/
stickEditor(editor?: IEditorInput): void;
/**
* Set an editor to be non-sticky and thus moves back to a location after
* sticky editors and can be closed normally.
*
* @param editor the editor to make unsticky, or the currently active editor
* if unspecified.
*/
unstickEditor(editor?: IEditorInput): void;
/**
* Move keyboard focus into the group.
*/

View File

@@ -62,6 +62,11 @@ export interface IBaseSaveRevertAllEditorOptions {
* Whether to include untitled editors as well.
*/
readonly includeUntitled?: boolean;
/**
* Whether to exclude sticky editors.
*/
readonly excludeSticky?: boolean;
}
export interface ISaveAllEditorsOptions extends ISaveEditorsOptions, IBaseSaveRevertAllEditorOptions { }
@@ -166,7 +171,8 @@ export interface IEditorService {
*
* @param order the order of the editors to use
*/
getEditors(order: EditorsOrder): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder.MOST_RECENTLY_ACTIVE): ReadonlyArray<IEditorIdentifier>;
getEditors(order: EditorsOrder.SEQUENTIAL, options?: { excludeSticky?: boolean }): ReadonlyArray<IEditorIdentifier>;
/**
* Open an editor in an editor group.
@@ -262,11 +268,15 @@ export interface IEditorService {
/**
* Reverts the provided list of editors.
*
* @returns `true` if all editors reverted and `false` otherwise.
*/
revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<void>;
revert(editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions): Promise<boolean>;
/**
* Reverts all editors.
*
* @returns `true` if all editors reverted and `false` otherwise.
*/
revertAll(options?: IRevertAllEditorsOptions): Promise<void>;
revertAll(options?: IRevertAllEditorsOptions): Promise<boolean>;
}

View File

@@ -461,7 +461,11 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input = new TestFileEditorInput(URI.file('foo/bar'), TEST_EDITOR_INPUT_ID);
const inputInactive = new TestFileEditorInput(URI.file('foo/bar/inactive'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]);
await group.openEditors([
{ editor: input, options: { pinned: true } },
{ editor: inputInactive }
]);
assert.equal(group.count, 2);
assert.equal(group.getEditorByIndex(0), input);
assert.equal(group.getEditorByIndex(1), inputInactive);
@@ -480,7 +484,12 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]);
await group.openEditors([
{ editor: input1, options: { pinned: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
@@ -492,6 +501,42 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('closeEditors (except one, sticky editor)', async () => {
const [part] = createPart();
const group = part.activeGroup;
assert.equal(group.isEmpty, true);
const input1 = new TestFileEditorInput(URI.file('foo/bar1'), TEST_EDITOR_INPUT_ID);
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([
{ editor: input1, options: { pinned: true, sticky: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
assert.equal(group.getEditorByIndex(2), input3);
await group.closeEditors({ except: input2, excludeSticky: true });
assert.equal(group.count, 2);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
await group.closeEditors({ except: input2 });
assert.equal(group.count, 1);
assert.equal(group.stickyCount, 0);
assert.equal(group.getEditorByIndex(0), input2);
part.dispose();
});
test('closeEditors (saved only)', async () => {
const [part] = createPart();
const group = part.activeGroup;
@@ -501,7 +546,12 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]);
await group.openEditors([
{ editor: input1, options: { pinned: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
@@ -512,6 +562,38 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('closeEditors (saved only, sticky editor)', async () => {
const [part] = createPart();
const group = part.activeGroup;
assert.equal(group.isEmpty, true);
const input1 = new TestFileEditorInput(URI.file('foo/bar1'), TEST_EDITOR_INPUT_ID);
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([
{ editor: input1, options: { pinned: true, sticky: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
assert.equal(group.getEditorByIndex(2), input3);
await group.closeEditors({ savedOnly: true, excludeSticky: true });
assert.equal(group.count, 1);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
await group.closeEditors({ savedOnly: true });
assert.equal(group.count, 0);
part.dispose();
});
test('closeEditors (direction: right)', async () => {
const [part] = createPart();
const group = part.activeGroup;
@@ -521,7 +603,12 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]);
await group.openEditors([
{ editor: input1, options: { pinned: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
@@ -534,6 +621,40 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('closeEditors (direction: right, sticky editor)', async () => {
const [part] = createPart();
const group = part.activeGroup;
assert.equal(group.isEmpty, true);
const input1 = new TestFileEditorInput(URI.file('foo/bar1'), TEST_EDITOR_INPUT_ID);
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([
{ editor: input1, options: { pinned: true, sticky: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
assert.equal(group.getEditorByIndex(2), input3);
await group.closeEditors({ direction: CloseDirection.RIGHT, except: input2, excludeSticky: true });
assert.equal(group.count, 2);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
await group.closeEditors({ direction: CloseDirection.RIGHT, except: input2 });
assert.equal(group.count, 2);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
part.dispose();
});
test('closeEditors (direction: left)', async () => {
const [part] = createPart();
const group = part.activeGroup;
@@ -543,7 +664,12 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input1, options: { pinned: true } }, { editor: input2, options: { pinned: true } }, { editor: input3 }]);
await group.openEditors([
{ editor: input1, options: { pinned: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
@@ -556,6 +682,41 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('closeEditors (direction: left, sticky editor)', async () => {
const [part] = createPart();
const group = part.activeGroup;
assert.equal(group.isEmpty, true);
const input1 = new TestFileEditorInput(URI.file('foo/bar1'), TEST_EDITOR_INPUT_ID);
const input2 = new TestFileEditorInput(URI.file('foo/bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.file('foo/bar3'), TEST_EDITOR_INPUT_ID);
await group.openEditors([
{ editor: input1, options: { pinned: true, sticky: true } },
{ editor: input2, options: { pinned: true } },
{ editor: input3 }
]);
assert.equal(group.count, 3);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
assert.equal(group.getEditorByIndex(2), input3);
await group.closeEditors({ direction: CloseDirection.LEFT, except: input2, excludeSticky: true });
assert.equal(group.count, 3);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input1);
assert.equal(group.getEditorByIndex(1), input2);
assert.equal(group.getEditorByIndex(2), input3);
await group.closeEditors({ direction: CloseDirection.LEFT, except: input2 });
assert.equal(group.count, 2);
assert.equal(group.getEditorByIndex(0), input2);
assert.equal(group.getEditorByIndex(1), input3);
part.dispose();
});
test('closeAllEditors', async () => {
const [part] = createPart();
const group = part.activeGroup;
@@ -564,7 +725,11 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
const input = new TestFileEditorInput(URI.file('foo/bar'), TEST_EDITOR_INPUT_ID);
const inputInactive = new TestFileEditorInput(URI.file('foo/bar/inactive'), TEST_EDITOR_INPUT_ID);
await group.openEditors([{ editor: input, options: { pinned: true } }, { editor: inputInactive }]);
await group.openEditors([
{ editor: input, options: { pinned: true } },
{ editor: inputInactive }
]);
assert.equal(group.count, 2);
assert.equal(group.getEditorByIndex(0), input);
assert.equal(group.getEditorByIndex(1), inputInactive);
@@ -574,6 +739,35 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('closeAllEditors (sticky editor)', async () => {
const [part] = createPart();
const group = part.activeGroup;
assert.equal(group.isEmpty, true);
const input = new TestFileEditorInput(URI.file('foo/bar'), TEST_EDITOR_INPUT_ID);
const inputInactive = new TestFileEditorInput(URI.file('foo/bar/inactive'), TEST_EDITOR_INPUT_ID);
await group.openEditors([
{ editor: input, options: { pinned: true, sticky: true } },
{ editor: inputInactive }
]);
assert.equal(group.count, 2);
assert.equal(group.stickyCount, 1);
await group.closeAllEditors({ excludeSticky: true });
assert.equal(group.count, 1);
assert.equal(group.stickyCount, 1);
assert.equal(group.getEditorByIndex(0), input);
await group.closeAllEditors();
assert.equal(group.isEmpty, true);
part.dispose();
});
test('moveEditor (same group)', async () => {
const [part] = createPart();
const group = part.activeGroup;
@@ -724,4 +918,107 @@ suite.skip('EditorGroupsService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('sticky editors', async () => {
const [part] = createPart();
const group = part.activeGroup;
await part.whenRestored;
assert.equal(group.stickyCount, 0);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL).length, 0);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 0);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).length, 0);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: true }).length, 0);
const input = new TestFileEditorInput(URI.file('foo/bar'), TEST_EDITOR_INPUT_ID);
const inputInactive = new TestFileEditorInput(URI.file('foo/bar/inactive'), TEST_EDITOR_INPUT_ID);
await group.openEditor(input, EditorOptions.create({ pinned: true }));
await group.openEditor(inputInactive, EditorOptions.create({ inactive: true }));
assert.equal(group.stickyCount, 0);
assert.equal(group.isSticky(input), false);
assert.equal(group.isSticky(inputInactive), false);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 2);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: true }).length, 2);
group.stickEditor(input);
assert.equal(group.stickyCount, 1);
assert.equal(group.isSticky(input), true);
assert.equal(group.isSticky(inputInactive), false);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 2);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).length, 1);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: true }).length, 1);
group.unstickEditor(input);
assert.equal(group.stickyCount, 0);
assert.equal(group.isSticky(input), false);
assert.equal(group.isSticky(inputInactive), false);
assert.equal(group.getIndexOfEditor(input), 0);
assert.equal(group.getIndexOfEditor(inputInactive), 1);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 2);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: true }).length, 2);
let editorMoveCounter = 0;
const editorGroupChangeListener = group.onDidGroupChange(e => {
if (e.kind === GroupChangeKind.EDITOR_MOVE) {
assert.ok(e.editor);
editorMoveCounter++;
}
});
group.stickEditor(inputInactive);
assert.equal(group.stickyCount, 1);
assert.equal(group.isSticky(input), false);
assert.equal(group.isSticky(inputInactive), true);
assert.equal(group.getIndexOfEditor(input), 1);
assert.equal(group.getIndexOfEditor(inputInactive), 0);
assert.equal(editorMoveCounter, 1);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL).length, 2);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).length, 2);
assert.equal(group.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true }).length, 1);
assert.equal(group.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: true }).length, 1);
const inputSticky = new TestFileEditorInput(URI.file('foo/bar/sticky'), TEST_EDITOR_INPUT_ID);
await group.openEditor(inputSticky, EditorOptions.create({ sticky: true }));
assert.equal(group.stickyCount, 2);
assert.equal(group.isSticky(input), false);
assert.equal(group.isSticky(inputInactive), true);
assert.equal(group.isSticky(inputSticky), true);
assert.equal(group.getIndexOfEditor(inputInactive), 0);
assert.equal(group.getIndexOfEditor(inputSticky), 1);
assert.equal(group.getIndexOfEditor(input), 2);
await group.openEditor(input, EditorOptions.create({ sticky: true }));
assert.equal(group.stickyCount, 3);
assert.equal(group.isSticky(input), true);
assert.equal(group.isSticky(inputInactive), true);
assert.equal(group.isSticky(inputSticky), true);
assert.equal(group.getIndexOfEditor(inputInactive), 0);
assert.equal(group.getIndexOfEditor(inputSticky), 1);
assert.equal(group.getIndexOfEditor(input), 2);
editorGroupChangeListener.dispose();
part.dispose();
});
});

View File

@@ -146,6 +146,22 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
assert.equal(activeEditorChangeEventCounter, 4);
assert.equal(visibleEditorChangeEventCounter, 4);
const stickyInput = new TestFileEditorInput(URI.parse('my://resource3-basics'), TEST_EDITOR_INPUT_ID);
await service.openEditor(stickyInput, { sticky: true });
assert.equal(3, service.count);
const allSequentialEditors = service.getEditors(EditorsOrder.SEQUENTIAL);
assert.equal(allSequentialEditors.length, 3);
assert.equal(stickyInput, allSequentialEditors[0].editor);
assert.equal(input, allSequentialEditors[1].editor);
assert.equal(otherInput, allSequentialEditors[2].editor);
const sequentialEditorsExcludingSticky = service.getEditors(EditorsOrder.SEQUENTIAL, { excludeSticky: true });
assert.equal(sequentialEditorsExcludingSticky.length, 2);
assert.equal(input, sequentialEditorsExcludingSticky[0].editor);
assert.equal(otherInput, sequentialEditorsExcludingSticky[1].editor);
activeEditorChangeListener.dispose();
visibleEditorChangeListener.dispose();
didCloseEditorListener.dispose();
@@ -795,6 +811,10 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
input1.gotSavedAs = false;
input1.gotReverted = false;
input1.dirty = true;
input2.dirty = true;
sameInput1.dirty = true;
await service.save({ groupId: rootGroup.id, editor: input1 }, { saveAs: true });
assert.equal(input1.gotSavedAs, true);
@@ -802,14 +822,24 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
input1.gotSavedAs = false;
input1.gotReverted = false;
await service.revertAll();
input1.dirty = true;
input2.dirty = true;
sameInput1.dirty = true;
const revertRes = await service.revertAll();
assert.equal(revertRes, true);
assert.equal(input1.gotReverted, true);
input1.gotSaved = false;
input1.gotSavedAs = false;
input1.gotReverted = false;
await service.saveAll();
input1.dirty = true;
input2.dirty = true;
sameInput1.dirty = true;
const saveRes = await service.saveAll();
assert.equal(saveRes, true);
assert.equal(input1.gotSaved, true);
assert.equal(input2.gotSaved, true);
@@ -820,6 +850,10 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
input2.gotSavedAs = false;
input2.gotReverted = false;
input1.dirty = true;
input2.dirty = true;
sameInput1.dirty = true;
await service.saveAll({ saveAs: true });
assert.equal(input1.gotSavedAs, true);
@@ -833,6 +867,48 @@ suite.skip('EditorService', () => { // {{SQL CARBON EDIT}} skip suite
part.dispose();
});
test('saveAll, revertAll (sticky editor)', async function () {
const [part, service] = createEditorService();
const input1 = new TestFileEditorInput(URI.parse('my://resource1'), TEST_EDITOR_INPUT_ID);
input1.dirty = true;
const input2 = new TestFileEditorInput(URI.parse('my://resource2'), TEST_EDITOR_INPUT_ID);
input2.dirty = true;
const sameInput1 = new TestFileEditorInput(URI.parse('my://resource1'), TEST_EDITOR_INPUT_ID);
sameInput1.dirty = true;
await part.whenRestored;
await service.openEditor(input1, { pinned: true, sticky: true });
await service.openEditor(input2, { pinned: true });
await service.openEditor(sameInput1, { pinned: true }, SIDE_GROUP);
const revertRes = await service.revertAll({ excludeSticky: true });
assert.equal(revertRes, true);
assert.equal(input1.gotReverted, false);
assert.equal(sameInput1.gotReverted, true);
input1.gotSaved = false;
input1.gotSavedAs = false;
input1.gotReverted = false;
sameInput1.gotSaved = false;
sameInput1.gotSavedAs = false;
sameInput1.gotReverted = false;
input1.dirty = true;
input2.dirty = true;
sameInput1.dirty = true;
const saveRes = await service.saveAll({ excludeSticky: true });
assert.equal(saveRes, true);
assert.equal(input1.gotSaved, false);
assert.equal(input2.gotSaved, true);
assert.equal(sameInput1.gotSaved, true);
part.dispose();
});
test('file delete closes editor', async function () {
return testFileDeleteEditorClose(false);
});

View File

@@ -536,4 +536,37 @@ suite.skip('EditorsObserver', function () { //{{SQL CARBON EDIT}} disable failin
observer.dispose();
part.dispose();
});
test('observer does not close sticky', async () => {
const part = await createPart();
part.enforcePartOptions({ limit: { enabled: true, value: 3 } });
const storage = new TestStorageService();
const observer = new EditorsObserver(part, storage);
const rootGroup = part.activeGroup;
const input1 = new TestFileEditorInput(URI.parse('foo://bar1'), TEST_EDITOR_INPUT_ID);
const input2 = new TestFileEditorInput(URI.parse('foo://bar2'), TEST_EDITOR_INPUT_ID);
const input3 = new TestFileEditorInput(URI.parse('foo://bar3'), TEST_EDITOR_INPUT_ID);
const input4 = new TestFileEditorInput(URI.parse('foo://bar4'), TEST_EDITOR_INPUT_ID);
await rootGroup.openEditor(input1, EditorOptions.create({ pinned: true, sticky: true }));
await rootGroup.openEditor(input2, EditorOptions.create({ pinned: true }));
await rootGroup.openEditor(input3, EditorOptions.create({ pinned: true }));
await rootGroup.openEditor(input4, EditorOptions.create({ pinned: true }));
assert.equal(rootGroup.count, 3);
assert.equal(rootGroup.isOpened(input1), true);
assert.equal(rootGroup.isOpened(input2), false);
assert.equal(rootGroup.isOpened(input3), true);
assert.equal(rootGroup.isOpened(input4), true);
assert.equal(observer.hasEditor(input1.resource), true);
assert.equal(observer.hasEditor(input2.resource), false);
assert.equal(observer.hasEditor(input3.resource), true);
assert.equal(observer.hasEditor(input4.resource), true);
observer.dispose();
part.dispose();
});
});

View File

@@ -18,6 +18,7 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen
readonly configuration: INativeEnvironmentConfiguration;
readonly disableCrashReporter: boolean;
readonly crashReporterDirectory?: string;
readonly cliPath: string;

View File

@@ -6,6 +6,7 @@
import * as nls from 'vs/nls';
import { ChildProcess, fork } from 'child_process';
import { Server, Socket, createServer } from 'net';
import { CrashReporterStartOptions } from 'electron';
import { getPathFromAmdModule } from 'vs/base/common/amd';
import { timeout } from 'vs/base/common/async';
import { toErrorMessage } from 'vs/base/common/errorMessage';
@@ -170,8 +171,17 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
opts.execArgv = ['--inspect-port=0'];
}
const crashReporterOptions = undefined; // TODO@electron pass this in as options to the extension host after verifying this actually works
if (crashReporterOptions) {
// Enable the crash reporter depending on environment for local reporting
const crashesDirectory = this._environmentService.crashReporterDirectory;
if (crashesDirectory) {
const crashReporterOptions: CrashReporterStartOptions = {
companyName: product.crashReporter?.companyName || 'Microsoft',
productName: product.crashReporter?.productName || product.nameShort,
submitURL: '',
uploadToServer: false,
crashesDirectory
};
opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterOptions);
}

View File

@@ -87,6 +87,7 @@ interface IStackEntry {
interface IRecentlyClosedFile {
resource: URI;
index: number;
sticky: boolean;
}
export class HistoryService extends Disposable implements IHistoryService {
@@ -616,7 +617,7 @@ export class HistoryService extends Disposable implements IHistoryService {
// Remove all inputs matching and add as last recently closed
this.removeFromRecentlyClosedFiles(event.editor);
this.recentlyClosedFiles.push({ resource, index: event.index });
this.recentlyClosedFiles.push({ resource, index: event.index, sticky: event.sticky });
// Bounding
if (this.recentlyClosedFiles.length > HistoryService.MAX_RECENTLY_CLOSED_EDITORS) {
@@ -637,7 +638,10 @@ export class HistoryService extends Disposable implements IHistoryService {
if (lastClosedFile) {
(async () => {
const editor = await this.editorService.openEditor({ resource: lastClosedFile.resource, options: { pinned: true, index: lastClosedFile.index } });
const editor = await this.editorService.openEditor({
resource: lastClosedFile.resource,
options: { pinned: true, sticky: lastClosedFile.sticky, index: lastClosedFile.index }
});
// Fix for https://github.com/Microsoft/vscode/issues/67882
// If opening of the editor fails, make sure to try the next one

View File

@@ -47,6 +47,7 @@ import { INavigatorWithKeyboard, IKeyboard } from 'vs/workbench/services/keybind
import { ScanCode, ScanCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE } from 'vs/base/common/scanCode';
import { flatten } from 'vs/base/common/arrays';
import { BrowserFeatures, KeyboardSupport } from 'vs/base/browser/canIUse';
import { ILogService } from 'vs/platform/log/common/log';
interface ContributedKeyBinding {
command: string;
@@ -190,6 +191,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
@IHostService private readonly hostService: IHostService,
@IExtensionService extensionService: IExtensionService,
@IFileService fileService: IFileService,
@ILogService logService: ILogService,
@IKeymapService private readonly keymapService: IKeymapService
) {
super(contextKeyService, commandService, telemetryService, notificationService);
@@ -216,13 +218,14 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
this._cachedResolver = null;
this.userKeybindings = this._register(new UserKeybindings(environmentService.keybindingsResource, fileService));
this.userKeybindings = this._register(new UserKeybindings(environmentService.keybindingsResource, fileService, logService));
this.userKeybindings.initialize().then(() => {
if (this.userKeybindings.keybindings.length) {
this.updateResolver({ source: KeybindingSource.User });
}
});
this._register(this.userKeybindings.onDidChange(() => {
logService.debug('User keybindings changed');
this.updateResolver({
source: KeybindingSource.User,
keybindings: this.userKeybindings.keybindings
@@ -642,7 +645,8 @@ class UserKeybindings extends Disposable {
constructor(
private readonly keybindingsResource: URI,
private readonly fileService: IFileService
private readonly fileService: IFileService,
logService: ILogService,
) {
super();
@@ -651,7 +655,10 @@ class UserKeybindings extends Disposable {
this._onDidChange.fire();
}
}), 50));
this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keybindingsResource))(() => this.reloadConfigurationScheduler.schedule()));
this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keybindingsResource))(() => {
logService.debug('Keybindings file changed');
this.reloadConfigurationScheduler.schedule();
}));
}
async initialize(): Promise<void> {

View File

@@ -115,7 +115,7 @@ suite('KeybindingsEditing', () => {
const fileService = new FileService(new NullLogService());
const diskFileSystemProvider = new DiskFileSystemProvider(new NullLogService());
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService, new NullLogService()));
instantiationService.stub(IFileService, fileService);
instantiationService.stub(IWorkingCopyService, new TestWorkingCopyService());
instantiationService.stub(IWorkingCopyFileService, instantiationService.createInstance(WorkingCopyFileService));

View File

@@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { DelegatedLogService, ILogService, ConsoleLogInMainService, ConsoleLogService, MultiplexLogService } from 'vs/platform/log/common/log';
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
export class DesktopLogService extends DelegatedLogService {
private readonly bufferSpdLogService: BufferLogService | undefined;
private readonly windowId: number;
private readonly environmentService: NativeWorkbenchEnvironmentService;
constructor(windowId: number, mainProcessService: IMainProcessService, environmentService: NativeWorkbenchEnvironmentService) {
const disposables = new DisposableStore();
const loggerClient = new LoggerChannelClient(mainProcessService.getChannel('logger'));
let bufferSpdLogService: BufferLogService | undefined;
// Extension development test CLI: forward everything to main side
const loggers: ILogService[] = [];
if (environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI) {
loggers.push(
disposables.add(new ConsoleLogInMainService(loggerClient, environmentService.configuration.logLevel))
);
}
// Normal logger: spdylog and console
else {
bufferSpdLogService = disposables.add(new BufferLogService(environmentService.configuration.logLevel));
loggers.push(
disposables.add(new ConsoleLogService(environmentService.configuration.logLevel)),
bufferSpdLogService,
);
}
const multiplexLogger = disposables.add(new MultiplexLogService(loggers));
const followerLogger = disposables.add(new FollowerLogService(loggerClient, multiplexLogger));
super(followerLogger);
this.bufferSpdLogService = bufferSpdLogService;
this.windowId = windowId;
this.environmentService = environmentService;
this._register(disposables);
}
init(): void {
if (this.bufferSpdLogService) {
this.bufferSpdLogService.logger = this._register(new SpdLogService(`renderer${this.windowId}`, this.environmentService.logsPath, this.getLevel()));
this.trace('Created Spdlogger');
}
}
}
class DesktopLogServiceInitContribution implements IWorkbenchContribution {
constructor(@ILogService logService: ILogService) {
if (logService instanceof DesktopLogService) {
logService.init();
}
}
}
Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkbenchContribution(DesktopLogServiceInitContribution, LifecyclePhase.Restored);

View File

@@ -349,7 +349,8 @@ export interface ISearchConfigurationProperties {
searchOnTypeDebouncePeriod: number;
searchEditor: {
doubleClickBehaviour: 'selectWord' | 'goToLocation' | 'openLocationToSide',
experimental: { reusePriorSearchConfiguration: boolean }
reusePriorSearchConfiguration: boolean,
experimental: {}
};
sortOrder: SearchSortOrder;
}

View File

@@ -89,6 +89,16 @@ export interface IStatusbarService {
* Allows to update an entry's visibility with the provided ID.
*/
updateEntryVisibility(id: string, visible: boolean): void;
/**
* Focuses the next status bar entry. If none focused, focuses the first.
*/
focusNextEntry(): void;
/**
* Focuses the previous status bar entry. If none focused, focuses the last.
*/
focusPreviousEntry(): void;
}
export interface IStatusbarEntryAccessor extends IDisposable {

View File

@@ -6,7 +6,7 @@
"other": {
"name": "lib-oniguruma",
"downloadUrl": "https://github.com/kkos/oniguruma",
"version": "6.9.5"
"version": "6.9.5_rev1"
}
},
"licenseDetail": [
@@ -41,7 +41,7 @@
],
"isOnlyProductionDependency": true,
"license": "BSD",
"version": "6.9.5"
"version": "6.9.5_rev1"
}
],
"version": 1

View File

@@ -151,11 +151,13 @@ const semanticTokenColorSchema: IJSONSchema = {
properties: {
enabled: {
type: 'boolean',
description: nls.localize('editorColors.semanticHighlighting.enabled', 'Whether semantic highlighting is enabled or disabled for this theme')
description: nls.localize('editorColors.semanticHighlighting.enabled', 'Whether semantic highlighting is enabled or disabled for this theme'),
suggestSortText: '0_enabled'
},
rules: {
$ref: tokenStylingSchemaId,
description: nls.localize('editorColors.semanticHighlighting.rules', 'Semantic token styling rules for this theme.')
description: nls.localize('editorColors.semanticHighlighting.rules', 'Semantic token styling rules for this theme.'),
suggestSortText: '0_rules'
}
},
additionalProperties: false

View File

@@ -13,6 +13,7 @@ import { BACKUPS } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { ReadableStreamEvents } from 'vs/base/common/stream';
import { ILogService } from 'vs/platform/log/common/log';
export class FileUserDataProvider extends Disposable implements
IFileSystemProviderWithFileReadWriteCapability,
@@ -31,7 +32,8 @@ export class FileUserDataProvider extends Disposable implements
private readonly fileSystemUserDataHome: URI,
private readonly fileSystemBackupsHome: URI,
private readonly fileSystemProvider: IFileSystemProviderWithFileReadWriteCapability | IFileSystemProviderWithOpenReadWriteCloseCapability,
environmentService: IWorkbenchEnvironmentService
environmentService: IWorkbenchEnvironmentService,
private readonly logService: ILogService,
) {
super();
@@ -127,6 +129,7 @@ export class FileUserDataProvider extends Disposable implements
}
}
if (userDataChanges.length) {
this.logService.debug('User data changed');
this._onDidChangeFile.fire(userDataChanges);
}
}

View File

@@ -59,7 +59,7 @@ suite('FileUserDataProvider', () => {
const environmentService = new TestBrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId: 'workspaceId', logsPath: URI.file('logFile') });
environmentService.testUserRoamingDataHome = userDataResource;
const userDataFileSystemProvider = new FileUserDataProvider(URI.file(userDataPath), URI.file(backupsPath), diskFileSystemProvider, environmentService);
const userDataFileSystemProvider = new FileUserDataProvider(URI.file(userDataPath), URI.file(backupsPath), diskFileSystemProvider, environmentService, logService);
disposables.add(userDataFileSystemProvider);
disposables.add(testObject.registerProvider(Schemas.userData, userDataFileSystemProvider));
});
@@ -333,7 +333,7 @@ suite('FileUserDataProvider - Watching', () => {
const environmentService = new TestBrowserWorkbenchEnvironmentService({ remoteAuthority: 'remote', workspaceId: 'workspaceId', logsPath: URI.file('logFile') });
environmentService.testUserRoamingDataHome = userDataResource;
const userDataFileSystemProvider = new FileUserDataProvider(localUserDataResource, localBackupsResource, new TestFileSystemProvider(fileEventEmitter.event), environmentService);
const userDataFileSystemProvider = new FileUserDataProvider(localUserDataResource, localBackupsResource, new TestFileSystemProvider(fileEventEmitter.event), environmentService, new NullLogService());
disposables.add(userDataFileSystemProvider);
testObject = new FileService(new NullLogService());

View File

@@ -1,33 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IUserDataAutoSyncService, UserDataSyncError } from 'vs/platform/userDataSync/common/userDataSync';
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { Disposable } from 'vs/base/common/lifecycle';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { Event } from 'vs/base/common/event';
export class UserDataAutoSyncService extends Disposable implements IUserDataAutoSyncService {
_serviceBrand: undefined;
private readonly channel: IChannel;
get onError(): Event<UserDataSyncError> { return Event.map(this.channel.listen<Error>('onError'), e => UserDataSyncError.toUserDataSyncError(e)); }
constructor(
@ISharedProcessService sharedProcessService: ISharedProcessService
) {
super();
this.channel = sharedProcessService.getChannel('userDataAutoSync');
}
triggerAutoSync(sources: string[]): Promise<void> {
return this.channel.call('triggerAutoSync', [sources]);
}
}
registerSingleton(IUserDataAutoSyncService, UserDataAutoSyncService);

View File

@@ -119,7 +119,7 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
// Try generating all generated containers that don't need extensions
this.tryGenerateContainers();
this._register(this.viewsRegistry.onViewsRegistered(({ views, viewContainer }) => this.onDidRegisterViews(views, viewContainer)));
this._register(this.viewsRegistry.onViewsRegistered(views => this.onDidRegisterViews(views)));
this._register(this.viewsRegistry.onViewsDeregistered(({ views, viewContainer }) => this.onDidDeregisterViews(views, viewContainer)));
this._register(this.viewsRegistry.onDidChangeContainer(({ views, from, to }) => this.moveViews(views, from, to)));
@@ -212,16 +212,18 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
this.tryGenerateContainers(true);
}
private onDidRegisterViews(views: IViewDescriptor[], viewContainer: ViewContainer): void {
// When views are registered, we need to regroup them based on the cache
const regroupedViews = this.regroupViews(viewContainer.id, views);
private onDidRegisterViews(views: { views: IViewDescriptor[], viewContainer: ViewContainer }[]): void {
views.forEach(({ views, viewContainer }) => {
// When views are registered, we need to regroup them based on the cache
const regroupedViews = this.regroupViews(viewContainer.id, views);
// Once they are grouped, try registering them which occurs
// if the container has already been registered within this service
// or we can generate the container from the source view id
this.registerGroupedViews(regroupedViews);
// Once they are grouped, try registering them which occurs
// if the container has already been registered within this service
// or we can generate the container from the source view id
this.registerGroupedViews(regroupedViews);
views.forEach(viewDescriptor => this.getOrCreateMovableViewContextKey(viewDescriptor).set(!!viewDescriptor.canMoveView));
views.forEach(viewDescriptor => this.getOrCreateMovableViewContextKey(viewDescriptor).set(!!viewDescriptor.canMoveView));
});
}
private shouldGenerateContainer(containerInfo: ICachedViewContainerInfo): boolean {