Don't warn about recursive includes merged from c_cpp_properties.json - #14620
Open
owevertonguedes wants to merge 1 commit into
Open
Don't warn about recursive includes merged from c_cpp_properties.json#14620owevertonguedes wants to merge 1 commit into
owevertonguedes wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an incorrect provider diagnostic that was triggered when mergeConfigurations appended includePath entries from c_cpp_properties.json (where a trailing ** is valid) into configurations supplied by a custom configuration provider.
Changes:
- Moves the “recursive include” (
**) warning so it runs before mergingc_cpp_properties.jsoninclude paths into provider configs. - Removes the same warning from
sendCustomConfigurations, ensuring only provider-supplied include paths are evaluated.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14125
Problem
sendCustomConfigurationswarned whenever anyincludePathentry ended in**:Its only caller is
provideCustomConfigurationAsync, and whenmergeConfigurationsis enabled that caller has already appended theincludePathentries from the user'sc_cpp_properties.jsonto every configuration returned by the provider. A trailing**is a supported way to recurse there, so the warning fired for paths the configuration provider never supplied.Change
Move the check ahead of that append, so it only ever sees the provider's own include paths. The warning for a provider that really does use
**is unchanged, with or withoutmergeConfigurations.The check now runs before
isSourceFileConfigurationItemvalidates each item, so it is guarded byconfigs instanceof Arrayandutil.isArrayOfString(...)to keep the same tolerance for malformed third-party data. It also sits afterdeepCopy, so when merging it reads the same normalized copy the existing merge loop reads.Testing
I drove
provideCustomConfigurationAsyncagainst the compiled extension with a stub provider and compared every case tomain:**comes frommergeConfigurationsc_cpp_properties.jsononlyc_cpp_properties.jsononlyI also checked malformed provider input that the pre-patch code tolerated, so the earlier validation is not skipped: an
includePaththat is not an array, an array-like object instead of an array, and a falsy first element all behave exactly as they did before.One difference worth flagging: an item that carries a recursive include and fails validation for an unrelated reason now produces the recursive-include warning in addition to the existing "discarding invalid SourceFileConfigurationItem" one, because the check no longer sits behind that validation. Both are
console.warndiagnostics for provider authors and neither item is sent either way, but I can restrict the check to fully valid items if you would rather keep that exact.tsc --build,eslint src test ui .scripts, the unit suite (193 passing) andgit diff --checkare all clean. I could not run theSimpleCppProjectintegration suite, which is where a regression test for this would belong, because it needs the native binaries and I have no way to run it here, so I did not add a test I could not execute.