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) 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)); +}