Skip to content

Commit 42c6d99

Browse files
authored
Updated Description for Preferred Path Separator Setting and Refactor Its Usage (#13082)
* Updated description for preferred path separator setting. * Change wording. * Refactor configuration quickpick to correctly reflect preferred path separator.
1 parent 2bff033 commit 42c6d99

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Extension/package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@
566566
"c_cpp.configuration.exclusionPolicy.checkFolders.description": "The exclusion filters will only be evaluated once per folder (individual files are not checked).",
567567
"c_cpp.configuration.exclusionPolicy.checkFilesAndFolders.description": "The exclusion filters will be evaluated against every file and folder encountered.",
568568
"c_cpp.configuration.preferredPathSeparator.markdownDescription": {
569-
"message": "The character used as a path separator for `#include` auto-completion results.",
569+
"message": "The character used as a path separator for generated user paths.",
570570
"comment": [
571571
"Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered."
572572
]

Extension/src/LanguageServer/client.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,8 @@ export class DefaultClient implements Client {
984984
private static readonly compileCommandsLabel: string = "compile_commands.json";
985985
private static readonly compilersLabel: string = "compilers";
986986

987-
public async showSelectIntelliSenseConfiguration(paths: string[], compilersOnly?: boolean): Promise<number> {
987+
public async showSelectIntelliSenseConfiguration(paths: string[], preferredPathSeparator: string, compilersOnly?: boolean): Promise<number> {
988+
paths = paths.map(p => p.replace(/[\\/]/g, preferredPathSeparator));
988989
const options: vscode.QuickPickOptions = {};
989990
options.placeHolder = compilersOnly || !vscode.workspace.workspaceFolders || !this.RootFolder ?
990991
localize("select.compiler", "Select a compiler to configure for IntelliSense") :
@@ -1077,7 +1078,13 @@ export class DefaultClient implements Client {
10771078
installShown = false;
10781079
}
10791080
paths.push(localize("noConfig.string", "Do not configure with a compiler (not recommended)"));
1080-
const index: number = await this.showSelectIntelliSenseConfiguration(paths, showCompilersOnly);
1081+
let preferredPathSeparator: string = settings.preferredPathSeparator;
1082+
if (preferredPathSeparator === "Forward Slash") {
1083+
preferredPathSeparator = "/";
1084+
} else if (preferredPathSeparator === "Backslash") {
1085+
preferredPathSeparator = "\\";
1086+
}
1087+
const index: number = await this.showSelectIntelliSenseConfiguration(paths, preferredPathSeparator, showCompilersOnly);
10811088
let action: string = "";
10821089
let configurationSelected: boolean = false;
10831090
const fromStatusBarButton: boolean = !showCompilersOnly;
@@ -1128,7 +1135,9 @@ export class DefaultClient implements Client {
11281135
} else {
11291136
action = "select compiler";
11301137
const newCompiler: string = util.isCl(paths[index]) ? "cl.exe" : paths[index];
1138+
11311139
settings.defaultCompilerPath = newCompiler;
1140+
settings.defaultCompilerPath = settings.defaultCompilerPath.replace(/[\\/]/g, preferredPathSeparator);
11321141
await this.configuration.updateCompilerPathIfSet(newCompiler);
11331142
void SessionState.trustedCompilerFound.set(true);
11341143
}

0 commit comments

Comments
 (0)