Skip to content

Commit 190a1d1

Browse files
uinstinctPatrick-Erichsenclaude
authored
fix: remove clipboard buffer action (#7117)
* deprecate clipboard context provider * remove registercopybufferservice - use vscode clipboard text * remove clipboardcache from core protocol --------- Co-authored-by: Patrick Erichsen <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 9b77b52 commit 190a1d1

File tree

4 files changed

+9
-70
lines changed

4 files changed

+9
-70
lines changed

core/context/providers/ClipboardContextProvider.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class ClipboardContextProvider extends BaseContextProvider {
1818
type: "submenu",
1919
};
2020

21+
get deprecationMessage() {
22+
return "The clipboard context provider is deprecated as it is not used. It will be removed in a future version.";
23+
}
24+
2125
async getContextItems(
2226
query: string,
2327
extras: ContextProviderExtras,

core/core.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { EditAggregator } from "./nextEdit/context/aggregateEdits";
2323
import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile";
2424
import { callTool } from "./tools/callTool";
2525
import { ChatDescriber } from "./util/chatDescriber";
26-
import { clipboardCache } from "./util/clipboardCache";
2726
import { compactConversation } from "./util/conversationCompaction";
2827
import { GlobalContext } from "./util/GlobalContext";
2928
import historyManager from "./util/history";
@@ -72,12 +71,12 @@ import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants";
7271
import { llmStreamChat } from "./llm/streamChat";
7372
import { BeforeAfterDiff } from "./nextEdit/context/diffFormatting";
7473
import { processSmallEdit } from "./nextEdit/context/processSmallEdit";
74+
import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue";
7575
import { NextEditProvider } from "./nextEdit/NextEditProvider";
7676
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
7777
import { OnboardingModes } from "./protocol/core";
7878
import type { IMessenger, Message } from "./protocol/messenger";
7979
import { getUriPathBasename } from "./util/uri";
80-
import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue";
8180

8281
const hasRulesFiles = (uris: string[]): boolean => {
8382
for (const uri of uris) {
@@ -484,15 +483,6 @@ export class Core {
484483
};
485484
});
486485

487-
on("clipboardCache/add", (msg) => {
488-
const added = clipboardCache.add(uuidv4(), msg.data.content);
489-
if (added) {
490-
this.messenger.send("refreshSubmenuItems", {
491-
providers: ["clipboard"],
492-
});
493-
}
494-
});
495-
496486
on("llm/streamChat", (msg) => {
497487
const abortController = this.addMessageAbortController(msg.messageId);
498488
return llmStreamChat(

extensions/vscode/src/VsCodeIde.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ class VsCodeIde implements IDE {
262262
}
263263

264264
async getClipboardContent() {
265-
return this.context.workspaceState.get("continue.copyBuffer", {
266-
text: "",
267-
copiedAt: new Date("1900-01-01").toISOString(),
268-
});
265+
return {
266+
text: await vscode.env.clipboard.readText(),
267+
copiedAt: new Date().toISOString(),
268+
};
269269
}
270270

271271
async getTerminalContents(): Promise<string> {

extensions/vscode/src/commands.ts

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { EXTENSION_NAME } from "core/control-plane/env";
88
import { Core } from "core/core";
99
import { walkDirAsync } from "core/indexing/walkDir";
1010
import { isModelInstaller } from "core/llm";
11-
import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo";
1211
import { startLocalOllama } from "core/util/ollamaHelper";
1312
import { getConfigJsonPath, getConfigYamlPath } from "core/util/paths";
1413
import { Telemetry } from "core/util/posthog";
@@ -808,44 +807,6 @@ const getCommandsMap: (
808807
};
809808
};
810809

811-
const registerCopyBufferService = (
812-
context: vscode.ExtensionContext,
813-
core: Core,
814-
) => {
815-
const typeDisposable = vscode.commands.registerCommand(
816-
"editor.action.clipboardCopyAction",
817-
async (arg) => doCopy(typeDisposable),
818-
);
819-
820-
async function doCopy(typeDisposable: any) {
821-
typeDisposable.dispose(); // must dispose to avoid endless loops
822-
823-
await vscode.commands.executeCommand("editor.action.clipboardCopyAction");
824-
825-
const clipboardText = await vscode.env.clipboard.readText();
826-
827-
if (clipboardText) {
828-
core.invoke("clipboardCache/add", {
829-
content: clipboardText,
830-
});
831-
}
832-
833-
await context.workspaceState.update("continue.copyBuffer", {
834-
text: clipboardText,
835-
copiedAt: new Date().toISOString(),
836-
});
837-
838-
// re-register to continue intercepting copy commands
839-
typeDisposable = vscode.commands.registerCommand(
840-
"editor.action.clipboardCopyAction",
841-
async () => doCopy(typeDisposable),
842-
);
843-
context.subscriptions.push(typeDisposable);
844-
}
845-
846-
context.subscriptions.push(typeDisposable);
847-
};
848-
849810
async function installModelWithProgress(
850811
modelName: string,
851812
modelInstaller: ModelInstaller,
@@ -916,20 +877,4 @@ export function registerAllCommands(
916877
vscode.commands.registerCommand(command, callback),
917878
);
918879
}
919-
920-
try {
921-
registerCopyBufferService(context, core);
922-
} catch (e: any) {
923-
//Non-critical error, it needs to be intercepted and not prevent the extension from starting
924-
console.log("Error registering CopyBufferService: ", e);
925-
Telemetry.capture(
926-
"vscode_extension_copy_buffer_failure",
927-
{
928-
stack: extractMinimalStackTraceInfo(e.stack),
929-
message: e.message,
930-
},
931-
false,
932-
true,
933-
);
934-
}
935880
}

0 commit comments

Comments
 (0)