Merge pull request #5073 from fbricon/harden-registerCopyBufferSpy

Mitigate registerCopyBufferSpy failures
This commit is contained in:
Nate Sesti 2025-04-29 12:58:42 -07:00 • committed by GitHub
commit cd34cc5e8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,7 @@ import { Core } from "core/core";
import { LOCAL_DEV_DATA_VERSION } from "core/data/log";
import { walkDirAsync } from "core/indexing/walkDir";
import { isModelInstaller } from "core/llm";
import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo";
import { startLocalOllama } from "core/util/ollamaHelper";
import { getDevDataFilePath } from "core/util/paths";
import { Telemetry } from "core/util/posthog";
@ -381,6 +382,7 @@ const getCommandsMap: (
rules: config.rules,
});
}
return {
"continue.acceptDiff": async (newFileUri?: string, streamId?: string) =>
processDiff(
@ -949,7 +951,7 @@ const getCommandsMap: (
if (core.configHandler.currentProfile?.profileDescription.id) {
core.invoke("config/updateSelectedModel", {
profileId:
core.configHandler.currentProfile?.profileDescription.id,
core.configHandler.currentProfile?.profileDescription.id,
role: "autocomplete",
title: selectedOption,
});
@ -1014,7 +1016,7 @@ const getCommandsMap: (
};
};
const registerCopyBufferSpy = (
const registerCopyBufferService = (
context: vscode.ExtensionContext,
core: Core,
) => {
@ -1105,8 +1107,6 @@ export function registerAllCommands(
core: Core,
editDecorationManager: EditDecorationManager,
) {
registerCopyBufferSpy(context, core);
for (const [command, callback] of Object.entries(
getCommandsMap(
ide,
@ -1126,4 +1126,20 @@ export function registerAllCommands(
vscode.commands.registerCommand(command, callback),
);
}
try {
registerCopyBufferService(context, core);
} catch (e: any) {
//Non-critical error, it needs to be intercepted and not prevent the extension from starting
console.log("Error registering CopyBufferService: ", e);
Telemetry.capture(
"vscode_extension_copy_buffer_failure",
{
stack: extractMinimalStackTraceInfo(e.stack),
message: e.message,
},
false,
true,
);
}
}