Skip to content
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Commit 0d04f5b

Browse files
committed
feat: expose extension roots as Observable
1 parent 6c776fa commit 0d04f5b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/extension/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface SourcegraphExtensionAPI<C = Settings> {
2222
* TODO(sqs): Remove the strict association with the single initial root (support multi-root, changing roots,
2323
* etc.).
2424
*/
25-
root: URI | null
25+
roots: Observable<URI[]>
2626

2727
/**
2828
* The configuration settings from the client.

src/extension/extension.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Subscription } from 'rxjs'
1+
import { BehaviorSubject, Subscription } from 'rxjs'
22
import { createMessageConnection, Logger, MessageConnection, MessageTransports } from '../jsonrpc2/connection'
33
import {
44
ConfigurationCascade,
@@ -28,6 +28,7 @@ class ExtensionHandle<C> implements SourcegraphExtensionAPI<C> {
2828
constructor(public readonly rawConnection: MessageConnection, public readonly initializeParams: InitializeParams) {
2929
this.subscription.add(this.rawConnection)
3030

31+
this.roots = new BehaviorSubject<URI[]>(initializeParams.root ? [initializeParams.root] : [])
3132
this.configuration = createExtConfiguration<C>(
3233
this,
3334
initializeParams.configurationCascade as ConfigurationCascade<C>

0 commit comments

Comments
 (0)