Skip to content

Commit

Permalink
Enable #cpp for all users (#12898)
Browse files Browse the repository at this point in the history
* Enable #cpp for all users

* Address PR comments
  • Loading branch information
benmcmorran authored Oct 29, 2024
1 parent 8cb1def commit 4138750
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 9 additions & 3 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
@@ -252,9 +252,15 @@ export async function activate(): Promise<void> {
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();
4 changes: 4 additions & 0 deletions Extension/src/common.ts
Original file line number Diff line number Diff line change
@@ -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));
}

0 comments on commit 4138750

Please sign in to comment.