Skip to content

Commit 9147114

Browse files
committed
if configuration changed only restart clients that are affected
1 parent a94a1de commit 9147114

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

vscode-client/extension.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,26 @@ export async function activateAsync(context: vscode.ExtensionContext): Promise<v
6565

6666
context.subscriptions.push(
6767
vscode.workspace.onDidChangeConfiguration(async (event) => {
68+
const affectedFolders = new Set<vscode.Uri>();
69+
6870
for (const s of [
6971
"robotcode.python",
7072
"robotcode.languageServer",
7173
"robotcode.robot",
7274
"robotcode.robocop",
7375
"robotcode.robotidy",
7476
]) {
75-
if (event.affectsConfiguration(s)) {
76-
await languageClientManger.restart();
77+
for (const ws of vscode.workspace.workspaceFolders ?? []) {
78+
if (languageClientManger.clients.has(ws.uri.toString()))
79+
if (event.affectsConfiguration(s, ws)) {
80+
affectedFolders.add(ws.uri);
81+
}
7782
}
7883
}
84+
85+
for (const uri of affectedFolders) {
86+
await languageClientManger.restart(uri);
87+
}
7988
})
8089
);
8190
}

vscode-client/languageclientsmanger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,9 @@ export class LanguageClientsManager {
438438
});
439439
}
440440

441-
public async restart(): Promise<void> {
441+
public async restart(uri?: vscode.Uri): Promise<void> {
442442
this._pythonValidPythonAndRobotEnv = new WeakMap<vscode.WorkspaceFolder, boolean>();
443-
await this.refresh();
443+
await this.refresh(uri, true);
444444
}
445445

446446
public async refresh(uri?: vscode.Uri, restart?: boolean): Promise<void> {

0 commit comments

Comments
 (0)