Skip to content

Commit

Permalink
Fix issue with config requests before provider has registered (#13167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Colengms authored Jan 18, 2025
1 parent ce0435b commit 33a205b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ interface CodeAnalysisParams {

interface FinishedRequestCustomConfigParams {
uri: string;
isProviderRegistered: boolean;
}

export interface TextDocumentWillSaveParams {
Expand Down Expand Up @@ -2102,8 +2103,9 @@ export class DefaultClient implements Client {
}

public async provideCustomConfiguration(docUri: vscode.Uri): Promise<void> {
let isProviderRegistered: boolean = false;
const onFinished: () => void = () => {
void this.languageClient.sendNotification(FinishedRequestCustomConfig, { uri: docUri.toString() });
void this.languageClient.sendNotification(FinishedRequestCustomConfig, { uri: docUri.toString(), isProviderRegistered });
};
try {
const providerId: string | undefined = this.configurationProvider;
Expand All @@ -2114,6 +2116,7 @@ export class DefaultClient implements Client {
if (!provider || !provider.isReady) {
return;
}
isProviderRegistered = true;
const resultCode = await this.provideCustomConfigurationAsync(docUri, provider);
telemetry.logLanguageServerEvent('provideCustomConfiguration', { providerId, resultCode });
} finally {
Expand Down

0 comments on commit 33a205b

Please sign in to comment.