sourcegraph / openctx

See contextual info about code from your dev tools, in your editor, code review, and anywhere else you read code.
https://openctx.org
Apache License 2.0
135 stars 14 forks source link

@openctx/vscode-lib controller doesn't work in web worker context #169

Open vovakulikov opened 2 months ago

vovakulikov commented 2 months ago

In some consumers (like Cody Web) it should be possible to run/create openctx controller within web worker, at the moment since init logic here https://github.com/sourcegraph/openctx/blob/main/client/vscode-lib/src/global.ts uses global. statement it breaks initialisation for Cody Web.

As a temporal workaround, I added self.global = {} to avoid this problem in Cody Web, but eventually, I think a fix should be done here, maybe instead of global.openctx we could share vscode API through singleton