Skip to content

Add a message explaining why we couldn't find a quote-wrapped path #13521

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

Merged
merged 4 commits into from
Apr 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1721,14 +1721,18 @@ export class CppProperties {

for (const p of paths) {
let pathExists: boolean = true;
let quotedPath: boolean = false;
let resolvedPath: string = this.resolvePath(p);
if (!resolvedPath) {
continue;
}

// Check if resolved path exists
if (!fs.existsSync(resolvedPath)) {
if (assumeRelative && !path.isAbsolute(resolvedPath)) {
if (resolvedPath.match(/".*"/) !== null) {
pathExists = false;
quotedPath = true;
} else if (assumeRelative && !path.isAbsolute(resolvedPath)) {
continue;
} else if (!this.rootUri) {
pathExists = false;
Expand All @@ -1744,7 +1748,10 @@ export class CppProperties {
}

if (!pathExists) {
const message: string = localize('cannot.find', "Cannot find: {0}", resolvedPath);
let message: string = localize('cannot.find', "Cannot find: {0}", resolvedPath);
if (quotedPath) {
message += '. ' + localize('wrapped.with.quotes', 'Do not add extra quotes around paths.');
}
errors.push(message);
continue;
}
Expand Down Expand Up @@ -2132,6 +2139,9 @@ export class CppProperties {
badPath = `"${expandedPaths[0]}"`;
}
message = localize('cannot.find', "Cannot find: {0}", badPath);
if (incorrectExpandedPaths.some(p => p.match(/".*"/) !== null)) {
message += '.\n' + localize('wrapped.with.quotes', 'Do not add extra quotes around paths.');
}
newSquiggleMetrics.PathNonExistent++;
} else {
// Check for file versus path mismatches.
Expand Down