Skip to content

Commit b120b80

Browse files
committed
Fix ${workspaceFolder} being added if ${workspaceFolder}/* is used.
1 parent a2b7383 commit b120b80

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,15 @@ export class CppProperties {
998998
} else if (configuration.includePath) {
999999
// If the user doesn't set browse.path, copy the includePath over. Make sure ${workspaceFolder} is in there though...
10001000
configuration.browse.path = configuration.includePath.slice(0);
1001-
if (configuration.includePath.findIndex((value: string) =>
1002-
!!value.match(/^\$\{(workspaceRoot|workspaceFolder)\}(\\\*{0,2}|\/\*{0,2})?$/g)) === -1
1003-
) {
1004-
configuration.browse.path.push("${workspaceFolder}");
1001+
if (this.rootUri) {
1002+
let normalizedRootUriFsPath: string = escapeStringRegExp(this.rootUri.fsPath.replace(/\\/g, "/"));
1003+
let regexPattern = `^${normalizedRootUriFsPath}(\\*{0,2}|\/\\*{0,2})?$`;
1004+
let regex = new RegExp(regexPattern, "g");
1005+
if (configuration.includePath.findIndex((value: string) =>
1006+
!!value.match(regex)) === -1
1007+
) {
1008+
configuration.browse.path.push("${workspaceFolder}");
1009+
}
10051010
}
10061011
} else {
10071012
configuration.browse.path = ["${workspaceFolder}"];

0 commit comments

Comments
 (0)