Skip to content

Commit 3f22eeb

Browse files
committed
Enable #cpp for all users
1 parent 8cb1def commit 3f22eeb

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Extension/src/Debugger/configurationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
331331

332332
// Run deploy steps
333333
if (config.deploySteps && config.deploySteps.length !== 0) {
334-
const codeVersion: number[] = vscode.version.split('.').map(num => parseInt(num, undefined));
334+
const codeVersion: number[] = util.getVsCodeVersion();
335335
if ((util.isNumber(codeVersion[0]) && codeVersion[0] < 1) || (util.isNumber(codeVersion[0]) && codeVersion[0] === 1 && util.isNumber(codeVersion[1]) && codeVersion[1] < 69)) {
336336
void logger.getOutputChannelLogger().showErrorMessage(localize("vs.code.1.69+.required", "'deploySteps' require VS Code 1.69+."));
337337
return undefined;

Extension/src/LanguageServer/extension.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,14 @@ export async function activate(): Promise<void> {
252252
activeDocument = activeEditor.document;
253253
}
254254

255-
if (util.extensionContext && new CppSettings().experimentalFeatures) {
256-
const tool = vscode.lm.registerTool('cpptools-lmtool-configuration', new CppConfigurationLanguageModelTool());
257-
disposables.push(tool);
255+
if (util.extensionContext) {
256+
// lmTools wasn't stabilized until 1.95, but (as of October 2024)
257+
// cpptools can be installed on versions of VS Code as old as 1.67.
258+
const version = util.getVsCodeVersion();
259+
if (version[0] > 1 || (version[0] === 1 && version[1] >= 95)) {
260+
const tool = vscode.lm.registerTool('cpptools-lmtool-configuration', new CppConfigurationLanguageModelTool());
261+
disposables.push(tool);
262+
}
258263
}
259264

260265
await registerRelatedFilesProvider();

Extension/src/common.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,3 +1814,7 @@ export function findExePathInArgs(args: CommandString[]): string | undefined {
18141814

18151815
return undefined;
18161816
}
1817+
1818+
export function getVsCodeVersion(): number[] {
1819+
return vscode.version.split('.').map(num => parseInt(num, undefined));
1820+
}

0 commit comments

Comments
 (0)