Skip to content

Commit 591f798

Browse files
authored
Merge branch 'main' into seanmcm/fixSomeLocBugs
2 parents 72c4e9e + 04bc6c8 commit 591f798

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Extension/src/LanguageServer/configurations.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ export class CppProperties {
16121612
resolvedCompilerPath = which.sync(config.compilerPath, { nothrow: true });
16131613
}
16141614

1615-
if (resolvedCompilerPath === undefined) {
1615+
if (!resolvedCompilerPath) {
16161616
resolvedCompilerPath = this.resolvePath(config.compilerPath);
16171617
}
16181618
const settings: CppSettings = new CppSettings(this.rootUri);
@@ -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)