mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-07 21:34:09 +02:00
Remove deprecated methods
This commit is contained in:
parent
2505651c68
commit
a6aa26b5d9
src/main/java/com/maddyhome/idea/vim/extension/replacewithregister
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
impl/state
key
state
vimscript/model/commands
@ -10,6 +10,7 @@ package com.maddyhome.idea.vim.extension.replacewithregister
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||
@ -166,13 +167,14 @@ private fun doReplace(editor: Editor, context: DataContext, caret: ImmutableVimC
|
||||
putToLine = -1,
|
||||
)
|
||||
val vimEditor = editor.vim
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
ClipboardOptionHelper.IdeaputDisabler().use {
|
||||
VimPlugin.getPut().putText(
|
||||
vimEditor,
|
||||
context.vim,
|
||||
putData,
|
||||
operatorArguments = OperatorArguments(
|
||||
editor.vimStateMachine?.isOperatorPending(vimEditor.mode) ?: false,
|
||||
keyHandler.isOperatorPending(vimEditor.mode, keyHandler.keyHandlerState),
|
||||
0,
|
||||
editor.vim.mode,
|
||||
),
|
||||
|
@ -7,21 +7,14 @@
|
||||
*/
|
||||
package com.maddyhome.idea.vim.impl.state
|
||||
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.CommandBuilder
|
||||
import com.maddyhome.idea.vim.command.CommandFlags
|
||||
import com.maddyhome.idea.vim.command.MappingMode
|
||||
import com.maddyhome.idea.vim.command.MappingState
|
||||
import com.maddyhome.idea.vim.common.DigraphResult
|
||||
import com.maddyhome.idea.vim.common.DigraphSequence
|
||||
import com.maddyhome.idea.vim.helper.noneOfEnum
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import org.jetbrains.annotations.Contract
|
||||
import java.util.*
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
/**
|
||||
* Used to maintain state before and while entering a Vim command (operator, motion, text object, etc.)
|
||||
@ -44,18 +37,6 @@ public class VimStateMachineImpl : VimStateMachine {
|
||||
*/
|
||||
override var executingCommand: Command? = null
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
override fun isOperatorPending(mode: Mode): Boolean {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
return keyHandler.isOperatorPending(mode, keyHandler.keyHandlerState)
|
||||
}
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
override fun isDuplicateOperatorKeyStroke(key: KeyStroke, mode: Mode): Boolean {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
return keyHandler.isDuplicateOperatorKeyStroke(key, mode, keyHandler.keyHandlerState)
|
||||
}
|
||||
|
||||
override val executingCommandFlags: EnumSet<CommandFlags>
|
||||
get() = executingCommand?.flags ?: noneOfEnum()
|
||||
|
||||
@ -66,24 +47,6 @@ public class VimStateMachineImpl : VimStateMachine {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
override fun startDigraphSequence() {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
keyHandler.keyHandlerState.digraphSequence.startDigraphSequence()
|
||||
}
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
override fun startLiteralSequence() {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
keyHandler.keyHandlerState.digraphSequence.startLiteralSequence()
|
||||
}
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
override fun processDigraphKey(key: KeyStroke, editor: VimEditor): DigraphResult {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
return keyHandler.keyHandlerState.digraphSequence.processKey(key, editor)
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the insert/overwrite state. If currently insert, goto replace mode. If currently replace, goto insert
|
||||
* mode.
|
||||
|
@ -25,7 +25,6 @@ import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||
import com.maddyhome.idea.vim.group.visual.VimSelection.Companion.create
|
||||
import com.maddyhome.idea.vim.helper.VimNlsSafe
|
||||
import com.maddyhome.idea.vim.state.KeyHandlerState
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
|
||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||
@ -148,12 +147,12 @@ public class ToHandlerMappingInfo(
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, keyState: KeyHandlerState) {
|
||||
LOG.debug("Executing 'ToHandler' mapping info...")
|
||||
val vimStateMachine = VimStateMachine.getInstance(editor)
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
|
||||
// Cache isOperatorPending in case the extension changes the mode while moving the caret
|
||||
// See CommonExtensionTest
|
||||
// TODO: Is this legal? Should we assert in this case?
|
||||
val shouldCalculateOffsets: Boolean = vimStateMachine.isOperatorPending(editor.mode)
|
||||
val shouldCalculateOffsets: Boolean = keyHandler.isOperatorPending(editor.mode, keyState)
|
||||
|
||||
val startOffsets: Map<ImmutableVimCaret, Int> = editor.carets().associateWith { it.offset }
|
||||
|
||||
@ -181,7 +180,7 @@ public class ToHandlerMappingInfo(
|
||||
}
|
||||
}
|
||||
|
||||
val operatorArguments = OperatorArguments(vimStateMachine.isOperatorPending(editor.mode), keyState.commandBuilder.count, vimStateMachine.mode)
|
||||
val operatorArguments = OperatorArguments(keyHandler.isOperatorPending(editor.mode, keyState), keyState.commandBuilder.count, editor.mode)
|
||||
val register = keyState.commandBuilder.register
|
||||
if (register != null) {
|
||||
injector.registerGroup.selectRegister(register)
|
||||
|
@ -8,16 +8,13 @@
|
||||
|
||||
package com.maddyhome.idea.vim.state
|
||||
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
import com.maddyhome.idea.vim.api.globalOptions
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.CommandFlags
|
||||
import com.maddyhome.idea.vim.common.DigraphResult
|
||||
import com.maddyhome.idea.vim.impl.state.VimStateMachineImpl
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import java.util.*
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
/**
|
||||
* Used to maintain state before and while entering a Vim command (operator, motion, text object, etc.)
|
||||
@ -39,18 +36,9 @@ public interface VimStateMachine {
|
||||
* This field is reset after the command has been executed.
|
||||
*/
|
||||
public var executingCommand: Command?
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
public fun isOperatorPending(mode: Mode): Boolean
|
||||
public val executingCommandFlags: EnumSet<CommandFlags>
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
public fun isDuplicateOperatorKeyStroke(key: KeyStroke, mode: Mode): Boolean
|
||||
|
||||
public fun resetRegisterPending()
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
public fun startLiteralSequence()
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
public fun processDigraphKey(key: KeyStroke, editor: VimEditor): DigraphResult
|
||||
|
||||
/**
|
||||
* Toggles the insert/overwrite state. If currently insert, goto replace mode. If currently replace, goto insert
|
||||
@ -58,9 +46,6 @@ public interface VimStateMachine {
|
||||
*/
|
||||
public fun toggleInsertOverwrite()
|
||||
|
||||
@Deprecated("Please use KeyHandler instead")
|
||||
public fun startDigraphSequence()
|
||||
|
||||
public companion object {
|
||||
private val globalState = VimStateMachineImpl()
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
package com.maddyhome.idea.vim.vimscript.model.commands
|
||||
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
@ -22,7 +23,6 @@ import com.maddyhome.idea.vim.ex.ranges.LineRange
|
||||
import com.maddyhome.idea.vim.ex.ranges.Range
|
||||
import com.maddyhome.idea.vim.helper.Msg
|
||||
import com.maddyhome.idea.vim.helper.StrictMode
|
||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||
import com.maddyhome.idea.vim.state.mode.inNormalMode
|
||||
import com.maddyhome.idea.vim.state.mode.isBlock
|
||||
import com.maddyhome.idea.vim.vimscript.model.Executable
|
||||
@ -91,8 +91,10 @@ public sealed class Command(private val commandRange: Range, public val commandA
|
||||
return ExecutionResult.Error
|
||||
}
|
||||
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
val keyState = keyHandler.keyHandlerState
|
||||
val operatorArguments = OperatorArguments(
|
||||
editor.vimStateMachine.isOperatorPending(editor.mode),
|
||||
keyHandler.isOperatorPending(editor.mode, keyState),
|
||||
0,
|
||||
editor.mode,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user