feat(JB): impl showFile
This commit is contained in:
parent
50765d8970
commit
24bb5eb0da
5 changed files with 22 additions and 14 deletions
6
core/index.d.ts
vendored
6
core/index.d.ts
vendored
|
|
@ -842,7 +842,7 @@ export interface SlashCommand {
|
|||
description: string;
|
||||
prompt?: string;
|
||||
params?: { [key: string]: any };
|
||||
promptFile?: string
|
||||
promptFile?: string;
|
||||
run: (sdk: ContinueSDK) => AsyncGenerator<string | undefined>;
|
||||
}
|
||||
|
||||
|
|
@ -1253,6 +1253,10 @@ export interface AcceptOrRejectDiffPayload {
|
|||
streamId?: string;
|
||||
}
|
||||
|
||||
export interface ShowFilePayload {
|
||||
filepath: string;
|
||||
}
|
||||
|
||||
export interface RangeInFileWithContents {
|
||||
filepath: string;
|
||||
range: {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
MessageContent,
|
||||
RangeInFileWithContents,
|
||||
AcceptOrRejectDiffPayload,
|
||||
ShowFilePayload,
|
||||
} from "../";
|
||||
|
||||
export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
|
||||
|
|
@ -23,7 +24,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
|
|||
];
|
||||
overwriteFile: [{ filepath: string; prevFileContent: string | null }, void];
|
||||
showTutorial: [undefined, void];
|
||||
showFile: [{ filepath: string }, void];
|
||||
showFile: [ShowFilePayload, void];
|
||||
toggleDevTools: [undefined, void];
|
||||
reloadWindow: [undefined, void];
|
||||
focusEditor: [undefined, void];
|
||||
|
|
|
|||
|
|
@ -91,6 +91,15 @@ class IdeProtocolClient(
|
|||
respond(jsonData)
|
||||
}
|
||||
|
||||
"showFile" -> {
|
||||
val params = Gson().fromJson(
|
||||
dataElement.toString(),
|
||||
ShowFilePayload::class.java
|
||||
)
|
||||
ide.openFile(params.filepath)
|
||||
respond(null)
|
||||
}
|
||||
|
||||
"getIdeSettings" -> {
|
||||
val settings = ide.getIdeSettings()
|
||||
respond(settings)
|
||||
|
|
@ -438,7 +447,7 @@ class IdeProtocolClient(
|
|||
"acceptDiff" -> {
|
||||
val params = Gson().fromJson(
|
||||
dataElement.toString(),
|
||||
AcceptDiffParams::class.java
|
||||
AcceptOrRejectDiffPayload::class.java
|
||||
)
|
||||
val filepath = params.filepath;
|
||||
|
||||
|
|
@ -454,7 +463,7 @@ class IdeProtocolClient(
|
|||
"rejectDiff" -> {
|
||||
val params = Gson().fromJson(
|
||||
dataElement.toString(),
|
||||
RejectDiffParams::class.java
|
||||
AcceptOrRejectDiffPayload::class.java
|
||||
)
|
||||
val filepath = params.filepath;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,16 +15,6 @@ data class ApplyToFileParams(
|
|||
val toolCallId: String?
|
||||
)
|
||||
|
||||
data class AcceptDiffParams(
|
||||
val filepath: String,
|
||||
val streamId: String
|
||||
)
|
||||
|
||||
data class RejectDiffParams(
|
||||
val filepath: String,
|
||||
val streamId: String
|
||||
)
|
||||
|
||||
data class InsertAtCursorParams(
|
||||
val text: String
|
||||
)
|
||||
|
|
|
|||
|
|
@ -250,4 +250,8 @@ data class StreamDiffLinesPayload(
|
|||
data class AcceptOrRejectDiffPayload(
|
||||
val filepath: String,
|
||||
val streamId: String? = null
|
||||
)
|
||||
|
||||
data class ShowFilePayload(
|
||||
val filepath: String
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue