forked from karrtikr/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.ts
More file actions
32 lines (27 loc) · 1.17 KB
/
api.ts
File metadata and controls
32 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { BaseLanguageClient } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/browser';
import { PYTHON_LANGUAGE } from '../common/constants';
import { ApiForPylance, TelemetryReporter } from '../pylanceApi';
export interface IBrowserExtensionApi {
/**
* @deprecated Temporarily exposed for Pylance until we expose this API generally. Will be removed in an
* iteration or two.
*/
pylance: ApiForPylance;
}
export function buildApi(reporter: TelemetryReporter): IBrowserExtensionApi {
const api: IBrowserExtensionApi = {
pylance: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
createClient: (...args: any[]): BaseLanguageClient =>
new LanguageClient(PYTHON_LANGUAGE, 'Python Language Server', args[0], args[1]),
start: (client: BaseLanguageClient): Promise<void> => client.start(),
stop: (client: BaseLanguageClient): Promise<void> => client.stop(),
getTelemetryReporter: () => reporter,
},
};
return api;
}