Skip to content

Allow extensions to get a handle to other extensions' activate func results

Created by: sqs

Extensions should be able to retrieve another extension's API, which is defined as the value returned by the extension's activate function. (This is possible in the same way in VS Code extensions.)

Consider 2 extensions, alice/a and bob/b:

alice/a:

/** API for extension A. */
interface A {
  foo(): string
}

export function activate(): A {
  return { foo: () => 'hello, world!' }
}

bob/b:

import * as sourcegraph from 'sourcegraph'

export async function activate(): void {
  console.log(sourcegraph.extensions.get('alice/a').foo())
}

When bob/b is activated, it should print hello, world!.

Depends on #1120