update keybindings for accept/reject diff
This commit is contained in:
parent
3aee3ca08c
commit
26e536847c
8 changed files with 41 additions and 46 deletions
|
|
@ -56,25 +56,8 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
|
|||
private val coroutineScope = CoroutineScope(Dispatchers.IO)
|
||||
|
||||
override fun runActivity(project: Project) {
|
||||
|
||||
removeShortcutFromAction(getPlatformSpecificKeyStroke("J"))
|
||||
removeShortcutFromAction(getPlatformSpecificKeyStroke("shift J"))
|
||||
|
||||
// project.messageBus.connect().subscribe(
|
||||
// ToolWindowManagerListener.TOPIC,
|
||||
// object : ToolWindowManagerListener {
|
||||
// override fun stateChanged(toolWindowManager: ToolWindowManager) {
|
||||
// if (toolWindowManager.activeToolWindowId == TerminalToolWindowFactory.TOOL_WINDOW_ID
|
||||
// || TerminalView.getInstance(project).isNotAvailable()
|
||||
// ) {
|
||||
// project.service<TerminalActivityTrackingService>().update(
|
||||
// TerminalView.getInstance(project).widgets
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
|
||||
initializePlugin(project)
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +95,7 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
|
|||
project,
|
||||
ContinuePluginService::class.java
|
||||
)
|
||||
|
||||
|
||||
val defaultStrategy = DefaultTextSelectionStrategy()
|
||||
|
||||
coroutineScope.launch {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.intellij.openapi.components.ServiceManager
|
|||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.colors.EditorFontType
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey
|
||||
import com.intellij.openapi.editor.markup.EffectType
|
||||
import com.intellij.openapi.editor.markup.HighlighterLayer
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter
|
||||
import com.intellij.openapi.editor.markup.TextAttributes
|
||||
|
|
@ -54,7 +53,7 @@ class DiffStreamHandler(
|
|||
key.let { editor.colorsScheme.setAttributes(it, attributes) }
|
||||
key
|
||||
}
|
||||
|
||||
|
||||
private val unfinishedKey = run {
|
||||
val attributes = TextAttributes().apply {
|
||||
backgroundColor = JBColor(0x20888888.toInt(), 0x20888888.toInt())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
package com.github.continuedev.continueintellijextension.editor;
|
||||
|
||||
public class DiffStreamManager {
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.github.continuedev.continueintellijextension.`continue`.GetTheme
|
|||
import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
|
||||
import com.github.continuedev.continueintellijextension.services.ContinuePluginService
|
||||
import com.github.continuedev.continueintellijextension.utils.getAltKeyLabel
|
||||
import com.github.continuedev.continueintellijextension.utils.getMetaKeyLabel
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
|
|
@ -130,7 +131,7 @@ fun openInlineEdit(project: Project?, editor: Editor) {
|
|||
while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) {
|
||||
Thread.sleep(20)
|
||||
}
|
||||
|
||||
|
||||
// Get highlighted range
|
||||
val selectionModel = editor.selectionModel
|
||||
val startLineNumber = editor.document.getLineNumber(selectionModel.selectionStart)
|
||||
|
|
@ -416,16 +417,14 @@ class CustomPanel(
|
|||
border = EmptyBorder(0, 4, 0, 0)
|
||||
}
|
||||
|
||||
val leftButton = CustomButton("Reject (${getAltKeyLabel()}⇧N)") { onReject() }.apply {
|
||||
val leftButton = CustomButton("Reject All (${getMetaKeyLabel()}⇧⌫)") { onReject() }.apply {
|
||||
background = JBColor(0x30FF0000.toInt(), 0x30FF0000.toInt())
|
||||
foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt())
|
||||
|
||||
}
|
||||
|
||||
val rightButton = CustomButton("Accept (${getAltKeyLabel()}⇧Y)") { onAccept() }.apply {
|
||||
val rightButton = CustomButton("Accept All (${getMetaKeyLabel()}⇧⏎)") { onAccept() }.apply {
|
||||
background = JBColor(0x3000FF00.toInt(), 0x3000FF00.toInt())
|
||||
foreground = JBColor(0xF5F5F5.toInt(), 0xF5F5F5.toInt())
|
||||
|
||||
}
|
||||
|
||||
val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ fun getOs(): Os {
|
|||
fun getMetaKeyLabel(): String {
|
||||
return when (getOs()) {
|
||||
Os.MAC -> "⌘"
|
||||
Os.WINDOWS -> "Ctrl"
|
||||
Os.LINUX -> "Ctrl"
|
||||
Os.WINDOWS -> "^"
|
||||
Os.LINUX -> "^"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@
|
|||
<actions>
|
||||
<action class="com.github.continuedev.continueintellijextension.editor.InlineEditAction"
|
||||
id="continue.inlineEdit"
|
||||
icon="/tool-window-icon.svg"
|
||||
description="Inline Edit"
|
||||
text="Inline Edit">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
|
|
@ -59,29 +58,46 @@
|
|||
</action>
|
||||
|
||||
<action id="continue.acceptDiff"
|
||||
icon="/tool-window-icon.svg"
|
||||
class="com.github.continuedev.continueintellijextension.actions.AcceptDiffAction"
|
||||
text="Accept Diff" description="Accept Diff">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
first-keystroke="alt shift Y"/>
|
||||
first-keystroke="shift ctrl ENTER"/>
|
||||
<keyboard-shortcut keymap="Mac OS X"
|
||||
first-keystroke="alt shift Y"/>
|
||||
first-keystroke="shift meta ENTER"/>
|
||||
<override-text place="GoToAction" text="Continue: Accept Diff"/>
|
||||
</action>
|
||||
|
||||
<action id="continue.rejectDiff"
|
||||
icon="/tool-window-icon.svg"
|
||||
class="com.github.continuedev.continueintellijextension.actions.RejectDiffAction"
|
||||
text="Reject Diff" description="Reject Diff">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
first-keystroke="shift ctrl DELETE"/>
|
||||
<keyboard-shortcut keymap="Mac OS X"
|
||||
first-keystroke="shift meta DELETE"/>
|
||||
<override-text place="GoToAction" text="Continue: Reject Diff"/>
|
||||
</action>
|
||||
|
||||
<action id="continue.acceptVerticalDiffBlock"
|
||||
class="com.github.continuedev.continueintellijextension.actions.AcceptDiffAction"
|
||||
text="Accept Diff" description="Accept Vertical Diff Block">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
first-keystroke="alt shift Y"/>
|
||||
<keyboard-shortcut keymap="Mac OS X"
|
||||
first-keystroke="alt shift Y"/>
|
||||
<override-text place="GoToAction" text="Continue: Accept Vertical Diff Block"/>
|
||||
</action>
|
||||
|
||||
<action id="continue.rejectVerticalDiffBlock"
|
||||
class="com.github.continuedev.continueintellijextension.actions.RejectDiffAction"
|
||||
text="Reject Diff" description="Reject Vertical Diff Block">
|
||||
<keyboard-shortcut keymap="$default"
|
||||
first-keystroke="alt shift N"/>
|
||||
<keyboard-shortcut keymap="Mac OS X"
|
||||
first-keystroke="alt shift N"/>
|
||||
<override-text place="GoToAction" text="Continue: Reject Diff "/>
|
||||
<override-text place="GoToAction" text="Continue: Reject Vertical Diff Block"/>
|
||||
</action>
|
||||
|
||||
<action id="continue.focusContinueInputWithoutClear"
|
||||
icon="/tool-window-icon.svg"
|
||||
class="com.github.continuedev.continueintellijextension.actions.FocusContinueInputWithoutClearAction"
|
||||
text="Add selected code to context"
|
||||
description="Focus Continue Input With Edit">
|
||||
|
|
@ -93,7 +109,7 @@
|
|||
</action>
|
||||
|
||||
<action id="continue.newContinueSession"
|
||||
icon="/tool-window-icon.svg"
|
||||
icon="AllIcons.General.Add"
|
||||
class="com.github.continuedev.continueintellijextension.actions.NewContinueSessionAction"
|
||||
text="Start New Continue Session"
|
||||
description="Start New Continue Session">
|
||||
|
|
@ -102,7 +118,7 @@
|
|||
</action>
|
||||
|
||||
<action id="continue.viewHistory"
|
||||
icon="/tool-window-icon.svg"
|
||||
icon="AllIcons.Vcs.History"
|
||||
class="com.github.continuedev.continueintellijextension.actions.ViewHistoryAction"
|
||||
text="View History"
|
||||
description="View History">
|
||||
|
|
@ -110,7 +126,6 @@
|
|||
</action>
|
||||
|
||||
<action id="continue.focusContinueInput"
|
||||
icon="/tool-window-icon.svg"
|
||||
class="com.github.continuedev.continueintellijextension.actions.FocusContinueInputAction"
|
||||
text="Add selected code to context"
|
||||
description="Focus Continue Input">
|
||||
|
|
|
|||
|
|
@ -386,18 +386,14 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
if (numRed > 0) {
|
||||
const rangeToDelete =
|
||||
this.redDecorationManager.deleteRangeStartingAt(startLine);
|
||||
|
||||
if (accept) {
|
||||
// Delete the actual lines
|
||||
await this.deleteLinesAt(startLine, numRed);
|
||||
}
|
||||
if (numRed > 0 && accept) {
|
||||
// Delete the actual lines
|
||||
await this.deleteLinesAt(startLine, numRed);
|
||||
}
|
||||
|
||||
// Shift everything below upward
|
||||
const offset = -(accept ? numRed : numGreen);
|
||||
|
||||
this.redDecorationManager.shiftDownAfterLine(startLine, offset);
|
||||
this.greenDecorationManager.shiftDownAfterLine(startLine, offset);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { ConfigHandler } from "core/config/ConfigHandler";
|
||||
import { pruneLinesFromBottom, pruneLinesFromTop } from "core/llm/countTokens";
|
||||
import { getMarkdownLanguageTagForFile } from "core/util";
|
||||
|
||||
import { DiffLine } from "core";
|
||||
import { streamDiffLines } from "core/edit/streamDiffLines";
|
||||
import * as vscode from "vscode";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue