From 8aa2e8e8196b24cdb9b9879dbc7a3d8f54b5331c Mon Sep 17 00:00:00 2001 From: Weverton Guedes Date: Wed, 29 Jul 2026 21:09:30 +0200 Subject: [PATCH] Don't warn about recursive includes merged from c_cpp_properties.json The check for include paths ending in '**' ran in sendCustomConfigurations, after mergeConfigurations had already appended the includePath entries from the user's c_cpp_properties.json to each configuration from the provider. A trailing '**' is a supported way to recurse there, so the warning fired for paths the provider never supplied. Move the check ahead of that append so it only sees the provider's own include paths. --- Extension/src/LanguageServer/client.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 133890cfa..629fcd61a 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -2329,6 +2329,19 @@ export class DefaultClient implements Client { const fileConfiguration: configs.Configuration | undefined = this.configuration.CurrentConfiguration; if (fileConfiguration?.mergeConfigurations) { configs = deepCopy(configs); + } + // Only the include paths from the provider are checked for recursive includes, so + // this has to happen before the include paths from c_cpp_properties.json are + // appended below, where a trailing '**' is a supported way to recurse. + if (configs instanceof Array) { + configs.forEach(config => { + if (util.isArrayOfString(config?.configuration?.includePath) && + config.configuration.includePath.some(path => path.endsWith('**'))) { + console.warn("custom include paths should not use recursive includes ('**')"); + } + }); + } + if (fileConfiguration?.mergeConfigurations) { configs.forEach(config => { if (fileConfiguration.includePath) { fileConfiguration.includePath.forEach(p => { @@ -3457,9 +3470,6 @@ export class DefaultClient implements Client { this.configurationLogging.set(uri, JSON.stringify(item.configuration, null, 4)); out.appendLineAtLevel(6, ` uri: ${uri}`); out.appendLineAtLevel(6, ` config: ${JSON.stringify(item.configuration, null, 2)}`); - if (item.configuration.includePath.some(path => path.endsWith('**'))) { - console.warn("custom include paths should not use recursive includes ('**')"); - } // Separate compiler path and args before sending to language client const itemConfig: util.Mutable = deepCopy(item.configuration); if (util.isString(itemConfig.compilerPath)) {