8000 refactor(editor): make `onConfigChange` async (#10110) · oxc-project/oxc@5ec477c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ec477c

Browse files
committed
refactor(editor): make onConfigChange async (#10110)
1 parent 9b6e344 commit 5ec477c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

editors/vscode/client/ConfigService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ConfigService implements IDisposable {
99
public config: Config;
1010

1111
public onConfigChange:
12-
| ((this: ConfigService, config: ConfigurationChangeEvent) => void)
12+
| ((this: ConfigService, config: ConfigurationChangeEvent) => Promise<void>)
1313
| undefined;
1414

1515
constructor() {
@@ -22,10 +22,10 @@ export class ConfigService implements IDisposable {
2222
this._disposables.push(disposeChangeListener);
2323
}
2424

25-
private onVscodeCon 8000 figChange(event: ConfigurationChangeEvent): void {
25+
private async onVscodeConfigChange(event: ConfigurationChangeEvent): Promise<void> {
2626
if (event.affectsConfiguration(ConfigService._namespace)) {
2727
this.config.refresh();
28-
this.onConfigChange?.(event);
28+
await this.onConfigChange?.(event);
2929
}
3030
}
3131

editors/vscode/client/extension.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export async function activate(context: ExtensionContext) {
244244
});
245245
});
246246

247-
configService.onConfigChange = function onConfigChange(event) {
247+
configService.onConfigChange = async function onConfigChange(event) {
248248
let settings = this.config.toLanguageServerConfig();
249249
updateStatsBar(this.config.enable);
250250

@@ -257,10 +257,9 @@ export async function activate(context: ExtensionContext) {
257257
client.clientOptions.synchronize.fileEvents = createFileEventWatchers(configService.config.configPath);
258258

259259
if (client.isRunning()) {
260-
client.restart().then(async () => {
261-
const configFiles = await findOxlintrcConfigFiles();
262-
await sendDidChangeWatchedFilesNotificationWith(client, configFiles);
263-
});
260+
await client.restart();
261+
const configFiles = await findOxlintrcConfigFiles();
262+
await sendDidChangeWatchedFilesNotificationWith(client, configFiles);
264263
}
265264
}
266265
};

0 commit comments

Comments
 (0)
0