mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Move custom editor extension activation out of input
Inputs should not need to know about extensions
This commit is contained in:
@@ -96,6 +96,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews
|
||||
this._register(_webviewEditorService.registerResolver({
|
||||
canResolve: (webview: WebviewInput) => {
|
||||
if (webview.getTypeId() === CustomFileEditorInput.typeId) {
|
||||
extensionService.activateByEvent(`onWebviewEditor:${(webview as CustomFileEditorInput).viewType}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import { ConfirmResult, IEditorInput, Verbosity } from 'vs/workbench/common/edit
|
||||
import { WebviewEditorOverlay } from 'vs/workbench/contrib/webview/browser/webview';
|
||||
import { WebviewInput } from 'vs/workbench/contrib/webview/browser/webviewEditorInput';
|
||||
import { IWebviewEditorService } from 'vs/workbench/contrib/webview/browser/webviewEditorService';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { promptSave } from 'vs/workbench/services/textfile/browser/textFileService';
|
||||
|
||||
export class CustomFileEditorInput extends WebviewInput {
|
||||
@@ -35,7 +34,6 @@ export class CustomFileEditorInput extends WebviewInput {
|
||||
webview: UnownedDisposable<WebviewEditorOverlay>,
|
||||
@ILabelService private readonly labelService: ILabelService,
|
||||
@IWebviewEditorService private readonly _webviewEditorService: IWebviewEditorService,
|
||||
@IExtensionService private readonly _extensionService: IExtensionService,
|
||||
@IDialogService private readonly dialogService: IDialogService,
|
||||
) {
|
||||
super(id, viewType, '', webview);
|
||||
@@ -93,7 +91,6 @@ export class CustomFileEditorInput extends WebviewInput {
|
||||
public async resolve(): Promise<IEditorModel> {
|
||||
if (!this._hasResolved) {
|
||||
this._hasResolved = true;
|
||||
this._extensionService.activateByEvent(`onWebviewEditor:${this.viewType}`);
|
||||
await this._webviewEditorService.resolveWebview(this);
|
||||
}
|
||||
return super.resolve();
|
||||
|
||||
Reference in New Issue
Block a user