diff --git a/Extension/package.nls.json b/Extension/package.nls.json index 116ec2a1fd..11573c0e5f 100644 --- a/Extension/package.nls.json +++ b/Extension/package.nls.json @@ -566,7 +566,7 @@ "c_cpp.configuration.exclusionPolicy.checkFolders.description": "The exclusion filters will only be evaluated once per folder (individual files are not checked).", "c_cpp.configuration.exclusionPolicy.checkFilesAndFolders.description": "The exclusion filters will be evaluated against every file and folder encountered.", "c_cpp.configuration.preferredPathSeparator.markdownDescription": { - "message": "The character used as a path separator for `#include` auto-completion results.", + "message": "The character used as a path separator for generated user paths.", "comment": [ "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." ] diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 4355acdf9c..ac7a53bac7 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -984,7 +984,8 @@ export class DefaultClient implements Client { private static readonly compileCommandsLabel: string = "compile_commands.json"; private static readonly compilersLabel: string = "compilers"; - public async showSelectIntelliSenseConfiguration(paths: string[], compilersOnly?: boolean): Promise { + public async showSelectIntelliSenseConfiguration(paths: string[], preferredPathSeparator: string, compilersOnly?: boolean): Promise { + paths = paths.map(p => p.replace(/[\\/]/g, preferredPathSeparator)); const options: vscode.QuickPickOptions = {}; options.placeHolder = compilersOnly || !vscode.workspace.workspaceFolders || !this.RootFolder ? localize("select.compiler", "Select a compiler to configure for IntelliSense") : @@ -1077,7 +1078,13 @@ export class DefaultClient implements Client { installShown = false; } paths.push(localize("noConfig.string", "Do not configure with a compiler (not recommended)")); - const index: number = await this.showSelectIntelliSenseConfiguration(paths, showCompilersOnly); + let preferredPathSeparator: string = settings.preferredPathSeparator; + if (preferredPathSeparator === "Forward Slash") { + preferredPathSeparator = "/"; + } else if (preferredPathSeparator === "Backslash") { + preferredPathSeparator = "\\"; + } + const index: number = await this.showSelectIntelliSenseConfiguration(paths, preferredPathSeparator, showCompilersOnly); let action: string = ""; let configurationSelected: boolean = false; const fromStatusBarButton: boolean = !showCompilersOnly; @@ -1128,7 +1135,9 @@ export class DefaultClient implements Client { } else { action = "select compiler"; const newCompiler: string = util.isCl(paths[index]) ? "cl.exe" : paths[index]; + settings.defaultCompilerPath = newCompiler; + settings.defaultCompilerPath = settings.defaultCompilerPath.replace(/[\\/]/g, preferredPathSeparator); await this.configuration.updateCompilerPathIfSet(newCompiler); void SessionState.trustedCompilerFound.set(true); }