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 <patrick.a.erichsen@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9b77b52caf
commit
190a1d1365
4 changed files with 9 additions and 70 deletions
|
|
@ -18,6 +18,10 @@ class ClipboardContextProvider extends BaseContextProvider {
|
|||
type: "submenu",
|
||||
};
|
||||
|
||||
get deprecationMessage() {
|
||||
return "The clipboard context provider is deprecated as it is not used. It will be removed in a future version.";
|
||||
}
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
|
|
|
|||
12
core/core.ts
12
core/core.ts
|
|
@ -23,7 +23,6 @@ import { EditAggregator } from "./nextEdit/context/aggregateEdits";
|
|||
import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile";
|
||||
import { callTool } from "./tools/callTool";
|
||||
import { ChatDescriber } from "./util/chatDescriber";
|
||||
import { clipboardCache } from "./util/clipboardCache";
|
||||
import { compactConversation } from "./util/conversationCompaction";
|
||||
import { GlobalContext } from "./util/GlobalContext";
|
||||
import historyManager from "./util/history";
|
||||
|
|
@ -72,12 +71,12 @@ import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants";
|
|||
import { llmStreamChat } from "./llm/streamChat";
|
||||
import { BeforeAfterDiff } from "./nextEdit/context/diffFormatting";
|
||||
import { processSmallEdit } from "./nextEdit/context/processSmallEdit";
|
||||
import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue";
|
||||
import { NextEditProvider } from "./nextEdit/NextEditProvider";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { OnboardingModes } from "./protocol/core";
|
||||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
import { getUriPathBasename } from "./util/uri";
|
||||
import { PrefetchQueue } from "./nextEdit/NextEditPrefetchQueue";
|
||||
|
||||
const hasRulesFiles = (uris: string[]): boolean => {
|
||||
for (const uri of uris) {
|
||||
|
|
@ -484,15 +483,6 @@ export class Core {
|
|||
};
|
||||
});
|
||||
|
||||
on("clipboardCache/add", (msg) => {
|
||||
const added = clipboardCache.add(uuidv4(), msg.data.content);
|
||||
if (added) {
|
||||
this.messenger.send("refreshSubmenuItems", {
|
||||
providers: ["clipboard"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
on("llm/streamChat", (msg) => {
|
||||
const abortController = this.addMessageAbortController(msg.messageId);
|
||||
return llmStreamChat(
|
||||
|
|
|
|||
|
|
@ -262,10 +262,10 @@ class VsCodeIde implements IDE {
|
|||
}
|
||||
|
||||
async getClipboardContent() {
|
||||
return this.context.workspaceState.get("continue.copyBuffer", {
|
||||
text: "",
|
||||
copiedAt: new Date("1900-01-01").toISOString(),
|
||||
});
|
||||
return {
|
||||
text: await vscode.env.clipboard.readText(),
|
||||
copiedAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
|
||||
async getTerminalContents(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { EXTENSION_NAME } from "core/control-plane/env";
|
|||
import { Core } from "core/core";
|
||||
import { walkDirAsync } from "core/indexing/walkDir";
|
||||
import { isModelInstaller } from "core/llm";
|
||||
import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo";
|
||||
import { startLocalOllama } from "core/util/ollamaHelper";
|
||||
import { getConfigJsonPath, getConfigYamlPath } from "core/util/paths";
|
||||
import { Telemetry } from "core/util/posthog";
|
||||
|
|
@ -808,44 +807,6 @@ const getCommandsMap: (
|
|||
};
|
||||
};
|
||||
|
||||
const registerCopyBufferService = (
|
||||
context: vscode.ExtensionContext,
|
||||
core: Core,
|
||||
) => {
|
||||
const typeDisposable = vscode.commands.registerCommand(
|
||||
"editor.action.clipboardCopyAction",
|
||||
async (arg) => doCopy(typeDisposable),
|
||||
);
|
||||
|
||||
async function doCopy(typeDisposable: any) {
|
||||
typeDisposable.dispose(); // must dispose to avoid endless loops
|
||||
|
||||
await vscode.commands.executeCommand("editor.action.clipboardCopyAction");
|
||||
|
||||
const clipboardText = await vscode.env.clipboard.readText();
|
||||
|
||||
if (clipboardText) {
|
||||
core.invoke("clipboardCache/add", {
|
||||
content: clipboardText,
|
||||
});
|
||||
}
|
||||
|
||||
await context.workspaceState.update("continue.copyBuffer", {
|
||||
text: clipboardText,
|
||||
copiedAt: new Date().toISOString(),
|
||||
});
|
||||
|
||||
// re-register to continue intercepting copy commands
|
||||
typeDisposable = vscode.commands.registerCommand(
|
||||
"editor.action.clipboardCopyAction",
|
||||
async () => doCopy(typeDisposable),
|
||||
);
|
||||
context.subscriptions.push(typeDisposable);
|
||||
}
|
||||
|
||||
context.subscriptions.push(typeDisposable);
|
||||
};
|
||||
|
||||
async function installModelWithProgress(
|
||||
modelName: string,
|
||||
modelInstaller: ModelInstaller,
|
||||
|
|
@ -916,20 +877,4 @@ 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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue