@@ -12,14 +12,15 @@ import { ILanguageServerOutputChannel } from './activation/types';
1212import { IExtensionApi } from './apiTypes' ;
1313import { isTestExecution , PYTHON_LANGUAGE } from './common/constants' ;
1414import { IConfigurationService , Resource } from './common/types' ;
15- import { IEnvironmentVariablesProvider } from './common/variables/types' ;
1615import { getDebugpyLauncherArgs , getDebugpyPackagePath } from './debugger/extension/adapter/remoteLaunchers' ;
1716import { IInterpreterService } from './interpreter/contracts' ;
1817import { IServiceContainer , IServiceManager } from './ioc/types' ;
1918import { JupyterExtensionIntegration } from './jupyter/jupyterIntegration' ;
2019import { traceError } from './logging' ;
2120import { IDiscoveryAPI } from './pythonEnvironments/base/locator' ;
2221import { buildEnvironmentApi } from './environmentApi' ;
22+ import { ApiForPylance } from './pylanceApi' ;
23+ import { getTelemetryReporter } from './telemetry' ;
2324
2425export function buildApi (
2526 ready : Promise < any > ,
@@ -31,21 +32,14 @@ export function buildApi(
3132 const interpreterService = serviceContainer . get < IInterpreterService > ( IInterpreterService ) ;
3233 serviceManager . addSingleton < JupyterExtensionIntegration > ( JupyterExtensionIntegration , JupyterExtensionIntegration ) ;
3334 const jupyterIntegration = serviceContainer . get < JupyterExtensionIntegration > ( JupyterExtensionIntegration ) ;
34- const envService = serviceContainer . get < IEnvironmentVariablesProvider > ( IEnvironmentVariablesProvider ) ;
3535 const outputChannel = serviceContainer . get < ILanguageServerOutputChannel > ( ILanguageServerOutputChannel ) ;
3636
3737 const api : IExtensionApi & {
3838 /**
3939 * @deprecated Temporarily exposed for Pylance until we expose this API generally. Will be removed in an
4040 * iteration or two.
4141 */
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 ;
4943 } & {
5044 /**
5145 * @deprecated Use IExtensionApi.environments API instead.
@@ -126,11 +120,6 @@ export function buildApi(
126120 : ( noop as any ) ,
127121 } ,
128122 pylance : {
129- getPythonPathVar : async ( resource ?: Uri ) => {
130- const envs = await envService . getEnvironmentVariables ( resource ) ;
131- return envs . PYTHONPATH ;
132- } ,
133- onDidEnvironmentVariablesChange : envService . onDidEnvironmentVariablesChange ,
134123 createClient : ( ...args : any [ ] ) : BaseLanguageClient => {
135124 // Make sure we share output channel so that we can share one with
136125 // Jedi as well.
@@ -141,6 +130,7 @@ export function buildApi(
141130 } ,
142131 start : ( client : BaseLanguageClient ) : Promise < void > => client . start ( ) ,
143132 stop : ( client : BaseLanguageClient ) : Promise < void > => client . stop ( ) ,
133+ getTelemetryReporter : ( ) => getTelemetryReporter ( ) ,
144134 } ,
145135 environments : buildEnvironmentApi ( discoveryApi , serviceContainer ) ,
146136 } ;
0 commit comments