@@ -5,6 +5,7 @@ import { CodeLensProvider, TextDocument, CancellationToken, CodeLens, SymbolInfo
55import { TestFile , TestsToRun , TestSuite , TestFunction , TestStatus } from '../common/contracts' ;
66import * as constants from '../../common/constants' ;
77import { getDiscoveredTests } from '../common/testUtils' ;
8+ import { PythonSymbolProvider } from '../../providers/symbolProvider' ;
89
910interface CodeLensData {
1011 symbolKind : vscode . SymbolKind ;
@@ -17,7 +18,7 @@ interface FunctionsAndSuites {
1718}
1819
1920export class TestFileCodeLensProvider implements CodeLensProvider {
20- constructor ( private _onDidChange : vscode . EventEmitter < void > ) {
21+ constructor ( private _onDidChange : vscode . EventEmitter < void > , private symbolProvider : PythonSymbolProvider ) {
2122 }
2223
2324 get onDidChangeCodeLenses ( ) : vscode . Event < void > {
@@ -41,7 +42,7 @@ export class TestFileCodeLensProvider implements CodeLensProvider {
4142 }
4243 } , constants . Delays . MaxUnitTestCodeLensDelay ) ;
4344
44- return getCodeLenses ( document . uri , token ) ;
45+ return getCodeLenses ( document , token , this . symbolProvider ) ;
4546 }
4647
4748 resolveCodeLens ( codeLens : CodeLens , token : CancellationToken ) : CodeLens | Thenable < CodeLens > {
@@ -50,7 +51,8 @@ export class TestFileCodeLensProvider implements CodeLensProvider {
5051 }
5152}
5253
53- function getCodeLenses ( documentUri : vscode . Uri , token : vscode . CancellationToken ) : Thenable < CodeLens [ ] > {
54+ function getCodeLenses ( document : vscode . TextDocument , token : vscode . CancellationToken , symbolProvider : PythonSymbolProvider ) : Thenable < CodeLens [ ] > {
55+ const documentUri = document . uri ;
5456 const tests = getDiscoveredTests ( ) ;
5557 if ( ! tests ) {
5658 return null ;
@@ -61,7 +63,7 @@ function getCodeLenses(documentUri: vscode.Uri, token: vscode.CancellationToken)
6163 }
6264 const allFuncsAndSuites = getAllTestSuitesAndFunctionsPerFile ( file ) ;
6365
64- return vscode . commands . executeCommand ( 'vscode.executeDocumentSymbolProvider' , documentUri , token )
66+ return symbolProvider . provideDocumentSymbolsForInternalUse ( document , token )
6567 . then ( ( symbols : vscode . SymbolInformation [ ] ) => {
6668 return symbols . filter ( symbol => {
6769 return symbol . kind === vscode . SymbolKind . Function ||
0 commit comments