Skip to content

Commit 438bb09

Browse files
committed
fix #285 export serverForUri function as API
1 parent 3eee6a6 commit 438bb09

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/extension.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ async function serverManager(): Promise<any> {
356356
}
357357
}
358358

359-
export async function activate(context: vscode.ExtensionContext): Promise<void> {
359+
export async function activate(context: vscode.ExtensionContext): Promise<any> {
360360
if (!packageJson.version.includes("SNAPSHOT")) {
361361
reporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);
362362
}
@@ -687,10 +687,23 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
687687
new ObjectScriptClassCodeLensProvider()
688688
),
689689

690-
/* from proposed api */
690+
/* Anything we use from the VS Code proposed API */
691691
...proposed
692692
);
693693
reporter && reporter.sendTelemetryEvent("extensionActivated");
694+
695+
// The API we export
696+
const api = {
697+
serverForUri(uri: vscode.Uri): any {
698+
const { apiTarget } = connectionTarget(uri);
699+
const api = new AtelierAPI(apiTarget);
700+
const { host = "", https, port = 0, pathPrefix, username, password, ns = "" } = api.config;
701+
return { scheme: https ? "https" : "http", host, port, pathPrefix, username, password, namespace: ns };
702+
},
703+
};
704+
705+
// 'export' our public API
706+
return api;
694707
}
695708

696709
export function deactivate(): void {

0 commit comments

Comments
 (0)