quick text entry
This commit is contained in:
parent
5b63917db3
commit
926324cd48
4 changed files with 33 additions and 0 deletions
|
|
@ -150,6 +150,8 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
|
|||
self.onAcceptRejectSuggestion(data["accepted"])
|
||||
elif message_type == "acceptRejectDiff":
|
||||
self.onAcceptRejectDiff(data["accepted"])
|
||||
elif message_type == "mainUserInput":
|
||||
self.onMainUserInput(data["input"])
|
||||
elif message_type in ["highlightedCode", "openFiles", "readFile", "editFile", "workspaceDirectory", "getUserSecret", "runCommand", "uniqueId"]:
|
||||
self.sub_queue.post(message_type, data)
|
||||
else:
|
||||
|
|
@ -255,6 +257,11 @@ class IdeProtocolServer(AbstractIdeProtocolServer):
|
|||
asyncio.create_task(
|
||||
session.autopilot.handle_highlighted_code(range_in_files))
|
||||
|
||||
def onMainUserInput(self, input: str):
|
||||
for _, session in self.session_manager.sessions.items():
|
||||
asyncio.create_task(
|
||||
session.autopilot.accept_user_input(input))
|
||||
|
||||
# Request information. Session doesn't matter.
|
||||
async def getOpenFiles(self) -> List[str]:
|
||||
resp = await self._send_and_receive_json({}, OpenFilesResponse, "openFiles")
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@
|
|||
"command": "continue.rejectAllSuggestions",
|
||||
"category": "Continue",
|
||||
"title": "Reject All Suggestions"
|
||||
},
|
||||
{
|
||||
"command": "continue.quickTextEntry",
|
||||
"category": "Continue",
|
||||
"title": "Quick Text Entry"
|
||||
}
|
||||
],
|
||||
"keybindings": [
|
||||
|
|
@ -138,6 +143,11 @@
|
|||
"command": "continue.rejectDiff",
|
||||
"mac": "shift+cmd+backspace",
|
||||
"key": "shift+ctrl+backspace"
|
||||
},
|
||||
{
|
||||
"command": "continue.quickTextEntry",
|
||||
"mac": "cmd+h",
|
||||
"key": "ctrl+h"
|
||||
}
|
||||
],
|
||||
"menus": {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { acceptDiffCommand, rejectDiffCommand } from "./diffs";
|
|||
import * as bridge from "./bridge";
|
||||
import { debugPanelWebview } from "./debugPanel";
|
||||
import { sendTelemetryEvent, TelemetryEvent } from "./telemetry";
|
||||
import { ideProtocolClient } from "./activation/activate";
|
||||
|
||||
// Copy everything over from extension.ts
|
||||
const commandsMap: { [command: string]: (...args: any) => any } = {
|
||||
|
|
@ -63,6 +64,17 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
|
|||
type: "focusContinueInput",
|
||||
});
|
||||
},
|
||||
"continue.quickTextEntry": async () => {
|
||||
const text = await vscode.window.showInputBox({
|
||||
placeHolder:
|
||||
"Ask a question, give instructions, or enter a slash command",
|
||||
title: "Continue Quick Input",
|
||||
});
|
||||
if (text) {
|
||||
ideProtocolClient.sendMainUserInput(text);
|
||||
}
|
||||
vscode.commands.executeCommand("continue.continueGUIView.focus");
|
||||
},
|
||||
};
|
||||
|
||||
const textEditorCommandsMap: { [command: string]: (...args: any) => {} } = {
|
||||
|
|
|
|||
|
|
@ -427,6 +427,10 @@ class IdeProtocolClient {
|
|||
sendAcceptRejectDiff(accepted: boolean) {
|
||||
this.messenger?.send("acceptRejectDiff", { accepted });
|
||||
}
|
||||
|
||||
sendMainUserInput(input: string) {
|
||||
this.messenger?.send("mainUserInput", { input });
|
||||
}
|
||||
}
|
||||
|
||||
export default IdeProtocolClient;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue