Remove editorOpenWith (#116856)

* Move editorOpenWith to the editorService

* Remove custom editor input handling

* Fix open with API command

* adopt master properly

* Remove dnagling comment

* Address some feedback

* Cleanup region comment.

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>

* Cleanup region comment.

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>

* Update override typings

* Fix missing picker

* Fix bug with reopen with

* Remove duplicate import

* First round of feedback via changes
- OverrideOptions => EditorOverride
- It is safe to destructure (...) undefined
- Ensure when destructuring, override is always winning
- Not a big fan of shared builtinProviderDisplayName import

* editorservice - static DEFAULT_EDITOR_OVERRIDE_ID

* editors - introduce a editor associations registry

This moves the relevant code out of the editor service.

* cleanup editor picking

* cleanup editor delegate

* final 💄

Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
This commit is contained in:
Logan Ramos
2021-02-22 17:16:15 -05:00
committed by GitHub
parent cdd7066f00
commit 413963c489
25 changed files with 484 additions and 515 deletions

View File

@@ -13,8 +13,7 @@ import { Schemas } from 'vs/base/common/network';
import { isEqual } from 'vs/base/common/resources';
import { URI, UriComponents } from 'vs/base/common/uri';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { EditorActivation, ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { EditorActivation, ITextEditorOptions, EditorOverride } from 'vs/platform/editor/common/editor';
import { ILogService } from 'vs/platform/log/common/log';
import { BoundModelReferenceCollection } from 'vs/workbench/api/browser/mainThreadDocuments';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
@@ -27,7 +26,6 @@ import { ICellEditOperation, ICellRange, IEditor, IMainCellDto, INotebookDecorat
import { INotebookEditorModelResolverService } from 'vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
import { IEditorGroup, IEditorGroupsService, preferredSideBySideGroupDirection } from 'vs/workbench/services/editor/common/editorGroupsService';
import { openEditorWith } from 'vs/workbench/services/editor/common/editorOpenWith';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
@@ -128,8 +126,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
@ILogService private readonly _logService: ILogService,
@INotebookCellStatusBarService private readonly _cellStatusBarService: INotebookCellStatusBarService,
@INotebookEditorModelResolverService private readonly _notebookModelResolverService: INotebookEditorModelResolverService,
@IUriIdentityService private readonly _uriIdentityService: IUriIdentityService,
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IUriIdentityService private readonly _uriIdentityService: IUriIdentityService
) {
super();
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostNotebook);
@@ -663,7 +660,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
// preserve pre 1.38 behaviour to not make group active when preserveFocus: true
// but make sure to restore the editor to fix https://github.com/microsoft/vscode/issues/79633
activation: options.preserveFocus ? EditorActivation.RESTORE : undefined,
override: false,
override: EditorOverride.DISABLED,
};
const columnArg = viewColumnToEditorGroup(this._editorGroupsService, options.position);
@@ -685,7 +682,7 @@ export class MainThreadNotebooks extends Disposable implements MainThreadNoteboo
const input = this._editorService.createEditorInput({ resource: URI.revive(resource), options: editorOptions });
// TODO: handle options.selection
const editorPane = await this._instantiationService.invokeFunction(openEditorWith, input, viewType, options, group);
const editorPane = await this._editorService.openEditor(input, { ...options, override: viewType }, group);
const notebookEditor = (editorPane as unknown as { isNotebookEditor?: boolean })?.isNotebookEditor ? (editorPane!.getControl() as INotebookEditor) : undefined;
if (notebookEditor) {