@@ -108,10 +108,12 @@ export class LanguageClientsManager {
108108 this . pythonManager . pythonExtension ?. exports . settings . onDidChangeExecutionDetails ( async ( uri ) => {
109109 if ( uri !== undefined ) {
110110 const folder = vscode . workspace . getWorkspaceFolder ( uri ) ;
111+ let needsRestart = false ;
111112 if ( folder !== undefined ) {
112- this . _pythonValidPythonAndRobotEnv . delete ( folder ) ;
113+ needsRestart = this . _pythonValidPythonAndRobotEnv . has ( folder ) ;
114+ if ( needsRestart ) this . _pythonValidPythonAndRobotEnv . delete ( folder ) ;
113115 }
114- await this . refresh ( uri ) ;
116+ await this . refresh ( uri , needsRestart ) ;
115117 } else {
116118 await this . restart ( ) ;
117119 }
@@ -441,7 +443,7 @@ export class LanguageClientsManager {
441443 await this . refresh ( ) ;
442444 }
443445
444- public async refresh ( uri ?: vscode . Uri ) : Promise < void > {
446+ public async refresh ( uri ?: vscode . Uri , restart ?: boolean ) : Promise < void > {
445447 await this . clientsMutex . dispatch ( async ( ) => {
446448 if ( uri ) {
447449 const workspaceFolder = vscode . workspace . getWorkspaceFolder ( uri ) ;
@@ -464,6 +466,13 @@ export class LanguageClientsManager {
464466
465467 const folders = new Set < vscode . WorkspaceFolder > ( ) ;
466468
469+ if ( uri != undefined && restart ) {
470+ const workspaceFolder = vscode . workspace . getWorkspaceFolder ( uri ) ;
471+ if ( workspaceFolder ) {
472+ folders . add ( workspaceFolder ) ;
473+ }
474+ }
475+
467476 for ( const document of vscode . workspace . textDocuments ) {
468477 if ( document . languageId === "robotframework" ) {
469478 const workspaceFolder = vscode . workspace . getWorkspaceFolder ( document . uri ) ;
0 commit comments