From 4138750b3b1e30cff35344d78bf9a1b4e89c9b8f Mon Sep 17 00:00:00 2001 From: Ben McMorran Date: Tue, 29 Oct 2024 12:05:17 -0700 Subject: [PATCH 1/2] Enable #cpp for all users (#12898) * Enable #cpp for all users * Address PR comments --- Extension/src/Debugger/configurationProvider.ts | 2 +- Extension/src/LanguageServer/extension.ts | 12 +++++++++--- Extension/src/common.ts | 4 ++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Extension/src/Debugger/configurationProvider.ts b/Extension/src/Debugger/configurationProvider.ts index 2b9ce38ac2..067983feac 100644 --- a/Extension/src/Debugger/configurationProvider.ts +++ b/Extension/src/Debugger/configurationProvider.ts @@ -331,7 +331,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv // Run deploy steps if (config.deploySteps && config.deploySteps.length !== 0) { - const codeVersion: number[] = vscode.version.split('.').map(num => parseInt(num, undefined)); + const codeVersion: number[] = util.getVsCodeVersion(); if ((util.isNumber(codeVersion[0]) && codeVersion[0] < 1) || (util.isNumber(codeVersion[0]) && codeVersion[0] === 1 && util.isNumber(codeVersion[1]) && codeVersion[1] < 69)) { void logger.getOutputChannelLogger().showErrorMessage(localize("vs.code.1.69+.required", "'deploySteps' require VS Code 1.69+.")); return undefined; diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index c70abfb26b..02dd3e8861 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -252,9 +252,15 @@ export async function activate(): Promise { activeDocument = activeEditor.document; } - if (util.extensionContext && new CppSettings().experimentalFeatures) { - const tool = vscode.lm.registerTool('cpptools-lmtool-configuration', new CppConfigurationLanguageModelTool()); - disposables.push(tool); + if (util.extensionContext) { + // lmTools wasn't stabilized until 1.95, but (as of October 2024) + // cpptools can be installed on older versions of VS Code. See + // https://github.com/microsoft/vscode-cpptools/blob/main/Extension/package.json#L14 + const version = util.getVsCodeVersion(); + if (version[0] > 1 || (version[0] === 1 && version[1] >= 95)) { + const tool = vscode.lm.registerTool('cpptools-lmtool-configuration', new CppConfigurationLanguageModelTool()); + disposables.push(tool); + } } await registerRelatedFilesProvider(); diff --git a/Extension/src/common.ts b/Extension/src/common.ts index c962a719cd..dbd0bcdd63 100644 --- a/Extension/src/common.ts +++ b/Extension/src/common.ts @@ -1814,3 +1814,7 @@ export function findExePathInArgs(args: CommandString[]): string | undefined { return undefined; } + +export function getVsCodeVersion(): number[] { + return vscode.version.split('.').map(num => parseInt(num, undefined)); +} From d56740e4989f61c105424988d4db8f083c642e0b Mon Sep 17 00:00:00 2001 From: Sean McManus Date: Tue, 29 Oct 2024 12:40:07 -0700 Subject: [PATCH 2/2] Update changelog (2nd time). (#12899) * Update changelog (2nd time). --- Extension/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index 606fb27f54..d00d6843ef 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -1,8 +1,9 @@ # C/C++ for Visual Studio Code Changelog -## Version 1.23.0: October 24, 2024 +## Version 1.23.0: October 29, 2024 ### Enhancements * Update to clang-format and clang-tidy 19.1.2. [#12824](https://github.com/microsoft/vscode-cpptools/issues/12824) +* Enable `#cpp` with GitHub Copilot chat without `C_Cpp.experimentalFeatures` enabled. [PR #12898](https://github.com/microsoft/vscode-cpptools/pull/12898) ### Bug Fixes * Fix some translation issues. [#7824](https://github.com/microsoft/vscode-cpptools/issues/7824), [#12439](https://github.com/microsoft/vscode-cpptools/issues/12439), [#12440](https://github.com/microsoft/vscode-cpptools/issues/12440), [#12441](https://github.com/microsoft/vscode-cpptools/issues/12441)