Move the webviewResourceRoot property to be set on each webview instead of as a global property

For #72155

This allows  us to potentially change the resource root per webview
This commit is contained in:
Matt Bierner
2019-06-24 15:42:14 -07:00
parent 1083123758
commit 8119b4aee7
14 changed files with 57 additions and 38 deletions

View File

@@ -12,6 +12,7 @@ import { IWebviewService, Webview } from 'vs/workbench/contrib/webview/common/we
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IActiveCodeEditor, IViewZone } from 'vs/editor/browser/editorBrowser';
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
// todo@joh move these things back into something like contrib/insets
class EditorWebviewZone implements IViewZone {
@@ -59,6 +60,7 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape {
constructor(
context: IExtHostContext,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@ICodeEditorService private readonly _editorService: ICodeEditorService,
@IWebviewService private readonly _webviewService: IWebviewService,
) {
@@ -144,4 +146,8 @@ export class MainThreadEditorInsets implements MainThreadEditorInsetsShape {
}
return Promise.resolve(false);
}
async $getResourceRoot(_handle: number): Promise<string> {
return this._environmentService.webviewResourceRoot;
}
}