Clean up client API
- Don't use "any" for the API type. - Remove everything from the Coder API that can eventually be done through the VS Code API. - Move the event emission to our own client to minimize patching.
This commit is contained in:
@ -573,34 +573,27 @@ index 5a758eb786..7fcacb5ca7 100644
|
||||
templateData.actionBar.context = (<TreeViewItemHandleArg>{ $treeViewId: this.treeViewId, $treeItemHandle: node.handle });
|
||||
templateData.actionBar.push(this.menus.getResourceActions(node), { icon: true, label: false });
|
||||
diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts
|
||||
index 1986fb6642..a3e4cbdb56 100644
|
||||
index 1986fb6642..453d3e3e48 100644
|
||||
--- a/src/vs/workbench/browser/web.main.ts
|
||||
+++ b/src/vs/workbench/browser/web.main.ts
|
||||
@@ -35,6 +35,7 @@ import { SignService } from 'vs/platform/sign/browser/signService';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
|
||||
import { ProductService } from 'vs/platform/product/browser/productService';
|
||||
+import { coderApi, vscodeApi } from 'vs/server/src/api';
|
||||
+import { initialize } from 'vs/server/src/client';
|
||||
|
||||
class CodeRendererMain extends Disposable {
|
||||
|
||||
@@ -71,6 +72,15 @@ class CodeRendererMain extends Disposable {
|
||||
@@ -71,6 +72,8 @@ class CodeRendererMain extends Disposable {
|
||||
|
||||
// Startup
|
||||
this.workbench.startup();
|
||||
+
|
||||
+ const target = window as any;
|
||||
+ target.ide = coderApi(services.serviceCollection);
|
||||
+ target.vscode = vscodeApi(services.serviceCollection);
|
||||
+
|
||||
+ const event = new CustomEvent('ide-ready');
|
||||
+ (event as any).ide = target.ide;
|
||||
+ (event as any).vscode = target.vscode;
|
||||
+ window.dispatchEvent(event);
|
||||
+ initialize(services.serviceCollection);
|
||||
}
|
||||
|
||||
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService }> {
|
||||
@@ -114,7 +124,8 @@ class CodeRendererMain extends Disposable {
|
||||
@@ -114,7 +117,8 @@ class CodeRendererMain extends Disposable {
|
||||
const channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
|
||||
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
|
||||
|
||||
@ -1422,7 +1415,7 @@ index 306d58f915..58c603ad3d 100644
|
||||
if (definition.fontCharacter || definition.fontColor) {
|
||||
let body = '';
|
||||
diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts
|
||||
index c28adc0ad9..3d1adba3d9 100644
|
||||
index c28adc0ad9..4517c308da 100644
|
||||
--- a/src/vs/workbench/workbench.web.main.ts
|
||||
+++ b/src/vs/workbench/workbench.web.main.ts
|
||||
@@ -128,7 +128,7 @@ import 'vs/workbench/services/extensions/browser/extensionService';
|
||||
@ -1447,9 +1440,3 @@ index c28adc0ad9..3d1adba3d9 100644
|
||||
|
||||
// Output Panel
|
||||
import 'vs/workbench/contrib/output/browser/output.contribution';
|
||||
@@ -356,3 +356,5 @@ import 'vs/workbench/contrib/outline/browser/outline.contribution';
|
||||
// import 'vs/workbench/contrib/issue/electron-browser/issue.contribution';
|
||||
|
||||
//#endregion
|
||||
+
|
||||
+import 'vs/server/src/client';
|
||||
|
Reference in New Issue
Block a user