diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts b/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts index 0b74fe88326..0dc0380c832 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.ts @@ -541,7 +541,7 @@ export class NotebookCellOutline implements IOutline { async reveal(entry: OutlineEntry, options: IEditorOptions, sideBySide: boolean): Promise { await this._editorService.openEditor({ resource: entry.cell.uri, - options, + options: { ...options, override: this._editor.input?.editorId }, }, sideBySide ? SIDE_GROUP : undefined); } diff --git a/src/vs/workbench/contrib/outline/browser/outlinePane.ts b/src/vs/workbench/contrib/outline/browser/outlinePane.ts index a8b15e152c1..ede5439808f 100644 --- a/src/vs/workbench/contrib/outline/browser/outlinePane.ts +++ b/src/vs/workbench/contrib/outline/browser/outlinePane.ts @@ -37,9 +37,6 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { Event } from 'vs/base/common/event'; import { ITreeSorter } from 'vs/base/browser/ui/tree/tree'; import { URI } from 'vs/base/common/uri'; -import { EditorResolution } from 'vs/platform/editor/common/editor'; -import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput'; -import { CustomEditorInput } from 'vs/workbench/contrib/customEditor/browser/customEditorInput'; const _ctxFollowsCursor = new RawContextKey('outlineFollowsCursor', false); const _ctxFilterOnType = new RawContextKey('outlineFiltersOnType', false); @@ -287,13 +284,7 @@ export class OutlinePane extends ViewPane { // feature: reveal outline selection in editor // on change -> reveal/select defining range - this._editorDisposables.add(tree.onDidOpen(e => { - let override: EditorResolution | string = EditorResolution.DISABLED; - if (this._editorService.activeEditor instanceof NotebookEditorInput || this._editorService.activeEditor instanceof CustomEditorInput) { - override = this._editorService.activeEditor.viewType; - } - newOutline.reveal(e.element, { ...e.editorOptions, override }, e.sideBySide); - })); + this._editorDisposables.add(tree.onDidOpen(e => newOutline.reveal(e.element, e.editorOptions, e.sideBySide))); // feature: reveal editor selection in outline const revealActiveElement = () => { if (!this._outlineViewState.followCursor || !newOutline.activeElement) { diff --git a/src/vs/workbench/services/editor/browser/codeEditorService.ts b/src/vs/workbench/services/editor/browser/codeEditorService.ts index 05d2321431a..fbcb72e513e 100644 --- a/src/vs/workbench/services/editor/browser/codeEditorService.ts +++ b/src/vs/workbench/services/editor/browser/codeEditorService.ts @@ -8,7 +8,7 @@ import { CodeEditorServiceImpl } from 'vs/editor/browser/services/codeEditorServ import { ScrollType } from 'vs/editor/common/editorCommon'; import { IResourceEditorInput } from 'vs/platform/editor/common/editor'; import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor'; +import { DEFAULT_EDITOR_ASSOCIATION, IWorkbenchEditorConfiguration } from 'vs/workbench/common/editor'; import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; @@ -46,6 +46,9 @@ export class CodeEditorService extends CodeEditorServiceImpl { async openCodeEditor(input: IResourceEditorInput, source: ICodeEditor | null, sideBySide?: boolean): Promise { + // Always use the text editor for code editors + input.options = { ...input.options, override: DEFAULT_EDITOR_ASSOCIATION.id }; + // 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 // side as separate editor.