Skip to content

Commit 735d741

Browse files
authored
Add a message explaining why we couldn't find a quote-wrapped path (#13521)
1 parent ce67c4c commit 735d741

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,14 +1721,18 @@ export class CppProperties {
17211721

17221722
for (const p of paths) {
17231723
let pathExists: boolean = true;
1724+
let quotedPath: boolean = false;
17241725
let resolvedPath: string = this.resolvePath(p);
17251726
if (!resolvedPath) {
17261727
continue;
17271728
}
17281729

17291730
// Check if resolved path exists
17301731
if (!fs.existsSync(resolvedPath)) {
1731-
if (assumeRelative && !path.isAbsolute(resolvedPath)) {
1732+
if (resolvedPath.match(/".*"/) !== null) {
1733+
pathExists = false;
1734+
quotedPath = true;
1735+
} else if (assumeRelative && !path.isAbsolute(resolvedPath)) {
17321736
continue;
17331737
} else if (!this.rootUri) {
17341738
pathExists = false;
@@ -1744,7 +1748,10 @@ export class CppProperties {
17441748
}
17451749

17461750
if (!pathExists) {
1747-
const message: string = localize('cannot.find', "Cannot find: {0}", resolvedPath);
1751+
let message: string = localize('cannot.find', "Cannot find: {0}", resolvedPath);
1752+
if (quotedPath) {
1753+
message += '. ' + localize('wrapped.with.quotes', 'Do not add extra quotes around paths.');
1754+
}
17481755
errors.push(message);
17491756
continue;
17501757
}
@@ -2132,6 +2139,9 @@ export class CppProperties {
21322139
badPath = `"${expandedPaths[0]}"`;
21332140
}
21342141
message = localize('cannot.find', "Cannot find: {0}", badPath);
2142+
if (incorrectExpandedPaths.some(p => p.match(/".*"/) !== null)) {
2143+
message += '.\n' + localize('wrapped.with.quotes', 'Do not add extra quotes around paths.');
2144+
}
21352145
newSquiggleMetrics.PathNonExistent++;
21362146
} else {
21372147
// Check for file versus path mismatches.

0 commit comments

Comments
 (0)