Don't discard custom configurations whose uri is a vscode.Uri - #14624
Merged
sean-mcmanus merged 2 commits intoJul 30, 2026
Merged
Conversation
Colengms
approved these changes
Jul 30, 2026
sean-mcmanus
approved these changes
Jul 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug where enabling C_Cpp.mergeConfigurations caused custom configuration provider results to be discarded when SourceFileConfigurationItem.uri was a vscode.Uri, due to deepCopy using a JSON round-trip that strips Uri instances.
Changes:
- Normalize
SourceFileConfigurationItem.urifromvscode.Urito string beforedeepCopyruns in themergeConfigurationspath. - Preserve existing tolerance for unusual provider return shapes by avoiding calling provider-array methods and only reading
urionce per item.
💡 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 #14621
With
C_Cpp.mergeConfigurationsenabled,provideCustomConfigurationAsyncdeep copies the provider's configurations before merging in the entries fromc_cpp_properties.json.deepCopyisJSON.parse(JSON.stringify(...))andvscode.UrideclarestoJSON(), so the round trip leaves a plain object behind.isSourceFileConfigurationItemaccepts only a string or a realUri, so every item a provider returned with avscode.Uriwas discarded,sanitized.lengthwas 0, and nothing reached the language server.SourceFileConfigurationItem.uriis declaredstring | vscode.UriandsendCustomConfigurationsalready converts aUriwithtoString(), so this normalizes the field to a string before the copy, which is the option you preferred on the issue.Makefile Tools builds its items with a
Uriobject, insrc/extension.ts:CMake Tools passes
vscode.Uri.file(absolutePath).toString(), a string.Measured by driving
provideCustomConfigurationAsyncwith a stub provider and recording what reachessendCustomConfigurations:urimergeConfigurationsvscode.Urivscode.UriThe string the item now carries is the result of the same
Uri.toString()call the merge off path already made, andsendCustomConfigurationspasses a string that starts withfile://through unchanged.Two details are separable, if you would rather not have them:
configs instanceof Arrayguard.sendCustomConfigurationsgates on that same test, so a value that is array like but not anArrayis discarded there today with merge off, which I measured. Removing the guard makes that value work with merge on while it still fails with merge off.configs.map, and building a new item rather than spreading the old one. Today this function calls no method on the array the provider returns, and the deep copy readsurionce. I measured three inputs against both: an array whose ownmapis shadowed, an item whoseuriis a getter, and an array like object. Withconfigs.mapthe first one stopped delivering an item that is delivered today; with the spread the second one readuritwice. The version in this PR leaves all three as they are today.sendCustomConfigurationsreads onlyuriandconfiguration, so anything else a provider attaches to an item, such as thecompileCommandfield above, is dropped there either way.One behavior difference worth naming: with merge on, an item whose
uriis aUriwith a scheme other thanfilenow arrives asfile:///<the original uri>, becausesendCustomConfigurationstreats any string that does not start withfile://as an fsPath. I measured that this is already what a provider gets today when it passes that same value as a string, in both merge modes. The API documents the field as following the file URI scheme.No test is included. Nothing in the unit suite loads the
vscodemodule, so a test for this would go in the integration suite, which needs the native binaries, and I did not want to add a test I could not run.tsc --build, the full lint, the 193 unit tests andgit diff --checkare clean.This touches the same lines as #14620. Whichever lands first, I will rebase the other.