Skip to content
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

new input verification of configurations.includePath fails to verify multiple paths in single env variable #3912

Closed
mistersandman opened this issue Jul 11, 2019 · 2 comments
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@mistersandman
Copy link
Contributor

The example c_cpp_properties.json provided here reports the problem Cannot find "<workspaceFolder>;<workspaceFolder>\include".

The issue is that the path array configurations.includePath contains the env variable ${myDefaultIncludePath} which again is a path array that gets flattened into a semi-colon separated path list. However, the input validation for configurations.includePath wrongly expects a single path per entry, as can be seen here:

for (let p of paths) {
let pathExists: boolean = true;
let resolvedPath: string = this.resolvePath(p, isWindows);

The issue only concerns validation, since the actual processing of cofigurations.includePaths

configuration.includePath = this.updateConfiguration(configuration.includePath, settings.defaultIncludePath, env);
handles path arrays in env variables correctly by using resolveAndSplit inside updateConfiguration
private updateConfiguration(property: string[], defaultValue: string[], env: Environment): string[];
private updateConfiguration(property: string, defaultValue: string, env: Environment): string;
private updateConfiguration(property: string | boolean, defaultValue: boolean, env: Environment): boolean;
private updateConfiguration(property, defaultValue, env): any {
if (util.isString(property) || util.isString(defaultValue)) {
return this.resolveVariables(property, defaultValue, env);
} else if (util.isBoolean(property) || util.isBoolean(defaultValue)) {
return this.resolveVariables(property, defaultValue, env);
} else if (util.isArrayOfString(property) || util.isArrayOfString(defaultValue)) {
if (property) {
return this.resolveAndSplit(property, defaultValue, env);
} else if (property === undefined && defaultValue) {
return this.resolveAndSplit(defaultValue, [], env);
}
}
return property;
}

@sean-mcmanus
Copy link
Contributor

Should be fixed with 0.25.0.

@mistersandman
Copy link
Contributor Author

I can confirm the fix in 0.25.0. Thanks!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants