mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Merge pull request #594 from samhvw8/feat/code-action-with-current-task
feat(code-actions): add "Fix Code in Current Task" action
This commit is contained in:
@@ -188,10 +188,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
return findLast(Array.from(this.activeInstances), (instance) => instance.view?.visible === true)
|
||||
}
|
||||
|
||||
public static async handleCodeAction(
|
||||
promptType: keyof typeof ACTION_NAMES,
|
||||
params: Record<string, string | any[]>,
|
||||
): Promise<void> {
|
||||
public static async getInstance(): Promise<ClineProvider | undefined> {
|
||||
let visibleProvider = ClineProvider.getVisibleInstance()
|
||||
|
||||
// If no visible provider, try to show the sidebar view
|
||||
@@ -207,10 +204,46 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
||||
return
|
||||
}
|
||||
|
||||
return visibleProvider
|
||||
}
|
||||
|
||||
public static async isActiveTask(): Promise<boolean> {
|
||||
const visibleProvider = await ClineProvider.getInstance()
|
||||
if (!visibleProvider) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (visibleProvider.cline) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
public static async handleCodeAction(
|
||||
command: string,
|
||||
promptType: keyof typeof ACTION_NAMES,
|
||||
params: Record<string, string | any[]>,
|
||||
): Promise<void> {
|
||||
const visibleProvider = await ClineProvider.getInstance()
|
||||
if (!visibleProvider) {
|
||||
return
|
||||
}
|
||||
|
||||
const { customSupportPrompts } = await visibleProvider.getState()
|
||||
|
||||
const prompt = supportPrompt.create(promptType, params, customSupportPrompts)
|
||||
|
||||
if (visibleProvider.cline && command.endsWith("InCurrentTask")) {
|
||||
await visibleProvider.postMessageToWebview({
|
||||
type: "invoke",
|
||||
invoke: "sendMessage",
|
||||
text: prompt,
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
await visibleProvider.initClineWithTask(prompt)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user