This commit is contained in:
Logan Ramos 2021-07-07 15:11:11 -04:00
parent fe7e9988e1
commit 1cbd1c6b65
No known key found for this signature in database
GPG key ID: D9CCFF14F0B18183
3 changed files with 6 additions and 12 deletions

View file

@ -541,7 +541,7 @@ export class NotebookCellOutline implements IOutline<OutlineEntry> {
async reveal(entry: OutlineEntry, options: IEditorOptions, sideBySide: boolean): Promise<void> {
await this._editorService.openEditor({
resource: entry.cell.uri,
options,
options: { ...options, override: this._editor.input?.editorId },
}, sideBySide ? SIDE_GROUP : undefined);
}

View file

@ -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) {

View file

@ -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<ICodeEditor | null> {
// 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.