Skip to content

Commit 847a2e3

Browse files
authored
reduce promise reject messages in the standard case (#2041)
1 parent 7b91a97 commit 847a2e3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Extension/src/LanguageServer/extension.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ export function registerCustomConfigurationProvider(provider: CustomConfiguratio
8989

9090
export async function provideCustomConfiguration(document: vscode.TextDocument, client: Client): Promise<void> {
9191
let tokenSource: CancellationTokenSource = new CancellationTokenSource();
92+
if (customConfigurationProviders.length === 0) {
93+
return Promise.resolve();
94+
}
9295
return client.runBlockingThenableWithTimeout(async () => {
9396
// Loop through registered providers until one is able to service the current document
9497
for (let i: number = 0; i < customConfigurationProviders.length; i++) {
@@ -98,7 +101,7 @@ export async function provideCustomConfiguration(document: vscode.TextDocument,
98101
}
99102
return Promise.reject("No providers found for " + document.uri);
100103
}, 1000, tokenSource).then((configs: SourceFileConfigurationItem[]) => {
101-
if (configs !== null && configs.length > 0) {
104+
if (configs && configs.length > 0) {
102105
client.sendCustomConfigurations(configs);
103106
}
104107
});

0 commit comments

Comments
 (0)