mirror of
https://github.com/chylex/IntelliJ-AceJump.git
synced 2024-11-25 17:42:46 +01:00
Compare commits
No commits in common. "e005983d4c1da6c3571e70affa4ff18e68e9e29e" and "100001ffcabf41086216192c25253724556467d7" have entirely different histories.
e005983d4c
...
100001ffca
@ -8,7 +8,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "org.acejump"
|
||||
version = "chylex-14"
|
||||
version = "chylex-13"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@ -21,7 +21,7 @@ kotlin {
|
||||
intellij {
|
||||
version.set("2023.2")
|
||||
updateSinceUntilBuild.set(false)
|
||||
plugins.add("IdeaVIM:chylex-20")
|
||||
plugins.add("IdeaVIM:chylex-16")
|
||||
|
||||
pluginsRepositories {
|
||||
custom("https://intellij.chylex.com")
|
||||
|
@ -1,8 +1,5 @@
|
||||
package org.acejump.action
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.IdeActions
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.command.CommandProcessor
|
||||
import com.intellij.openapi.command.UndoConfirmationPolicy
|
||||
import com.intellij.openapi.editor.Document
|
||||
@ -12,7 +9,6 @@ import com.intellij.openapi.fileEditor.TextEditor
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.playback.commands.ActionCommand
|
||||
import org.acejump.search.SearchProcessor
|
||||
|
||||
/**
|
||||
@ -53,14 +49,6 @@ sealed class AceTagAction {
|
||||
caretModel.moveToOffset(offset)
|
||||
}
|
||||
|
||||
fun performAction(actionName: String) {
|
||||
val actionManager = ActionManager.getInstance()
|
||||
val action = actionManager.getAction(actionName)
|
||||
if (action != null) {
|
||||
actionManager.tryToExecute(action, ActionCommand.getInputEvent(null), null, null, true)
|
||||
}
|
||||
}
|
||||
|
||||
fun ensureEditorFocused(editor: Editor) {
|
||||
val project = editor.project ?: return
|
||||
val fem = FileEditorManagerEx.getInstanceEx(project)
|
||||
@ -93,16 +81,4 @@ sealed class AceTagAction {
|
||||
return offset
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On default action, performs the Go To Declaration action, available via `Navigate | Declaration or Usages`.
|
||||
* On shift action, performs the Go To Type Declaration action, available via `Navigate | Type Declaration`.
|
||||
* Always places the caret at the start of the word.
|
||||
*/
|
||||
object GoToDeclaration : AceTagAction() {
|
||||
override fun invoke(editor: Editor, searchProcessor: SearchProcessor, offset: Int, shiftMode: Boolean, isFinal: Boolean) {
|
||||
JumpToSearchStart(editor, searchProcessor, offset, shiftMode = false, isFinal = isFinal)
|
||||
ApplicationManager.getApplication().invokeLater { performAction(if (shiftMode) IdeActions.ACTION_GOTO_TYPE_DECLARATION else IdeActions.ACTION_GOTO_DECLARATION) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,10 +18,7 @@ import com.maddyhome.idea.vim.helper.vimSelectionStart
|
||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||
import org.acejump.boundaries.StandardBoundaries.AFTER_CARET
|
||||
import org.acejump.boundaries.StandardBoundaries.BEFORE_CARET
|
||||
import org.acejump.boundaries.StandardBoundaries.CARET_LINE
|
||||
import org.acejump.boundaries.StandardBoundaries.VISIBLE_ON_SCREEN
|
||||
import org.acejump.boundaries.StandardBoundaries.*
|
||||
import org.acejump.modes.JumpMode
|
||||
import org.acejump.search.Pattern
|
||||
import org.acejump.search.Tag
|
||||
@ -86,7 +83,6 @@ sealed class AceVimAction : DumbAwareAction() {
|
||||
}
|
||||
}
|
||||
|
||||
injector.scroll.scrollCaretIntoView(editor.vim)
|
||||
mode.finishSession(editor, session)
|
||||
return true
|
||||
}
|
||||
@ -163,25 +159,4 @@ sealed class AceVimAction : DumbAwareAction() {
|
||||
class JumpUWordEndBackward : AceVimAction() {
|
||||
override val mode = AceVimMode.JumpToPattern(Pattern.VIM_UWORD_END, BEFORE_CARET.intersection(VISIBLE_ON_SCREEN))
|
||||
}
|
||||
|
||||
class JumpAllEditorsGoToDeclaration : DumbAwareAction() {
|
||||
override fun update(action: AnActionEvent) {
|
||||
action.presentation.isEnabled = action.getData(CommonDataKeys.EDITOR) != null
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
|
||||
val session = SessionManager.start(editor, AceVimMode.JumpAllEditors.getJumpEditors(editor))
|
||||
|
||||
session.defaultBoundary = VISIBLE_ON_SCREEN
|
||||
session.startJumpMode {
|
||||
object : JumpMode() {
|
||||
override fun accept(state: SessionState, acceptedTag: Tag): Boolean {
|
||||
state.act(AceTagAction.GoToDeclaration, acceptedTag, shiftMode = wasUpperCase, isFinal = true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
<actions>
|
||||
<action id="AceVimAction_JumpAllEditors" class="org.acejump.action.AceVimAction$JumpAllEditors" text="AceJump Vim - Jump All Editors" />
|
||||
<action id="AceVimAction_JumpAllEditors_GoToDeclaration" class="org.acejump.action.AceVimAction$JumpAllEditorsGoToDeclaration" text="AceJump Vim - Jump All Editors - Go To Declaration" />
|
||||
<action id="AceVimAction_JumpForward" class="org.acejump.action.AceVimAction$JumpForward" text="AceJump Vim - Jump Forward" />
|
||||
<action id="AceVimAction_JumpBackward" class="org.acejump.action.AceVimAction$JumpBackward" text="AceJump Vim - Jump Backward" />
|
||||
<action id="AceVimAction_JumpTillForward" class="org.acejump.action.AceVimAction$JumpTillForward" text="AceJump Vim - Jump Till Forward" />
|
||||
|
Loading…
Reference in New Issue
Block a user