@@ -12,14 +12,15 @@ import { ILanguageServerOutputChannel } from './activation/types';
12
12
import { IExtensionApi } from './apiTypes' ;
13
13
import { isTestExecution , PYTHON_LANGUAGE } from './common/constants' ;
14
14
import { IConfigurationService , Resource } from './common/types' ;
15
- import { IEnvironmentVariablesProvider } from './common/variables/types' ;
16
15
import { getDebugpyLauncherArgs , getDebugpyPackagePath } from './debugger/extension/adapter/remoteLaunchers' ;
17
16
import { IInterpreterService } from './interpreter/contracts' ;
18
17
import { IServiceContainer , IServiceManager } from './ioc/types' ;
19
18
import { JupyterExtensionIntegration } from './jupyter/jupyterIntegration' ;
20
19
import { traceError } from './logging' ;
21
20
import { IDiscoveryAPI } from './pythonEnvironments/base/locator' ;
22
21
import { buildEnvironmentApi } from './environmentApi' ;
22
+ import { ApiForPylance } from './pylanceApi' ;
23
+ import { getTelemetryReporter } from './telemetry' ;
23
24
24
25
export function buildApi (
25
26
ready : Promise < any > ,
@@ -31,21 +32,14 @@ export function buildApi(
31
32
const interpreterService = serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
32
33
serviceManager . addSingleton < JupyterExtensionIntegration > ( JupyterExtensionIntegration , JupyterExtensionIntegration ) ;
33
34
const jupyterIntegration = serviceContainer . get < JupyterExtensionIntegration > ( JupyterExtensionIntegration ) ;
34
- const envService = serviceContainer . get < IEnvironmentVariablesProvider > ( IEnvironmentVariablesProvider ) ;
35
35
const outputChannel = serviceContainer . get < ILanguageServerOutputChannel > ( ILanguageServerOutputChannel ) ;
36
36
37
37
const api : IExtensionApi & {
38
38
/**
39
39
* @deprecated Temporarily exposed for Pylance until we expose this API generally. Will be removed in an
40
40
* iteration or two.
41
41
*/
42
- pylance : {
43
- getPythonPathVar : ( resource ?: Uri ) => Promise < string | undefined > ;
44
- readonly onDidEnvironmentVariablesChange : Event < Uri | undefined > ;
45
- createClient ( ...args : any [ ] ) : BaseLanguageClient ;
46
- start ( client : BaseLanguageClient ) : Promise < void > ;
47
- stop ( client : BaseLanguageClient ) : Promise < void > ;
48
- } ;
42
+ pylance : ApiForPylance ;
49
43
} & {
50
44
/**
51
45
* @deprecated Use IExtensionApi.environments API instead.
@@ -126,11 +120,6 @@ export function buildApi(
126
120
: ( noop as any ) ,
127
121
} ,
128
122
pylance : {
129
- getPythonPathVar : async ( resource ?: Uri ) => {
130
- const envs = await envService . getEnvironmentVariables ( resource ) ;
131
- return envs . PYTHONPATH ;
132
- } ,
133
- onDidEnvironmentVariablesChange : envService . onDidEnvironmentVariablesChange ,
134
123
createClient : ( ...args : any [ ] ) : BaseLanguageClient => {
135
124
// Make sure we share output channel so that we can share one with
136
125
// Jedi as well.
@@ -141,6 +130,7 @@ export function buildApi(
141
130
} ,
142
131
start : ( client : BaseLanguageClient ) : Promise < void > => client . start ( ) ,
143
132
stop : ( client : BaseLanguageClient ) : Promise < void > => client . stop ( ) ,
133
+ getTelemetryReporter : ( ) => getTelemetryReporter ( ) ,
144
134
} ,
145
135
environments : buildEnvironmentApi ( discoveryApi , serviceContainer ) ,
146
136
} ;
0 commit comments