提交 af070ee0 编写于 作者: M Matt Bierner

Move custom editor extension activation out of input

Inputs should not need to know about extensions
上级 64023bd1
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册