Skip to content

Commit 4303ace

Browse files
committedMar 28, 2025·
fix(editor): dont send didChangeConfiguration request to the server when it is shutdown (#10084)
1 parent b3ec235 commit 4303ace

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

Diff for: ‎editors/vscode/client/extension.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,23 @@ export async function activate(context: ExtensionContext) {
249249
configService.onConfigChange = function onConfigChange(event) {
250250
let settings = this.config.toLanguageServerConfig();
251251
updateStatsBar(this.config.enable);
252-
client.sendNotification('workspace/didChangeConfiguration', { settings });
252+
253+
if (client.isRunning()) {
254+
client.sendNotification('workspace/didChangeConfiguration', { settings });
255+
}
253256

254257
if (event.affectsConfiguration('oxc.configPath')) {
255258
client.clientOptions.synchronize = client.clientOptions.synchronize ?? {};
256259
client.clientOptions.synchronize.fileEvents = configService.config.configPath !== null
257260
? createFileEventWatchers(configService.config.configPath)
258261
: undefined;
259262

260-
client.restart().then(async () => {
261-
const configFiles = await findOxlintrcConfigFiles();
262-
await sendDidChangeWatchedFilesNotificationWith(client, configFiles);
263-
});
263+
if (client.isRunning()) {
264+
client.restart().then(async () => {
265+
const configFiles = await findOxlintrcConfigFiles();
266+
await sendDidChangeWatchedFilesNotificationWith(client, configFiles);
267+
});
268+
}
264269
}
265270
};
266271

0 commit comments

Comments
 (0)
Please sign in to comment.