From 8bcd7cd89dad98b99ac849b7741420e4345aa04e Mon Sep 17 00:00:00 2001 From: Tarik Brown Date: Fri, 27 Dec 2024 09:55:22 -0800 Subject: [PATCH 1/3] Updated description for preferred path separator setting. --- Extension/package.nls.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/package.nls.json b/Extension/package.nls.json index 116ec2a1f..dc1d192da 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 `Add #include` code action results and 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." ] From f6d07d905f450d315b085cdf06fb399ba7c93283 Mon Sep 17 00:00:00 2001 From: Tarik Brown Date: Fri, 27 Dec 2024 15:54:39 -0800 Subject: [PATCH 2/3] Change wording. --- Extension/package.nls.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Extension/package.nls.json b/Extension/package.nls.json index dc1d192da..11573c0e5 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 `Add #include` code action results and generated user paths.", + "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." ] From a2df173fd0dfeb875f67b720cfeb1dae4532b5fe Mon Sep 17 00:00:00 2001 From: Tarik Brown Date: Mon, 30 Dec 2024 09:58:08 -0800 Subject: [PATCH 3/3] Refactor configuration quickpick to correctly reflect preferred path separator. --- Extension/src/LanguageServer/client.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 4355acdf9..ac7a53bac 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); }