Skip to content

Apply mergeConfigurations for browse.path, auto-update the config, and avoid accumulating old configs #13678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sean-mcmanus
Copy link
Contributor

@sean-mcmanus sean-mcmanus commented Jun 7, 2025

Fix for the configurationProvider case of #13660, #13687, and #13688 (the changed mergeable property isn't auto-updated and old config values are accumulated). #13689 is not fixed.

Also, updated the description of mergeConfigurations.

Also, removed the "string" type for mergeConfigurations, since that appears to be invalid.

mergeConfigurations currently is not used by compileCommands (so that behavior is unchanged and has browse.path merged, but other properties not merged unless there is a fallback from a file not configured from compileCommands).

@sean-mcmanus sean-mcmanus marked this pull request as ready for review June 7, 2025 10:38
@sean-mcmanus sean-mcmanus requested a review from a team as a code owner June 7, 2025 10:38
@sean-mcmanus sean-mcmanus marked this pull request as draft June 10, 2025 02:49
@sean-mcmanus sean-mcmanus changed the title Apply mergeConfigurations for browse.path. Apply mergeConfigurations for browse.path, auto-update the config, and avoid accumulating old configs Jun 10, 2025
@sean-mcmanus sean-mcmanus marked this pull request as ready for review June 10, 2025 22:20
@@ -841,6 +841,7 @@
},
"C_Cpp.default.mergeConfigurations": {
"type": "boolean",
"default": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "false" was already implicitly being used as the default, so setting it to false here just made it explicit was already being used as the default.

@@ -2181,6 +2186,7 @@ export class DefaultClient implements Client {
if (configs && configs.length > 0 && configs[0]) {
const fileConfiguration: configs.Configuration | undefined = this.configuration.CurrentConfiguration;
if (fileConfiguration?.mergeConfigurations) {
configs = deepCopy(configs);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line change fixes the duplicates/old values being accumulated: #13687

@@ -1810,3 +1810,21 @@ export function findExePathInArgs(args: CommandString[]): string | undefined {
export function getVsCodeVersion(): number[] {
return vscode.version.split('.').map(num => parseInt(num, undefined));
}

export function equals(array1: string[] | undefined, array2: string[] | undefined): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeScript confusingly was returning false with array1 == array2 even though the contents of the arrays were identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pull Request
Development

Successfully merging this pull request may close these issues.

1 participant