Skip to content

extension host: new Range() is missing fields over Comlink

Created by: chrismwendt

If an extension returns a new sourcegraph.Range(...), only internal fields like _start and _end will be set and accessing .start or .end will not work in the web UI, causing all sorts of problems. This probably applies to other classes in the extension API, too.

I think this is due to some combination of using JS properties, serialization/deserialization across the web worker boundary, and Comlink.

A few ideas (not sure which ones will work):

  • Do not use JS properties in the Sourcegraph extension API
  • Reconstruct objects that use JS properties post-deserialization

From https://github.com/sourcegraph/code-intel-extensions/pull/771#discussion_r840018010