mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-06 03:34:03 +02:00
Remove explicit API mode to enhance coding efficiency and maintain Kotlin's conciseness
Explicit API mode has been removed due to several reasons impacting developer productivity and the natural coding style in Kotlin. Firstly, the mode was found to be more irritating than beneficial, as it forced unnecessary verbosity without enhancing thoughtfulness in coding. It often prompted automatic 'public' insertion reactions to red-highlighted code, which did not genuinely encourage more deliberate coding decisions. Secondly, our aim is to form a robust API primarily through interfaces, which inherently define public scope and duty, rendering explicit API mode somewhat redundant. Lastly, the additional verbosity caused by explicit API mode expanded code lines affecting code readability. The compatibility with the existing plugins is verified via the compatibility checker, so no JetBrains plugins will be affected
This commit is contained in:
parent
ffd832d990
commit
9538714af1
annotation-processors/src/main/kotlin/com/intellij/vim/providers
build.gradle.ktssrc
main/java/com/maddyhome/idea/vim
RegisterActions.ktVimTypedActionHandler.kt
action
common
ex
extension
group
ChangeGroup.ktFileGroup.ktIjOptionProperties.ktIjOptions.ktIjVimPsiService.ktIjVimRedrawService.ktOptionGroup.ktProcessGroup.kt
visual
helper
CaretVisualAttributesHelper.ktCommandStateExtensions.ktEditorHelper.ktSearchHelperKt.ktStringHelper.ktTestInputModel.ktUserDataManager.kt
listener
newapi
IjEditorExecutionContext.ktIjLiveRange.ktIjNativeActionManager.ktIjVimCaret.ktIjVimEditor.ktIjVimInjector.ktIjVimSearchGroup.kt
statistic
ui
vimscript/model
commands
functions
options/helpers
testFixtures/kotlin/org/jetbrains/plugins/ideavim
vim-engine
build.gradle.kts
src/main/kotlin/com/maddyhome/idea/vim
KeyHandler.kt
action
CommandProvider.ktEngineCommandProvider.ktResetModeAction.kt
change
BreakUndoSequenceAction.ktExtension.ktLazyVimCommand.ktRedoAction.ktUndoAction.ktVimRepeater.kt
change
AutoIndentLinesVisualAction.ktChangeCaseLowerMotionAction.ktChangeCaseLowerVisualAction.ktChangeCaseToggleCharacterAction.ktChangeCaseToggleMotionAction.ktChangeCaseToggleVisualAction.ktChangeCaseUpperMotionAction.ktChangeCaseUpperVisualAction.ktChangeCharacterAction.ktChangeCharactersAction.ktChangeEndOfLineAction.ktChangeInInsertSequenceAction.ktChangeLastGlobalSearchReplaceAction.ktChangeLastSearchReplaceAction.ktChangeLineAction.ktChangeMotionAction.ktChangeReplaceAction.ktChangeVisualAction.ktChangeVisualCharacterAction.ktChangeVisualLinesAction.ktChangeVisualLinesEndAction.ktFilterMotionAction.ktReformatCodeMotionAction.ktReformatCodeVisualAction.kt
number
delete
DeleteCharacterAction.ktDeleteEndOfLineAction.ktDeleteMotionAction.ktDeleteVisualAction.ktDeleteVisualLinesAction.ktDeleteVisualLinesEndAction.kt
insert
@ -13,7 +13,7 @@ import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
|
||||
import com.google.devtools.ksp.processing.SymbolProcessorProvider
|
||||
import com.intellij.vim.processors.VimscriptFunctionProcessor
|
||||
|
||||
public class VimscriptFunctionProcessorProvider : SymbolProcessorProvider {
|
||||
class VimscriptFunctionProcessorProvider : SymbolProcessorProvider {
|
||||
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor {
|
||||
return VimscriptFunctionProcessor(environment)
|
||||
}
|
||||
|
@ -269,7 +269,6 @@ java {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
explicitApi()
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
|
@ -14,28 +14,28 @@ import com.maddyhome.idea.vim.key.MappingOwner
|
||||
import java.awt.event.KeyEvent
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public object RegisterActions {
|
||||
object RegisterActions {
|
||||
/**
|
||||
* Register all the key/action mappings for the plugin.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun registerActions() {
|
||||
fun registerActions() {
|
||||
registerVimCommandActions()
|
||||
registerShortcutsWithoutActions()
|
||||
}
|
||||
|
||||
public fun findAction(id: String): EditorActionHandlerBase? {
|
||||
fun findAction(id: String): EditorActionHandlerBase? {
|
||||
val commandBean = IntellijCommandProvider.getCommands().firstOrNull { it.actionId == id }
|
||||
?: EngineCommandProvider.getCommands().firstOrNull { it.actionId == id } ?: return null
|
||||
return commandBean.instance
|
||||
}
|
||||
|
||||
public fun findActionOrDie(id: String): EditorActionHandlerBase {
|
||||
fun findActionOrDie(id: String): EditorActionHandlerBase {
|
||||
return findAction(id) ?: throw RuntimeException("Action $id is not registered")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun unregisterActions() {
|
||||
fun unregisterActions() {
|
||||
val keyGroup = VimPlugin.getKeyIfCreated()
|
||||
keyGroup?.unregisterCommandActions()
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ import javax.swing.KeyStroke
|
||||
* This class is used in Which-Key plugin, so don't make it internal. Generally, we should provide a proper
|
||||
* way to get ideavim keys for this plugin. See VIM-3085
|
||||
*/
|
||||
public class VimTypedActionHandler(origHandler: TypedActionHandler) : TypedActionHandlerEx {
|
||||
class VimTypedActionHandler(origHandler: TypedActionHandler) : TypedActionHandlerEx {
|
||||
private val handler = KeyHandler.getInstance()
|
||||
private val traceTime = injector.globalOptions().ideatracetime
|
||||
|
||||
|
@ -8,6 +8,6 @@
|
||||
|
||||
package com.maddyhome.idea.vim.action
|
||||
|
||||
public object IntellijCommandProvider : CommandProvider {
|
||||
object IntellijCommandProvider : CommandProvider {
|
||||
override val commandListFileName: String = "intellij_commands.json"
|
||||
}
|
@ -60,7 +60,7 @@ import javax.swing.KeyStroke
|
||||
* This class is used in Which-Key plugin, so don't make it internal. Generally, we should provide a proper
|
||||
* way to get ideavim keys for this plugin. See VIM-3085
|
||||
*/
|
||||
public class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
||||
class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
||||
private val traceTime: Boolean
|
||||
get() {
|
||||
// Make sure the injector is initialized
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ijOptions
|
||||
|
||||
@CommandOrMotion(keys = ["gJ"], modes = [Mode.NORMAL])
|
||||
public class DeleteJoinLinesAction : ChangeEditorActionHandler.ConditionalSingleExecution() {
|
||||
class DeleteJoinLinesAction : ChangeEditorActionHandler.ConditionalSingleExecution() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
override fun runAsMulticaret(
|
||||
editor: VimEditor,
|
||||
|
@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.newapi.ijOptions
|
||||
|
||||
@CommandOrMotion(keys = ["J"], modes = [Mode.NORMAL])
|
||||
public class DeleteJoinLinesSpacesAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class DeleteJoinLinesSpacesAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun execute(
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.newapi.ijOptions
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["gJ"], modes = [Mode.VISUAL])
|
||||
public class DeleteJoinVisualLinesAction : VisualOperatorActionHandler.SingleExecution() {
|
||||
class DeleteJoinVisualLinesAction : VisualOperatorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun executeForAllCarets(
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.newapi.ijOptions
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["J"], modes = [Mode.VISUAL])
|
||||
public class DeleteJoinVisualLinesSpacesAction : VisualOperatorActionHandler.SingleExecution() {
|
||||
class DeleteJoinVisualLinesSpacesAction : VisualOperatorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun executeForAllCarets(
|
||||
|
@ -12,18 +12,18 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.LogicalPosition
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
|
||||
public class CharacterPosition(line: Int, col: Int) : LogicalPosition(line, col) {
|
||||
public fun toOffset(editor: Editor): Int = editor.vim.getLineStartOffset(line) + column
|
||||
class CharacterPosition(line: Int, col: Int) : LogicalPosition(line, col) {
|
||||
fun toOffset(editor: Editor): Int = editor.vim.getLineStartOffset(line) + column
|
||||
|
||||
public companion object {
|
||||
public fun fromOffset(editor: Editor, offset: Int): CharacterPosition {
|
||||
companion object {
|
||||
fun fromOffset(editor: Editor, offset: Int): CharacterPosition {
|
||||
// logical position "expands" tabs
|
||||
val logicalPosition = editor.offsetToLogicalPosition(offset)
|
||||
val lineStartOffset = editor.vim.getLineStartOffset(logicalPosition.line)
|
||||
return CharacterPosition(logicalPosition.line, offset - lineStartOffset)
|
||||
}
|
||||
|
||||
public fun atCaret(editor: Editor): CharacterPosition {
|
||||
fun atCaret(editor: Editor): CharacterPosition {
|
||||
return fromOffset(editor, editor.caretModel.offset)
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import com.maddyhome.idea.vim.helper.vimExOutput
|
||||
import com.maddyhome.idea.vim.ui.ExOutputPanel
|
||||
|
||||
// TODO: We need a nicer way to handle output, especially wrt testing, appending + clearing
|
||||
public class ExOutputModel private constructor(private val myEditor: Editor) : VimExOutputPanel {
|
||||
class ExOutputModel private constructor(private val myEditor: Editor) : VimExOutputPanel {
|
||||
private var isActiveInTestMode = false
|
||||
|
||||
override val isActive: Boolean
|
||||
@ -60,9 +60,9 @@ public class ExOutputModel private constructor(private val myEditor: Editor) : V
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
public fun getInstance(editor: Editor): ExOutputModel {
|
||||
fun getInstance(editor: Editor): ExOutputModel {
|
||||
var model = editor.vimExOutput
|
||||
if (model == null) {
|
||||
model = ExOutputModel(editor)
|
||||
|
@ -50,13 +50,13 @@ import javax.swing.KeyStroke
|
||||
*
|
||||
* @author vlan
|
||||
*/
|
||||
public object VimExtensionFacade {
|
||||
object VimExtensionFacade {
|
||||
|
||||
private val LOG = logger<VimExtensionFacade>()
|
||||
|
||||
/** The 'map' command for mapping keys to handlers defined in extensions. */
|
||||
@JvmStatic
|
||||
public fun putExtensionHandlerMapping(
|
||||
fun putExtensionHandlerMapping(
|
||||
modes: Set<MappingMode>,
|
||||
fromKeys: List<KeyStroke>,
|
||||
pluginOwner: MappingOwner,
|
||||
@ -74,7 +74,7 @@ public object VimExtensionFacade {
|
||||
"com.maddyhome.idea.vim.VimPlugin"
|
||||
)
|
||||
)
|
||||
public fun putExtensionHandlerMapping(
|
||||
fun putExtensionHandlerMapping(
|
||||
modes: Set<MappingMode>,
|
||||
fromKeys: List<KeyStroke>,
|
||||
pluginOwner: MappingOwner,
|
||||
@ -86,7 +86,7 @@ public object VimExtensionFacade {
|
||||
|
||||
/** The 'map' command for mapping keys to other keys. */
|
||||
@JvmStatic
|
||||
public fun putKeyMapping(
|
||||
fun putKeyMapping(
|
||||
modes: Set<MappingMode>,
|
||||
fromKeys: List<KeyStroke>,
|
||||
pluginOwner: MappingOwner,
|
||||
@ -98,7 +98,7 @@ public object VimExtensionFacade {
|
||||
|
||||
/** The 'map' command for mapping keys to other keys if there is no other mapping to these keys */
|
||||
@JvmStatic
|
||||
public fun putKeyMappingIfMissing(
|
||||
fun putKeyMappingIfMissing(
|
||||
modes: Set<MappingMode>,
|
||||
fromKeys: List<KeyStroke>,
|
||||
pluginOwner: MappingOwner,
|
||||
@ -112,7 +112,7 @@ public object VimExtensionFacade {
|
||||
/**
|
||||
* Equivalent to calling 'command' to set up a user-defined command or alias
|
||||
*/
|
||||
public fun addCommand(
|
||||
fun addCommand(
|
||||
name: String,
|
||||
handler: CommandAliasHandler,
|
||||
) {
|
||||
@ -123,7 +123,7 @@ public object VimExtensionFacade {
|
||||
* Equivalent to calling 'command' to set up a user-defined command or alias
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun addCommand(
|
||||
fun addCommand(
|
||||
name: String,
|
||||
minimumNumberOfArguments: Int,
|
||||
maximumNumberOfArguments: Int,
|
||||
@ -141,7 +141,7 @@ public object VimExtensionFacade {
|
||||
* leaves the editor in the insert mode if it's been activated.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun executeNormalWithoutMapping(keys: List<KeyStroke>, editor: Editor) {
|
||||
fun executeNormalWithoutMapping(keys: List<KeyStroke>, editor: Editor) {
|
||||
val context = injector.executionContextManager.getEditorExecutionContext(editor.vim)
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
keys.forEach { keyHandler.handleKey(editor.vim, it, context, false, false, keyHandler.keyHandlerState) }
|
||||
@ -149,7 +149,7 @@ public object VimExtensionFacade {
|
||||
|
||||
/** Returns a single key stroke from the user input similar to 'getchar()'. */
|
||||
@JvmStatic
|
||||
public fun inputKeyStroke(editor: Editor): KeyStroke {
|
||||
fun inputKeyStroke(editor: Editor): KeyStroke {
|
||||
if (editor.vim.vimStateMachine.isDotRepeatInProgress) {
|
||||
val input = Extension.consumeKeystroke()
|
||||
LOG.trace("inputKeyStroke: dot repeat in progress. Input: $input")
|
||||
@ -181,43 +181,43 @@ public object VimExtensionFacade {
|
||||
|
||||
/** Returns a string typed in the input box similar to 'input()'. */
|
||||
@JvmStatic
|
||||
public fun inputString(editor: Editor, context: DataContext, prompt: String, finishOn: Char?): String {
|
||||
fun inputString(editor: Editor, context: DataContext, prompt: String, finishOn: Char?): String {
|
||||
return injector.commandLine.inputString(editor.vim, context.vim, prompt, finishOn) ?: ""
|
||||
}
|
||||
|
||||
/** Get the current contents of the given register similar to 'getreg()'. */
|
||||
@JvmStatic
|
||||
public fun getRegister(register: Char): List<KeyStroke>? {
|
||||
fun getRegister(register: Char): List<KeyStroke>? {
|
||||
val reg = VimPlugin.getRegister().getRegister(register) ?: return null
|
||||
return reg.keys
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||
val reg = caret.registerStorage.getRegister(register) ?: return null
|
||||
return reg.keys
|
||||
}
|
||||
|
||||
/** Set the current contents of the given register */
|
||||
@JvmStatic
|
||||
public fun setRegister(register: Char, keys: List<KeyStroke?>?) {
|
||||
fun setRegister(register: Char, keys: List<KeyStroke?>?) {
|
||||
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList())
|
||||
}
|
||||
|
||||
/** Set the current contents of the given register */
|
||||
@JvmStatic
|
||||
public fun setRegisterForCaret(register: Char, caret: ImmutableVimCaret, keys: List<KeyStroke?>?) {
|
||||
fun setRegisterForCaret(register: Char, caret: ImmutableVimCaret, keys: List<KeyStroke?>?) {
|
||||
caret.registerStorage.setKeys(register, keys?.filterNotNull() ?: emptyList())
|
||||
}
|
||||
|
||||
/** Set the current contents of the given register */
|
||||
@JvmStatic
|
||||
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
||||
fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
||||
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
public fun exportScriptFunction(
|
||||
fun exportScriptFunction(
|
||||
scope: Scope?,
|
||||
name: String,
|
||||
args: List<String>,
|
||||
@ -253,7 +253,7 @@ public object VimExtensionFacade {
|
||||
}
|
||||
}
|
||||
|
||||
public fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
|
||||
fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
|
||||
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) {
|
||||
editor, context, args ->
|
||||
|
||||
@ -274,6 +274,6 @@ public fun VimExtensionFacade.exportOperatorFunction(name: String, function: Ope
|
||||
}
|
||||
}
|
||||
|
||||
public fun interface ScriptFunction {
|
||||
public fun execute(editor: VimEditor, context: ExecutionContext, args: Map<String, VimDataType>): ExecutionResult
|
||||
fun interface ScriptFunction {
|
||||
fun execute(editor: VimEditor, context: ExecutionContext, args: Map<String, VimDataType>): ExecutionResult
|
||||
}
|
@ -19,12 +19,12 @@ import com.maddyhome.idea.vim.newapi.ij
|
||||
* COMPATIBILITY-LAYER: Created a class, renamed original class
|
||||
* Please see: https://jb.gg/zo8n0r
|
||||
*/
|
||||
public interface VimExtensionHandler : ExtensionHandler {
|
||||
interface VimExtensionHandler : ExtensionHandler {
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||
execute(editor.ij, context.ij)
|
||||
}
|
||||
|
||||
public fun execute(editor: Editor, context: DataContext)
|
||||
fun execute(editor: Editor, context: DataContext)
|
||||
|
||||
public abstract class WithCallback : ExtensionHandler.WithCallback(), VimExtensionHandler
|
||||
abstract class WithCallback : ExtensionHandler.WithCallback(), VimExtensionHandler
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ import kotlin.math.min
|
||||
/**
|
||||
* Provides all the insert/replace related functionality
|
||||
*/
|
||||
public class ChangeGroup : VimChangeGroupBase() {
|
||||
class ChangeGroup : VimChangeGroupBase() {
|
||||
private val insertListeners = ContainerUtil.createLockFreeCopyOnWriteList<VimInsertListener>()
|
||||
private val listener: EditorMouseListener = object : EditorMouseListener {
|
||||
override fun mouseClicked(event: EditorMouseEvent) {
|
||||
@ -96,7 +96,7 @@ public class ChangeGroup : VimChangeGroupBase() {
|
||||
}
|
||||
}
|
||||
|
||||
public fun editorCreated(editor: Editor?, disposable: Disposable) {
|
||||
fun editorCreated(editor: Editor?, disposable: Disposable) {
|
||||
EventFacade.getInstance().addEditorMouseListener(editor!!, listener, disposable)
|
||||
}
|
||||
|
||||
@ -790,11 +790,11 @@ public class ChangeGroup : VimChangeGroupBase() {
|
||||
return number
|
||||
}
|
||||
|
||||
public fun addInsertListener(listener: VimInsertListener) {
|
||||
fun addInsertListener(listener: VimInsertListener) {
|
||||
insertListeners.add(listener)
|
||||
}
|
||||
|
||||
public fun removeInsertListener(listener: VimInsertListener) {
|
||||
fun removeInsertListener(listener: VimInsertListener) {
|
||||
insertListeners.remove(listener)
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
public class FileGroup public constructor() : VimFileBase() {
|
||||
class FileGroup : VimFileBase() {
|
||||
override fun openFile(filename: String, context: ExecutionContext): Boolean {
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("openFile($filename)")
|
||||
@ -82,7 +82,7 @@ public class FileGroup public constructor() : VimFileBase() {
|
||||
}
|
||||
}
|
||||
|
||||
public fun findFile(filename: String, project: Project): VirtualFile? {
|
||||
fun findFile(filename: String, project: Project): VirtualFile? {
|
||||
var found: VirtualFile?
|
||||
// Vim supports both ~/ and ~\ (tested on Mac and Windows). On Windows, it supports forward- and back-slashes, but
|
||||
// it only supports forward slash on Unix (tested on Mac)
|
||||
@ -242,7 +242,7 @@ public class FileGroup public constructor() : VimFileBase() {
|
||||
/**
|
||||
* Returns the previous tab.
|
||||
*/
|
||||
public fun getPreviousTab(context: DataContext): VirtualFile? {
|
||||
fun getPreviousTab(context: DataContext): VirtualFile? {
|
||||
val project = PlatformDataKeys.PROJECT.getData(context) ?: return null
|
||||
val vf = getInstance(project).lastTab
|
||||
if (vf != null && vf.isValid) {
|
||||
@ -251,7 +251,7 @@ public class FileGroup public constructor() : VimFileBase() {
|
||||
return null
|
||||
}
|
||||
|
||||
public fun selectEditor(project: Project, file: VirtualFile): Editor? {
|
||||
fun selectEditor(project: Project, file: VirtualFile): Editor? {
|
||||
val fMgr = FileEditorManager.getInstance(project)
|
||||
val feditors = fMgr.openFile(file, true)
|
||||
if (feditors.size > 0) {
|
||||
@ -418,7 +418,7 @@ public class FileGroup public constructor() : VimFileBase() {
|
||||
return project.name + "-" + project.locationHash
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
private fun findByNameInProject(filename: String, project: Project): VirtualFile? {
|
||||
val projectScope = ProjectScope.getProjectScope(project)
|
||||
val names = FilenameIndex.getVirtualFilesByName(filename, projectScope)
|
||||
@ -435,7 +435,7 @@ public class FileGroup public constructor() : VimFileBase() {
|
||||
/**
|
||||
* Respond to editor tab selection and remember the last used tab
|
||||
*/
|
||||
public fun fileEditorManagerSelectionChangedCallback(event: FileEditorManagerEvent) {
|
||||
fun fileEditorManagerSelectionChangedCallback(event: FileEditorManagerEvent) {
|
||||
if (event.oldFile != null) {
|
||||
getInstance(event.manager.project).lastTab = event.oldFile
|
||||
}
|
||||
|
@ -19,22 +19,22 @@ import com.maddyhome.idea.vim.options.OptionAccessScope
|
||||
* options
|
||||
*/
|
||||
@Suppress("SpellCheckingInspection")
|
||||
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
|
||||
public var ide: String by optionProperty(IjOptions.ide)
|
||||
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
||||
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
|
||||
public val ideavimsupport: StringListOptionValue by optionProperty(IjOptions.ideavimsupport)
|
||||
public var ideawrite: String by optionProperty(IjOptions.ideawrite)
|
||||
public val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
|
||||
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
||||
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
||||
open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
|
||||
var ide: String by optionProperty(IjOptions.ide)
|
||||
var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
||||
var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
|
||||
val ideavimsupport: StringListOptionValue by optionProperty(IjOptions.ideavimsupport)
|
||||
var ideawrite: String by optionProperty(IjOptions.ideawrite)
|
||||
val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
|
||||
var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
||||
var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
||||
|
||||
// Temporary options to control work-in-progress behaviour
|
||||
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
|
||||
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
|
||||
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
|
||||
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
|
||||
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
|
||||
var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
|
||||
var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
|
||||
var oldundo: Boolean by optionProperty(IjOptions.oldundo)
|
||||
var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
|
||||
var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,20 +42,20 @@ public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesB
|
||||
*
|
||||
* As a convenience, this class also provides access to the IntelliJ specific global options, via inheritance.
|
||||
*/
|
||||
public class EffectiveIjOptions(scope: OptionAccessScope.EFFECTIVE): GlobalIjOptions(scope) {
|
||||
class EffectiveIjOptions(scope: OptionAccessScope.EFFECTIVE): GlobalIjOptions(scope) {
|
||||
// Vim options that are implemented purely by existing IntelliJ features and not used by vim-engine
|
||||
public var breakindent: Boolean by optionProperty(IjOptions.breakindent)
|
||||
public val colorcolumn: StringListOptionValue by optionProperty(IjOptions.colorcolumn)
|
||||
public var cursorline: Boolean by optionProperty(IjOptions.cursorline)
|
||||
public var fileformat: String by optionProperty(IjOptions.fileformat)
|
||||
public var list: Boolean by optionProperty(IjOptions.list)
|
||||
public var number: Boolean by optionProperty(IjOptions.number)
|
||||
public var relativenumber: Boolean by optionProperty(IjOptions.relativenumber)
|
||||
public var textwidth: Int by optionProperty(IjOptions.textwidth)
|
||||
public var wrap: Boolean by optionProperty(IjOptions.wrap)
|
||||
var breakindent: Boolean by optionProperty(IjOptions.breakindent)
|
||||
val colorcolumn: StringListOptionValue by optionProperty(IjOptions.colorcolumn)
|
||||
var cursorline: Boolean by optionProperty(IjOptions.cursorline)
|
||||
var fileformat: String by optionProperty(IjOptions.fileformat)
|
||||
var list: Boolean by optionProperty(IjOptions.list)
|
||||
var number: Boolean by optionProperty(IjOptions.number)
|
||||
var relativenumber: Boolean by optionProperty(IjOptions.relativenumber)
|
||||
var textwidth: Int by optionProperty(IjOptions.textwidth)
|
||||
var wrap: Boolean by optionProperty(IjOptions.wrap)
|
||||
|
||||
// IntelliJ specific options
|
||||
public var ideacopypreprocess: Boolean by optionProperty(IjOptions.ideacopypreprocess)
|
||||
public var ideajoin: Boolean by optionProperty(IjOptions.ideajoin)
|
||||
public var idearefactormode: String by optionProperty(IjOptions.idearefactormode)
|
||||
var ideacopypreprocess: Boolean by optionProperty(IjOptions.ideacopypreprocess)
|
||||
var ideajoin: Boolean by optionProperty(IjOptions.ideajoin)
|
||||
var idearefactormode: String by optionProperty(IjOptions.idearefactormode)
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
public object IjOptions {
|
||||
object IjOptions {
|
||||
|
||||
public fun initialise() {
|
||||
fun initialise() {
|
||||
// Calling this method allows for deterministic initialisation of IjOptions, specifically initialising the
|
||||
// properties and registering the IJ specific options. Once added, they can be safely accessed by name, e.g. by the
|
||||
// implementation of `:set` while executing ~/.ideavimrc
|
||||
@ -39,8 +39,8 @@ public object IjOptions {
|
||||
}
|
||||
|
||||
// Vim options that are implemented purely by existing IntelliJ features and not used by vim-engine
|
||||
public val breakindent: ToggleOption = addOption(ToggleOption("breakindent", LOCAL_TO_WINDOW, "bri", false))
|
||||
public val colorcolumn: StringListOption = addOption(object : StringListOption("colorcolumn", LOCAL_TO_WINDOW, "cc", "") {
|
||||
val breakindent: ToggleOption = addOption(ToggleOption("breakindent", LOCAL_TO_WINDOW, "bri", false))
|
||||
val colorcolumn: StringListOption = addOption(object : StringListOption("colorcolumn", LOCAL_TO_WINDOW, "cc", "") {
|
||||
override fun checkIfValueValid(value: VimDataType, token: String) {
|
||||
super.checkIfValueValid(value, token)
|
||||
if (value != VimString.EMPTY) {
|
||||
@ -55,19 +55,19 @@ public object IjOptions {
|
||||
}
|
||||
}
|
||||
})
|
||||
public val cursorline: ToggleOption = addOption(ToggleOption("cursorline", LOCAL_TO_WINDOW, "cul", false))
|
||||
public val list: ToggleOption = addOption(ToggleOption("list", LOCAL_TO_WINDOW, "list", false))
|
||||
public val number: ToggleOption = addOption(ToggleOption("number", LOCAL_TO_WINDOW, "nu", false))
|
||||
public val relativenumber: ToggleOption = addOption(ToggleOption("relativenumber", LOCAL_TO_WINDOW, "rnu", false))
|
||||
public val textwidth: NumberOption = addOption(UnsignedNumberOption("textwidth", LOCAL_TO_BUFFER, "tw", 0))
|
||||
public val wrap: ToggleOption = addOption(ToggleOption("wrap", LOCAL_TO_WINDOW, "wrap", true))
|
||||
val cursorline: ToggleOption = addOption(ToggleOption("cursorline", LOCAL_TO_WINDOW, "cul", false))
|
||||
val list: ToggleOption = addOption(ToggleOption("list", LOCAL_TO_WINDOW, "list", false))
|
||||
val number: ToggleOption = addOption(ToggleOption("number", LOCAL_TO_WINDOW, "nu", false))
|
||||
val relativenumber: ToggleOption = addOption(ToggleOption("relativenumber", LOCAL_TO_WINDOW, "rnu", false))
|
||||
val textwidth: NumberOption = addOption(UnsignedNumberOption("textwidth", LOCAL_TO_BUFFER, "tw", 0))
|
||||
val wrap: ToggleOption = addOption(ToggleOption("wrap", LOCAL_TO_WINDOW, "wrap", true))
|
||||
|
||||
// These options are not explicitly listed as local-noglobal in Vim's help, but are set when a new buffer is edited,
|
||||
// based on the value of 'fileformats' or 'fileencodings'. To prevent unexpected file conversion, we treat them as
|
||||
// local-noglobal. See `:help local-noglobal`, `:help 'fileformats'` and `:help 'fileencodings'`
|
||||
public val bomb: ToggleOption =
|
||||
val bomb: ToggleOption =
|
||||
addOption(ToggleOption("bomb", LOCAL_TO_BUFFER, "bomb", false, isLocalNoGlobal = true))
|
||||
public val fileencoding: StringOption = addOption(
|
||||
val fileencoding: StringOption = addOption(
|
||||
StringOption(
|
||||
"fileencoding",
|
||||
LOCAL_TO_BUFFER,
|
||||
@ -76,7 +76,7 @@ public object IjOptions {
|
||||
isLocalNoGlobal = true
|
||||
)
|
||||
)
|
||||
public val fileformat: StringOption = addOption(
|
||||
val fileformat: StringOption = addOption(
|
||||
StringOption(
|
||||
"fileformat",
|
||||
LOCAL_TO_BUFFER,
|
||||
@ -88,15 +88,15 @@ public object IjOptions {
|
||||
)
|
||||
|
||||
// IntelliJ specific functionality - custom options
|
||||
public val ide: StringOption = addOption(
|
||||
val ide: StringOption = addOption(
|
||||
StringOption("ide", GLOBAL, "ide", ApplicationNamesInfo.getInstance().fullProductNameWithEdition)
|
||||
)
|
||||
public val ideacopypreprocess: ToggleOption = addOption(
|
||||
val ideacopypreprocess: ToggleOption = addOption(
|
||||
ToggleOption("ideacopypreprocess", GLOBAL_OR_LOCAL_TO_BUFFER, "ideacopypreprocess", false)
|
||||
)
|
||||
public val ideajoin: ToggleOption = addOption(ToggleOption("ideajoin", GLOBAL_OR_LOCAL_TO_BUFFER, "ideajoin", false))
|
||||
public val ideamarks: ToggleOption = addOption(ToggleOption("ideamarks", GLOBAL, "ideamarks", true))
|
||||
public val idearefactormode: StringOption = addOption(
|
||||
val ideajoin: ToggleOption = addOption(ToggleOption("ideajoin", GLOBAL_OR_LOCAL_TO_BUFFER, "ideajoin", false))
|
||||
val ideamarks: ToggleOption = addOption(ToggleOption("ideamarks", GLOBAL, "ideamarks", true))
|
||||
val idearefactormode: StringOption = addOption(
|
||||
StringOption(
|
||||
"idearefactormode",
|
||||
GLOBAL_OR_LOCAL_TO_BUFFER,
|
||||
@ -105,7 +105,7 @@ public object IjOptions {
|
||||
IjOptionConstants.ideaRefactorModeValues
|
||||
)
|
||||
)
|
||||
public val ideastatusicon: StringOption = addOption(
|
||||
val ideastatusicon: StringOption = addOption(
|
||||
StringOption(
|
||||
"ideastatusicon",
|
||||
GLOBAL,
|
||||
@ -114,7 +114,7 @@ public object IjOptions {
|
||||
IjOptionConstants.ideaStatusIconValues
|
||||
)
|
||||
)
|
||||
public val ideavimsupport: StringListOption = addOption(
|
||||
val ideavimsupport: StringListOption = addOption(
|
||||
StringListOption(
|
||||
"ideavimsupport",
|
||||
GLOBAL,
|
||||
@ -123,25 +123,26 @@ public object IjOptions {
|
||||
IjOptionConstants.ideavimsupportValues
|
||||
)
|
||||
)
|
||||
@JvmField public val ideawrite: StringOption = addOption(
|
||||
@JvmField
|
||||
val ideawrite: StringOption = addOption(
|
||||
StringOption("ideawrite", GLOBAL, "ideawrite", "all", IjOptionConstants.ideaWriteValues)
|
||||
)
|
||||
public val lookupkeys: StringListOption = addOption(
|
||||
val lookupkeys: StringListOption = addOption(
|
||||
StringListOption(
|
||||
"lookupkeys",
|
||||
GLOBAL,
|
||||
"lookupkeys",
|
||||
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>")
|
||||
)
|
||||
public val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
||||
public val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||
val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
||||
val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||
|
||||
// Temporary feature flags during development, not really intended for external use
|
||||
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isHidden = true))
|
||||
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true, isHidden = true))
|
||||
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
|
||||
val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||
val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||
val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isHidden = true))
|
||||
val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true, isHidden = true))
|
||||
val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
|
||||
|
||||
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
|
||||
// derives from Option<VimInt>
|
||||
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.newapi.ij
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
|
||||
@Service
|
||||
public class IjVimPsiService: VimPsiService {
|
||||
class IjVimPsiService: VimPsiService {
|
||||
override fun getCommentAtPos(editor: VimEditor, pos: Int): Pair<TextRange, Pair<String, String>?>? {
|
||||
val psiFile = PsiHelper.getFile(editor.ij) ?: return null
|
||||
val psiElement = psiFile.findElementAt(pos) ?: return null
|
||||
|
@ -15,7 +15,7 @@ import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.VimRedrawService
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
|
||||
public class IjVimRedrawService : VimRedrawService {
|
||||
class IjVimRedrawService : VimRedrawService {
|
||||
override fun redraw() {
|
||||
// The only thing IntelliJ needs to redraw is the status line. Everything else is handled automatically.
|
||||
redrawStatusLine()
|
||||
@ -25,11 +25,11 @@ public class IjVimRedrawService : VimRedrawService {
|
||||
injector.messages.clearStatusBarMessage()
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
/**
|
||||
* Simulate Vim's redraw when the current editor changes
|
||||
*/
|
||||
public fun fileEditorManagerSelectionChangedCallback(event: FileEditorManagerEvent) {
|
||||
fun fileEditorManagerSelectionChangedCallback(event: FileEditorManagerEvent) {
|
||||
injector.redrawService.redraw()
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ public class IjVimRedrawService : VimRedrawService {
|
||||
*
|
||||
* Only redraw if lines are added/removed.
|
||||
*/
|
||||
public object RedrawListener : DocumentListener {
|
||||
object RedrawListener : DocumentListener {
|
||||
override fun documentChanged(event: DocumentEvent) {
|
||||
if (VimPlugin.isNotEnabled()) return
|
||||
if (event.newFragment.contains("\n") || event.oldFragment.contains("\n")) {
|
||||
|
@ -1313,28 +1313,28 @@ private class WrapOptionMapper(wrapOption: ToggleOption, internalOptionValueAcce
|
||||
}
|
||||
|
||||
|
||||
public class IjOptionConstants {
|
||||
class IjOptionConstants {
|
||||
@Suppress("SpellCheckingInspection", "MemberVisibilityCanBePrivate", "ConstPropertyName")
|
||||
public companion object {
|
||||
companion object {
|
||||
|
||||
public const val idearefactormode_keep: String = "keep"
|
||||
public const val idearefactormode_select: String = "select"
|
||||
public const val idearefactormode_visual: String = "visual"
|
||||
const val idearefactormode_keep: String = "keep"
|
||||
const val idearefactormode_select: String = "select"
|
||||
const val idearefactormode_visual: String = "visual"
|
||||
|
||||
public const val ideastatusicon_enabled: String = "enabled"
|
||||
public const val ideastatusicon_gray: String = "gray"
|
||||
public const val ideastatusicon_disabled: String = "disabled"
|
||||
const val ideastatusicon_enabled: String = "enabled"
|
||||
const val ideastatusicon_gray: String = "gray"
|
||||
const val ideastatusicon_disabled: String = "disabled"
|
||||
|
||||
public const val ideavimsupport_dialog: String = "dialog"
|
||||
public const val ideavimsupport_singleline: String = "singleline"
|
||||
public const val ideavimsupport_dialoglegacy: String = "dialoglegacy"
|
||||
const val ideavimsupport_dialog: String = "dialog"
|
||||
const val ideavimsupport_singleline: String = "singleline"
|
||||
const val ideavimsupport_dialoglegacy: String = "dialoglegacy"
|
||||
|
||||
public const val ideawrite_all: String = "all"
|
||||
public const val ideawrite_file: String = "file"
|
||||
const val ideawrite_all: String = "all"
|
||||
const val ideawrite_file: String = "file"
|
||||
|
||||
public val ideaStatusIconValues: Set<String> = setOf(ideastatusicon_enabled, ideastatusicon_gray, ideastatusicon_disabled)
|
||||
public val ideaRefactorModeValues: Set<String> = setOf(idearefactormode_keep, idearefactormode_select, idearefactormode_visual)
|
||||
public val ideaWriteValues: Set<String> = setOf(ideawrite_all, ideawrite_file)
|
||||
public val ideavimsupportValues: Set<String> = setOf(ideavimsupport_dialog, ideavimsupport_singleline, ideavimsupport_dialoglegacy)
|
||||
val ideaStatusIconValues: Set<String> = setOf(ideastatusicon_enabled, ideastatusicon_gray, ideastatusicon_disabled)
|
||||
val ideaRefactorModeValues: Set<String> = setOf(idearefactormode_keep, idearefactormode_select, idearefactormode_visual)
|
||||
val ideaWriteValues: Set<String> = setOf(ideawrite_all, ideawrite_file)
|
||||
val ideavimsupportValues: Set<String> = setOf(ideavimsupport_dialog, ideavimsupport_singleline, ideavimsupport_dialoglegacy)
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ import java.io.Reader
|
||||
import java.io.Writer
|
||||
|
||||
|
||||
public class ProcessGroup : VimProcessGroupBase() {
|
||||
class ProcessGroup : VimProcessGroupBase() {
|
||||
@Throws(ExecutionException::class, ProcessCanceledException::class)
|
||||
public override fun executeCommand(
|
||||
override fun executeCommand(
|
||||
editor: VimEditor,
|
||||
command: String,
|
||||
input: CharSequence?,
|
||||
@ -132,7 +132,7 @@ public class ProcessGroup : VimProcessGroupBase() {
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
private val logger = logger<ProcessGroup>()
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ import javax.swing.Timer
|
||||
* no adjustment gets performed and IdeaVim stays in insert mode.
|
||||
*/
|
||||
// Do not remove until it's used in EasyMotion plugin in tests
|
||||
public object VimVisualTimer {
|
||||
object VimVisualTimer {
|
||||
|
||||
public var swingTimer: Timer? = null
|
||||
public var mode: Mode? = null
|
||||
var swingTimer: Timer? = null
|
||||
var mode: Mode? = null
|
||||
|
||||
public inline fun singleTask(currentMode: Mode, crossinline task: (initialMode: Mode?) -> Unit) {
|
||||
inline fun singleTask(currentMode: Mode, crossinline task: (initialMode: Mode?) -> Unit) {
|
||||
swingTimer?.stop()
|
||||
|
||||
if (mode == null) mode = currentMode
|
||||
@ -70,7 +70,7 @@ public object VimVisualTimer {
|
||||
swingTimer = timer
|
||||
}
|
||||
|
||||
public fun doNow() {
|
||||
fun doNow() {
|
||||
val swingTimer1 = swingTimer
|
||||
if (swingTimer1 != null) {
|
||||
swingTimer1.stop()
|
||||
@ -80,12 +80,12 @@ public object VimVisualTimer {
|
||||
}
|
||||
}
|
||||
|
||||
public fun drop() {
|
||||
fun drop() {
|
||||
swingTimer?.stop()
|
||||
swingTimer = null
|
||||
}
|
||||
|
||||
public inline fun timerAction(task: (initialMode: Mode?) -> Unit) {
|
||||
inline fun timerAction(task: (initialMode: Mode?) -> Unit) {
|
||||
task(mode)
|
||||
swingTimer = null
|
||||
mode = null
|
||||
|
@ -144,7 +144,7 @@ private object AttributesCache {
|
||||
@TestOnly
|
||||
internal fun getGuiCursorMode(editor: Editor) = editor.guicursorMode()
|
||||
|
||||
public class CaretVisualAttributesListener : IsReplaceCharListener, ModeChangeListener {
|
||||
class CaretVisualAttributesListener : IsReplaceCharListener, ModeChangeListener {
|
||||
override fun isReplaceCharChanged(editor: VimEditor) {
|
||||
updateCaretsVisual(editor)
|
||||
}
|
||||
@ -163,7 +163,7 @@ public class CaretVisualAttributesListener : IsReplaceCharListener, ModeChangeLi
|
||||
}
|
||||
}
|
||||
|
||||
public fun updateAllEditorsCaretsVisual() {
|
||||
fun updateAllEditorsCaretsVisual() {
|
||||
injector.editorGroup.getEditors().forEach { editor ->
|
||||
val ijEditor = (editor as IjVimEditor).editor
|
||||
ijEditor.updateCaretsVisualAttributes()
|
||||
|
@ -21,15 +21,15 @@ internal val Mode.hasVisualSelection
|
||||
else -> false
|
||||
}
|
||||
|
||||
public val Mode.inNormalMode: Boolean
|
||||
val Mode.inNormalMode: Boolean
|
||||
get() = this is Mode.NORMAL
|
||||
|
||||
@get:JvmName("inInsertMode")
|
||||
public val Editor.inInsertMode: Boolean
|
||||
val Editor.inInsertMode: Boolean
|
||||
get() = this.vim.mode == Mode.INSERT || this.vim.mode == Mode.REPLACE
|
||||
|
||||
@get:JvmName("inVisualMode")
|
||||
public val Editor.inVisualMode: Boolean
|
||||
val Editor.inVisualMode: Boolean
|
||||
get() = this.vim.inVisualMode
|
||||
|
||||
@get:JvmName("inExMode")
|
||||
|
@ -25,7 +25,7 @@ import javax.swing.JComponent
|
||||
import javax.swing.JTable
|
||||
|
||||
@Deprecated("Use fileSize from VimEditor")
|
||||
public val Editor.fileSize: Int
|
||||
val Editor.fileSize: Int
|
||||
get() = document.textLength
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ private fun containsUpperCase(pattern: String): Boolean {
|
||||
/**
|
||||
* This counts all the words in the file.
|
||||
*/
|
||||
public fun countWords(
|
||||
fun countWords(
|
||||
vimEditor: VimEditor,
|
||||
start: Int = 0,
|
||||
end: Long = vimEditor.fileSize(),
|
||||
@ -97,7 +97,7 @@ public fun countWords(
|
||||
return CountPosition(count, position)
|
||||
}
|
||||
|
||||
public fun findNumbersInRange(
|
||||
fun findNumbersInRange(
|
||||
editor: Editor,
|
||||
textRange: TextRange,
|
||||
alpha: Boolean,
|
||||
@ -133,7 +133,7 @@ public fun findNumbersInRange(
|
||||
return result
|
||||
}
|
||||
|
||||
public fun findNumberUnderCursor(
|
||||
fun findNumberUnderCursor(
|
||||
editor: Editor,
|
||||
caret: Caret,
|
||||
alpha: Boolean,
|
||||
@ -163,7 +163,7 @@ public fun findNumberUnderCursor(
|
||||
* @param startPosOnLine - start offset to search
|
||||
* @return - text range with number
|
||||
*/
|
||||
public fun findNumberInText(
|
||||
fun findNumberInText(
|
||||
textInRange: String,
|
||||
startPosOnLine: Int,
|
||||
alpha: Boolean,
|
||||
@ -308,7 +308,7 @@ private fun isNumberChar(ch: Char, alpha: Boolean, hex: Boolean, octal: Boolean,
|
||||
* @param caret The caret to find word under
|
||||
* @return The text range of the found word or null if there is no word under/after the cursor on the line
|
||||
*/
|
||||
public fun findWordUnderCursor(editor: Editor, caret: Caret): TextRange? {
|
||||
fun findWordUnderCursor(editor: Editor, caret: Caret): TextRange? {
|
||||
val vimEditor = IjVimEditor(editor)
|
||||
val chars = editor.document.charsSequence
|
||||
val stop = vimEditor.getLineEndOffset(caret.logicalPosition.line, true)
|
||||
@ -359,7 +359,7 @@ public fun findWordUnderCursor(editor: Editor, caret: Caret): TextRange? {
|
||||
return TextRange(start, end)
|
||||
}
|
||||
|
||||
public fun findMisspelledWords(
|
||||
fun findMisspelledWords(
|
||||
editor: Editor,
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
@ -401,7 +401,7 @@ private fun skip(iterator: IntIterator, n: Int) {
|
||||
while (i-- != 0 && iterator.hasNext()) iterator.nextInt()
|
||||
}
|
||||
|
||||
public class CountPosition(public val count: Int, public val position: Int)
|
||||
class CountPosition(val count: Int, val position: Int)
|
||||
|
||||
private val logger = logger<SearchLogger>()
|
||||
private class SearchLogger
|
@ -13,11 +13,11 @@ import java.util.*
|
||||
import java.util.stream.Collectors
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public object StringHelper {
|
||||
object StringHelper {
|
||||
@JvmStatic
|
||||
@Deprecated("Use injector.parser.parseKeys(string)")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public fun parseKeys(vararg string: String): List<KeyStroke> {
|
||||
fun parseKeys(vararg string: String): List<KeyStroke> {
|
||||
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
|
||||
.collect(Collectors.toList())
|
||||
}
|
||||
|
@ -12,14 +12,14 @@ import com.intellij.openapi.editor.Editor
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
// Do not remove until it's used in EasyMotion plugin in tests
|
||||
public class TestInputModel private constructor() {
|
||||
class TestInputModel private constructor() {
|
||||
private val myKeyStrokes: MutableList<KeyStroke> = Lists.newArrayList()
|
||||
public fun setKeyStrokes(keyStrokes: List<KeyStroke>) {
|
||||
fun setKeyStrokes(keyStrokes: List<KeyStroke>) {
|
||||
myKeyStrokes.clear()
|
||||
myKeyStrokes.addAll(keyStrokes)
|
||||
}
|
||||
|
||||
public fun nextKeyStroke(): KeyStroke? {
|
||||
fun nextKeyStroke(): KeyStroke? {
|
||||
// Return key from the unfinished mapping
|
||||
/*
|
||||
MappingStack mappingStack = KeyHandler.getInstance().getMappingStack();
|
||||
@ -34,9 +34,9 @@ if (mappingStack.hasStroke()) {
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
public fun getInstance(editor: Editor): TestInputModel {
|
||||
fun getInstance(editor: Editor): TestInputModel {
|
||||
var model = editor.vimTestInputModel
|
||||
if (model == null) {
|
||||
model = TestInputModel()
|
||||
|
@ -45,7 +45,7 @@ import kotlin.reflect.KProperty
|
||||
/**
|
||||
* Caret's offset when entering visual mode
|
||||
*/
|
||||
public var Caret.vimSelectionStart: Int
|
||||
var Caret.vimSelectionStart: Int
|
||||
get() {
|
||||
val selectionStart = _vimSelectionStart
|
||||
if (selectionStart == null) {
|
||||
|
@ -10,6 +10,6 @@ package com.maddyhome.idea.vim.listener
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
|
||||
public interface VimInsertListener {
|
||||
public fun insertModeStarted(editor: Editor)
|
||||
interface VimInsertListener {
|
||||
fun insertModeStarted(editor: Editor)
|
||||
}
|
||||
|
@ -24,8 +24,8 @@ internal val runFromVimKey = Key.create<Boolean>("RunFromVim")
|
||||
internal val DataContext.actionStartedFromVim: Boolean
|
||||
get() = (this as? UserDataHolder)?.getUserData(runFromVimKey) ?: false
|
||||
|
||||
public val DataContext.vim: ExecutionContext
|
||||
val DataContext.vim: ExecutionContext
|
||||
get() = IjEditorExecutionContext(this)
|
||||
|
||||
public val ExecutionContext.ij: DataContext
|
||||
val ExecutionContext.ij: DataContext
|
||||
get() = (this as IjEditorExecutionContext).context
|
||||
|
@ -16,8 +16,8 @@ internal class IjLiveRange(val marker: RangeMarker) : LiveRange {
|
||||
get() = marker.startOffset
|
||||
}
|
||||
|
||||
public val RangeMarker.vim: LiveRange
|
||||
val RangeMarker.vim: LiveRange
|
||||
get() = IjLiveRange(this)
|
||||
|
||||
public val LiveRange.ij: RangeMarker
|
||||
val LiveRange.ij: RangeMarker
|
||||
get() = (this as IjLiveRange).marker
|
||||
|
@ -31,10 +31,10 @@ internal class IjNativeActionManager : NativeActionManager {
|
||||
}
|
||||
}
|
||||
|
||||
public val AnAction.vim: IjNativeAction
|
||||
val AnAction.vim: IjNativeAction
|
||||
get() = IjNativeAction(this)
|
||||
|
||||
public class IjNativeAction(override val action: AnAction) : NativeAction {
|
||||
class IjNativeAction(override val action: AnAction) : NativeAction {
|
||||
override fun toString(): String {
|
||||
return "IjNativeAction(action=$action)"
|
||||
}
|
||||
|
@ -206,10 +206,10 @@ internal class IjVimCaret(val caret: Caret) : VimCaretBase() {
|
||||
override fun hashCode(): Int = this.caret.hashCode()
|
||||
}
|
||||
|
||||
public val VimCaret.ij: Caret
|
||||
val VimCaret.ij: Caret
|
||||
get() = (this as IjVimCaret).caret
|
||||
public val ImmutableVimCaret.ij: Caret
|
||||
val ImmutableVimCaret.ij: Caret
|
||||
get() = (this as IjVimCaret).caret
|
||||
|
||||
public val Caret.vim: VimCaret
|
||||
val Caret.vim: VimCaret
|
||||
get() = IjVimCaret(this)
|
||||
|
@ -499,12 +499,12 @@ internal class IjVimEditor(editor: Editor) : MutableLinearEditor() {
|
||||
}
|
||||
}
|
||||
|
||||
public val Editor.vim: VimEditor
|
||||
val Editor.vim: VimEditor
|
||||
get() = IjVimEditor(this)
|
||||
public val VimEditor.ij: Editor
|
||||
val VimEditor.ij: Editor
|
||||
get() = (this as IjVimEditor).editor
|
||||
|
||||
public val com.intellij.openapi.util.TextRange.vim: TextRange
|
||||
val com.intellij.openapi.util.TextRange.vim: TextRange
|
||||
get() = TextRange(this.startOffset, this.endOffset)
|
||||
|
||||
internal class InsertTimeRecorder: ModeChangeListener {
|
||||
|
@ -232,10 +232,10 @@ internal class IjVimInjector : VimInjectorBase() {
|
||||
/**
|
||||
* Convenience function to get the IntelliJ implementation specific global option accessor
|
||||
*/
|
||||
public fun VimInjector.globalIjOptions(): GlobalIjOptions = (this.optionGroup as IjVimOptionGroup).getGlobalIjOptions()
|
||||
fun VimInjector.globalIjOptions(): GlobalIjOptions = (this.optionGroup as IjVimOptionGroup).getGlobalIjOptions()
|
||||
|
||||
/**
|
||||
* Convenience function to get the IntelliJ implementation specific option accessor for the given editor's scope
|
||||
*/
|
||||
public fun VimInjector.ijOptions(editor: VimEditor): EffectiveIjOptions =
|
||||
fun VimInjector.ijOptions(editor: VimEditor): EffectiveIjOptions =
|
||||
(this.optionGroup as IjVimOptionGroup).getEffectiveIjOptions(editor)
|
||||
|
@ -50,8 +50,8 @@ import javax.swing.KeyStroke
|
||||
name = "VimSearchSettings",
|
||||
storages = [Storage(value = "\$APP_CONFIG$/vim_settings_local.xml", roamingType = RoamingType.DISABLED)]
|
||||
)
|
||||
public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateComponent<Element> {
|
||||
public companion object {
|
||||
open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateComponent<Element> {
|
||||
companion object {
|
||||
private val logger = vimLogger<IjVimSearchGroup>()
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateCompon
|
||||
updateSearchHighlights(false)
|
||||
}
|
||||
|
||||
public fun saveData(element: Element) {
|
||||
fun saveData(element: Element) {
|
||||
logger.debug("saveData")
|
||||
val search = Element("search")
|
||||
|
||||
@ -220,7 +220,7 @@ public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateCompon
|
||||
}
|
||||
}
|
||||
|
||||
public fun readData(element: Element) {
|
||||
fun readData(element: Element) {
|
||||
logger.debug("readData")
|
||||
val search = element.getChild("search") ?: return
|
||||
|
||||
@ -266,28 +266,28 @@ public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateCompon
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
public override fun getState(): Element? {
|
||||
override fun getState(): Element? {
|
||||
val element = Element("search")
|
||||
saveData(element)
|
||||
return element
|
||||
}
|
||||
|
||||
public override fun loadState(state: Element) {
|
||||
override fun loadState(state: Element) {
|
||||
readData(state)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates search highlights when the selected editor changes
|
||||
*/
|
||||
public fun fileEditorManagerSelectionChangedCallback(@Suppress("unused") event: FileEditorManagerEvent) {
|
||||
fun fileEditorManagerSelectionChangedCallback(@Suppress("unused") event: FileEditorManagerEvent) {
|
||||
updateSearchHighlights(false)
|
||||
}
|
||||
|
||||
public fun turnOn() {
|
||||
fun turnOn() {
|
||||
updateSearchHighlights(false)
|
||||
}
|
||||
|
||||
public fun turnOff() {
|
||||
fun turnOff() {
|
||||
val show = showSearchHighlight
|
||||
clearSearchHighlight()
|
||||
showSearchHighlight = show
|
||||
@ -305,8 +305,8 @@ public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateCompon
|
||||
/**
|
||||
* Removes and adds highlights for current search pattern when the document is edited
|
||||
*/
|
||||
public class DocumentSearchListener @Contract(pure = true) private constructor() : DocumentListener {
|
||||
public override fun documentChanged(event: DocumentEvent) {
|
||||
class DocumentSearchListener @Contract(pure = true) private constructor() : DocumentListener {
|
||||
override fun documentChanged(event: DocumentEvent) {
|
||||
// Loop over all local editors for the changed document, across all projects, and update search highlights.
|
||||
// Note that the change may have come from a remote guest in Code With Me scenarios (in which case
|
||||
// ClientId.current will be a guest ID), but we don't care - we still need to add/remove highlights for the
|
||||
@ -352,8 +352,8 @@ public open class IjVimSearchGroup : VimSearchGroupBase(), PersistentStateCompon
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
public var INSTANCE: DocumentSearchListener = DocumentSearchListener()
|
||||
companion object {
|
||||
var INSTANCE: DocumentSearchListener = DocumentSearchListener()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import com.intellij.openapi.wm.WindowManager
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.ui.widgets.mode.ModeWidgetFactory
|
||||
|
||||
public class WidgetState : ApplicationUsagesCollector() {
|
||||
class WidgetState : ApplicationUsagesCollector() {
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
|
||||
override fun getMetrics(): Set<MetricEvent> {
|
||||
@ -54,7 +54,7 @@ public class WidgetState : ApplicationUsagesCollector() {
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.widget", 1, "FUS")
|
||||
|
||||
private val IS_MODE_WIDGET_SHOWN = EventFields.Boolean("is-mode-widget-shown")
|
||||
|
@ -24,11 +24,11 @@ import javax.swing.KeyStroke
|
||||
/**
|
||||
* @author dhleong
|
||||
*/
|
||||
public object ModalEntry {
|
||||
object ModalEntry {
|
||||
|
||||
public val LOG: Logger = logger<ModalEntry>()
|
||||
val LOG: Logger = logger<ModalEntry>()
|
||||
|
||||
public inline fun activate(editor: VimEditor, crossinline processor: (KeyStroke) -> Boolean) {
|
||||
inline fun activate(editor: VimEditor, crossinline processor: (KeyStroke) -> Boolean) {
|
||||
// Firstly we pull the unfinished keys of the current mapping
|
||||
val mappingStack = KeyHandler.getInstance().keyStack
|
||||
LOG.trace("Dumping key stack:")
|
||||
|
@ -23,8 +23,8 @@ import com.maddyhome.idea.vim.ui.ModalEntry
|
||||
import java.awt.event.KeyEvent
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public class ExEntryPanelService : VimCommandLineService {
|
||||
public override fun getActiveCommandLine(): VimCommandLine? {
|
||||
class ExEntryPanelService : VimCommandLineService {
|
||||
override fun getActiveCommandLine(): VimCommandLine? {
|
||||
val instance = ExEntryPanel.instance ?: ExEntryPanel.instanceWithoutShortcuts ?: return null
|
||||
return if (instance.isActive) instance else null
|
||||
}
|
||||
@ -89,13 +89,13 @@ public class ExEntryPanelService : VimCommandLineService {
|
||||
}
|
||||
}
|
||||
|
||||
public override fun create(editor: VimEditor, context: ExecutionContext, label: String, initText: String): VimCommandLine {
|
||||
override fun create(editor: VimEditor, context: ExecutionContext, label: String, initText: String): VimCommandLine {
|
||||
val panel = ExEntryPanel.getInstance()
|
||||
panel.activate(editor.ij, context.ij, label, initText)
|
||||
return panel
|
||||
}
|
||||
|
||||
public override fun createWithoutShortcuts(editor: VimEditor, context: ExecutionContext, label: String, initText: String): VimCommandLine {
|
||||
override fun createWithoutShortcuts(editor: VimEditor, context: ExecutionContext, label: String, initText: String): VimCommandLine {
|
||||
val panel = ExEntryPanel.getInstanceWithoutShortcuts()
|
||||
panel.activate(editor.ij, context.ij, label, initText)
|
||||
return panel
|
||||
|
@ -11,7 +11,7 @@ package com.maddyhome.idea.vim.ui.widgets
|
||||
import com.maddyhome.idea.vim.common.VimPluginListener
|
||||
import com.maddyhome.idea.vim.options.GlobalOptionChangeListener
|
||||
|
||||
public open class VimWidgetListener(private val updateWidget: Runnable) : GlobalOptionChangeListener, VimPluginListener {
|
||||
open class VimWidgetListener(private val updateWidget: Runnable) : GlobalOptionChangeListener, VimPluginListener {
|
||||
override fun onGlobalOptionChanged() {
|
||||
updateWidget.run()
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ internal class MacroWidgetFactory : StatusBarWidgetFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public class VimMacroWidget : StatusBarWidget, VimStatusBarWidget {
|
||||
public var content: String = ""
|
||||
class VimMacroWidget : StatusBarWidget, VimStatusBarWidget {
|
||||
var content: String = ""
|
||||
|
||||
override fun ID(): String {
|
||||
return ID
|
||||
@ -69,7 +69,7 @@ public class VimMacroWidget : StatusBarWidget, VimStatusBarWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public fun updateMacroWidget() {
|
||||
fun updateMacroWidget() {
|
||||
val factory = StatusBarWidgetFactory.EP_NAME.findExtension(MacroWidgetFactory::class.java) ?: return
|
||||
for (project in ProjectManager.getInstance().openProjects) {
|
||||
val statusBarWidgetsManager = project.service<StatusBarWidgetsManager>()
|
||||
@ -79,7 +79,7 @@ public fun updateMacroWidget() {
|
||||
|
||||
// TODO: At the moment recording macro & RegisterGroup is bound to application, so macro will be recorded even if we
|
||||
// move between projects. BUT it's not a good idea. Maybe RegisterGroup should have it's own project scope instances
|
||||
public class MacroWidgetListener : MacroRecordingListener, VimWidgetListener({ updateMacroWidget() }) {
|
||||
class MacroWidgetListener : MacroRecordingListener, VimWidgetListener({ updateMacroWidget() }) {
|
||||
override fun recordingStarted() {
|
||||
for (project in ProjectManager.getInstance().openProjects) {
|
||||
val macroWidget = getWidget(project) ?: continue
|
||||
@ -103,4 +103,4 @@ public class MacroWidgetListener : MacroRecordingListener, VimWidgetListener({ u
|
||||
}
|
||||
}
|
||||
|
||||
public val macroWidgetOptionListener: VimWidgetListener = VimWidgetListener { updateMacroWidget() }
|
||||
val macroWidgetOptionListener: VimWidgetListener = VimWidgetListener { updateMacroWidget() }
|
||||
|
@ -17,9 +17,9 @@ import com.maddyhome.idea.vim.api.globalOptions
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.ui.widgets.VimWidgetListener
|
||||
|
||||
public class ModeWidgetFactory : StatusBarWidgetFactory {
|
||||
public companion object {
|
||||
public const val ID: String = "IdeaVimMode"
|
||||
class ModeWidgetFactory : StatusBarWidgetFactory {
|
||||
companion object {
|
||||
const val ID: String = "IdeaVimMode"
|
||||
}
|
||||
|
||||
override fun getId(): String {
|
||||
@ -42,4 +42,4 @@ public class ModeWidgetFactory : StatusBarWidgetFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public val modeWidgetOptionListener: VimWidgetListener = VimWidgetListener { updateModeWidget() }
|
||||
val modeWidgetOptionListener: VimWidgetListener = VimWidgetListener { updateModeWidget() }
|
||||
|
@ -44,18 +44,18 @@ import javax.swing.JPanel
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
public class ModeWidgetPopup : AnAction() {
|
||||
public override fun actionPerformed(e: AnActionEvent) {
|
||||
class ModeWidgetPopup : AnAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return
|
||||
val popup = createPopup() ?: return
|
||||
popup.showCenteredInCurrentWindow(project)
|
||||
}
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
@Volatile
|
||||
private var currentPopup: JBPopup? = null
|
||||
|
||||
public fun createPopup(): JBPopup? {
|
||||
fun createPopup(): JBPopup? {
|
||||
synchronized(this) {
|
||||
if (currentPopup?.isDisposed == false) return null
|
||||
val mainPanel = JPanel(BorderLayout())
|
||||
@ -350,7 +350,7 @@ public class ModeWidgetPopup : AnAction() {
|
||||
}
|
||||
}
|
||||
|
||||
public enum class ModeWidgetTheme(private var value: String) {
|
||||
enum class ModeWidgetTheme(private var value: String) {
|
||||
TERM("Term"),
|
||||
COLORLESS("Colorless");
|
||||
|
||||
@ -358,11 +358,11 @@ public enum class ModeWidgetTheme(private var value: String) {
|
||||
return value
|
||||
}
|
||||
|
||||
public companion object {
|
||||
public fun parseString(string: String): ModeWidgetTheme? {
|
||||
companion object {
|
||||
fun parseString(string: String): ModeWidgetTheme? {
|
||||
return entries.firstOrNull { it.value == string }
|
||||
}
|
||||
|
||||
public fun getDefaultTheme(): ModeWidgetTheme = TERM
|
||||
fun getDefaultTheme(): ModeWidgetTheme = TERM
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||
import java.awt.Color
|
||||
|
||||
public fun getModeBackground(mode: Mode?): Color {
|
||||
fun getModeBackground(mode: Mode?): Color {
|
||||
val isLight = !(LafManager.getInstance()?.currentUIThemeLookAndFeel?.isDark ?: false)
|
||||
val keyPostfix = if (isLight) "_light" else "_dark"
|
||||
if (injector.variableService.getVimVariable("widget_mode_is_full_customization$keyPostfix")?.asBoolean() != true) {
|
||||
@ -75,7 +75,7 @@ public fun getModeBackground(mode: Mode?): Color {
|
||||
}
|
||||
}
|
||||
|
||||
public fun getModeForeground(mode: Mode?): Color {
|
||||
fun getModeForeground(mode: Mode?): Color {
|
||||
val isLight = !(LafManager.getInstance()?.currentUIThemeLookAndFeel?.isDark ?: false)
|
||||
val keyPostfix = if (isLight) "_light" else "_dark"
|
||||
if (injector.variableService.getVimVariable("widget_mode_is_full_customization$keyPostfix")?.asBoolean() != true) {
|
||||
|
@ -30,7 +30,7 @@ import java.awt.event.MouseEvent
|
||||
import javax.swing.JComponent
|
||||
import kotlin.math.max
|
||||
|
||||
public class VimModeWidget(public val project: Project) : CustomStatusBarWidget, VimStatusBarWidget {
|
||||
class VimModeWidget(val project: Project) : CustomStatusBarWidget, VimStatusBarWidget {
|
||||
private companion object {
|
||||
private const val INSERT = "INSERT"
|
||||
private const val NORMAL = "NORMAL"
|
||||
@ -71,12 +71,12 @@ public class VimModeWidget(public val project: Project) : CustomStatusBarWidget,
|
||||
return label
|
||||
}
|
||||
|
||||
public fun updateWidget() {
|
||||
fun updateWidget() {
|
||||
val mode = getFocusedEditor(project)?.vim?.mode
|
||||
updateWidget(mode)
|
||||
}
|
||||
|
||||
public fun updateWidget(mode: Mode?) {
|
||||
fun updateWidget(mode: Mode?) {
|
||||
updateLabel(mode)
|
||||
updateWidgetInStatusBar(ModeWidgetFactory.ID, project)
|
||||
}
|
||||
@ -140,7 +140,7 @@ public class VimModeWidget(public val project: Project) : CustomStatusBarWidget,
|
||||
}
|
||||
}
|
||||
|
||||
public fun updateModeWidget() {
|
||||
fun updateModeWidget() {
|
||||
val factory = StatusBarWidgetFactory.EP_NAME.findExtension(ModeWidgetFactory::class.java) ?: return
|
||||
for (project in ProjectManager.getInstance().openProjects) {
|
||||
val statusBarWidgetsManager = project.service<StatusBarWidgetsManager>()
|
||||
@ -148,7 +148,7 @@ public fun updateModeWidget() {
|
||||
}
|
||||
}
|
||||
|
||||
public fun repaintModeWidget() {
|
||||
fun repaintModeWidget() {
|
||||
for (project in ProjectManager.getInstance().openProjects) {
|
||||
val widgets = WindowManager.getInstance()?.getStatusBar(project)?.allWidgets ?: continue
|
||||
|
||||
|
@ -12,8 +12,8 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.wm.WindowManager
|
||||
import java.util.*
|
||||
|
||||
public interface VimStatusBarWidget {
|
||||
public fun updateWidgetInStatusBar(widgetID: String, project: Project?) {
|
||||
interface VimStatusBarWidget {
|
||||
fun updateWidgetInStatusBar(widgetID: String, project: Project?) {
|
||||
if (project == null) return
|
||||
val windowManager = WindowManager.getInstance()
|
||||
windowManager.getStatusBar(project)?.updateWidget(widgetID) ?: run {
|
||||
|
@ -8,6 +8,6 @@
|
||||
|
||||
package com.maddyhome.idea.vim.vimscript.model.commands
|
||||
|
||||
public object IntellijExCommandProvider : ExCommandProvider {
|
||||
object IntellijExCommandProvider : ExCommandProvider {
|
||||
override val exCommandsFileName: String = "intellij_ex_commands.json"
|
||||
}
|
@ -8,6 +8,6 @@
|
||||
|
||||
package com.maddyhome.idea.vim.vimscript.model.functions
|
||||
|
||||
public object IntellijFunctionProvider : VimscriptFunctionProvider {
|
||||
object IntellijFunctionProvider : VimscriptFunctionProvider {
|
||||
override val functionListFileName: String = "intellij_vimscript_functions.json"
|
||||
}
|
@ -26,10 +26,10 @@ import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||
|
||||
public val VimEditor.isIdeaRefactorModeKeep: Boolean
|
||||
val VimEditor.isIdeaRefactorModeKeep: Boolean
|
||||
get() = injector.ijOptions(this).idearefactormode.contains(IjOptionConstants.idearefactormode_keep)
|
||||
|
||||
public val VimEditor.isIdeaRefactorModeSelect: Boolean
|
||||
val VimEditor.isIdeaRefactorModeSelect: Boolean
|
||||
get() = injector.ijOptions(this).idearefactormode.contains(IjOptionConstants.idearefactormode_select)
|
||||
|
||||
internal object IdeaRefactorModeHelper {
|
||||
|
@ -165,7 +165,7 @@ object NeovimTesting {
|
||||
assertEquals(neovimContent, editor.document.text)
|
||||
}
|
||||
|
||||
public fun vimMode() = neovimApi.mode.get().mode
|
||||
fun vimMode() = neovimApi.mode.get().mode
|
||||
|
||||
private fun assertMode(editor: Editor) {
|
||||
val ideavimState = editor.vim.vimStateMachine.mode.toVimNotation()
|
||||
@ -207,8 +207,8 @@ object NeovimTesting {
|
||||
}
|
||||
}
|
||||
|
||||
public fun getRegister(register: Char) = neovimApi.callFunction("getreg", listOf(register)).get().toString()
|
||||
public fun getMark(register: String) = neovimApi.callFunction("getpos", listOf(register)).get().toString()
|
||||
fun getRegister(register: Char) = neovimApi.callFunction("getreg", listOf(register)).get().toString()
|
||||
fun getMark(register: String) = neovimApi.callFunction("getpos", listOf(register)).get().toString()
|
||||
}
|
||||
|
||||
annotation class TestWithoutNeovim(val reason: SkipNeovimReason, val description: String = "")
|
||||
|
@ -320,7 +320,7 @@ abstract class VimTestCase {
|
||||
return fixture.editor
|
||||
}
|
||||
|
||||
public fun configureByTextX(fileName: String, content: String): Editor {
|
||||
fun configureByTextX(fileName: String, content: String): Editor {
|
||||
fixture.configureByText(fileName, content)
|
||||
setDefaultIntelliJSettings(fixture.editor)
|
||||
NeovimTesting.setupEditor(fixture.editor, testInfo)
|
||||
|
@ -102,7 +102,7 @@ annotation class OptionTest(vararg val value: VimOption)
|
||||
* - Without bounded list:
|
||||
* - Not supported, please specify possible values using [limitedValues]
|
||||
*/
|
||||
public annotation class VimOption(
|
||||
annotation class VimOption(
|
||||
val name: String,
|
||||
val limitedValues: Array<String> = [],
|
||||
val doesntAffectTest: Boolean = false,
|
||||
|
@ -98,10 +98,6 @@ tasks {
|
||||
// version.set("0.48.2")
|
||||
//}
|
||||
|
||||
kotlin {
|
||||
explicitApi()
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
|
@ -50,15 +50,15 @@ import javax.swing.KeyStroke
|
||||
// TODO for future refactorings (PRs are welcome)
|
||||
// 1. avoid using handleKeyRecursionCount & shouldRecord
|
||||
// 2. maybe we can live without allowKeyMappings: Boolean & mappingCompleted: Boolean
|
||||
public class KeyHandler {
|
||||
class KeyHandler {
|
||||
private val keyConsumers: List<KeyConsumer> = listOf(MappingProcessor, CommandCountConsumer(), DeleteCommandConsumer(), EditorResetConsumer(), CharArgumentConsumer(), RegisterConsumer(), DigraphConsumer(), CommandConsumer(), SelectRegisterConsumer(), ModeInputConsumer())
|
||||
private var handleKeyRecursionCount = 0
|
||||
|
||||
public var keyHandlerState: KeyHandlerState = KeyHandlerState()
|
||||
var keyHandlerState: KeyHandlerState = KeyHandlerState()
|
||||
private set
|
||||
|
||||
public val keyStack: KeyStack = KeyStack()
|
||||
public val modalEntryKeys: MutableList<KeyStroke> = ArrayList()
|
||||
val keyStack: KeyStack = KeyStack()
|
||||
val modalEntryKeys: MutableList<KeyStroke> = ArrayList()
|
||||
|
||||
/**
|
||||
* This is the main key handler for the Vim plugin. Every keystroke not handled directly by Idea is sent here for
|
||||
@ -68,7 +68,7 @@ public class KeyHandler {
|
||||
* @param key The keystroke typed by the user
|
||||
* @param context The data context
|
||||
*/
|
||||
public fun handleKey(editor: VimEditor, key: KeyStroke, context: ExecutionContext, keyState: KeyHandlerState) {
|
||||
fun handleKey(editor: VimEditor, key: KeyStroke, context: ExecutionContext, keyState: KeyHandlerState) {
|
||||
handleKey(editor, key, context, allowKeyMappings = true, mappingCompleted = false, keyState)
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public class KeyHandler {
|
||||
* @param allowKeyMappings - If we allow key mappings or not
|
||||
* @param mappingCompleted - if true, we don't check if the mapping is incomplete
|
||||
*/
|
||||
public fun handleKey(
|
||||
fun handleKey(
|
||||
editor: VimEditor,
|
||||
key: KeyStroke,
|
||||
context: ExecutionContext,
|
||||
@ -99,7 +99,7 @@ public class KeyHandler {
|
||||
* Alternatively, if we understand the key, we return a 'KeyProcessResult.Executable', which contains a runnable that
|
||||
* could execute the key if needed.
|
||||
*/
|
||||
public fun processKey(
|
||||
fun processKey(
|
||||
key: KeyStroke,
|
||||
editor: VimEditor,
|
||||
allowKeyMappings: Boolean,
|
||||
@ -191,16 +191,16 @@ public class KeyHandler {
|
||||
reset(keyState, editor.mode)
|
||||
}
|
||||
|
||||
public fun setBadCommand(editor: VimEditor, keyState: KeyHandlerState) {
|
||||
fun setBadCommand(editor: VimEditor, keyState: KeyHandlerState) {
|
||||
onUnknownKey(editor, keyState)
|
||||
injector.messages.indicateError()
|
||||
}
|
||||
|
||||
public fun isDuplicateOperatorKeyStroke(key: KeyStroke, mode: Mode, keyState: KeyHandlerState): Boolean {
|
||||
fun isDuplicateOperatorKeyStroke(key: KeyStroke, mode: Mode, keyState: KeyHandlerState): Boolean {
|
||||
return isOperatorPending(mode, keyState) && keyState.commandBuilder.isDuplicateOperatorKeyStroke(key)
|
||||
}
|
||||
|
||||
public fun isOperatorPending(mode: Mode, keyState: KeyHandlerState): Boolean {
|
||||
fun isOperatorPending(mode: Mode, keyState: KeyHandlerState): Boolean {
|
||||
return mode is Mode.OP_PENDING && !keyState.commandBuilder.isEmpty
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ public class KeyHandler {
|
||||
*
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
public fun partialReset(editor: VimEditor) {
|
||||
fun partialReset(editor: VimEditor) {
|
||||
logger.trace { "Partial reset is executed" }
|
||||
keyHandlerState.partialReset(editor.mode)
|
||||
}
|
||||
@ -265,13 +265,13 @@ public class KeyHandler {
|
||||
*
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
public fun reset(editor: VimEditor) {
|
||||
fun reset(editor: VimEditor) {
|
||||
logger.trace { "Reset is executed" }
|
||||
keyHandlerState.partialReset(editor.mode)
|
||||
keyHandlerState.commandBuilder.resetAll(getKeyRoot(editor.mode.toMappingMode()))
|
||||
}
|
||||
|
||||
public fun reset(keyState: KeyHandlerState, mode: Mode) {
|
||||
fun reset(keyState: KeyHandlerState, mode: Mode) {
|
||||
logger.trace { "Reset is executed" }
|
||||
keyHandlerState.partialReset(mode)
|
||||
keyState.commandBuilder.resetAll(getKeyRoot(mode.toMappingMode()))
|
||||
@ -281,7 +281,7 @@ public class KeyHandler {
|
||||
return injector.keyGroup.getKeyRoot(mappingMode)
|
||||
}
|
||||
|
||||
public fun updateState(keyState: KeyHandlerState) {
|
||||
fun updateState(keyState: KeyHandlerState) {
|
||||
logger.trace { "State updated" }
|
||||
logger.trace { keyState.toString() }
|
||||
this.keyHandlerState = keyState
|
||||
@ -293,7 +293,7 @@ public class KeyHandler {
|
||||
*
|
||||
* @param editor The editor to reset.
|
||||
*/
|
||||
public fun fullReset(editor: VimEditor) {
|
||||
fun fullReset(editor: VimEditor) {
|
||||
logger.trace { "Full reset" }
|
||||
injector.messages.clearError()
|
||||
|
||||
@ -306,7 +306,7 @@ public class KeyHandler {
|
||||
editor.removeSelection()
|
||||
}
|
||||
|
||||
public fun setPromptCharacterEx(promptCharacter: Char) {
|
||||
fun setPromptCharacterEx(promptCharacter: Char) {
|
||||
val commandLine = injector.commandLine.getActiveCommandLine() ?: return
|
||||
commandLine.setPromptCharacter(promptCharacter)
|
||||
}
|
||||
@ -362,8 +362,8 @@ public class KeyHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public companion object {
|
||||
public val lock: Any = Object()
|
||||
companion object {
|
||||
val lock: Any = Object()
|
||||
private val logger: VimLogger = vimLogger<KeyHandler>()
|
||||
|
||||
internal fun <T> isPrefix(list1: List<T>, list2: List<T>): Boolean {
|
||||
@ -381,10 +381,10 @@ public class KeyHandler {
|
||||
private val instance = KeyHandler()
|
||||
|
||||
@JvmStatic
|
||||
public fun getInstance(): KeyHandler = instance
|
||||
fun getInstance(): KeyHandler = instance
|
||||
}
|
||||
|
||||
public data class MutableBoolean(public var value: Boolean)
|
||||
data class MutableBoolean(var value: Boolean)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -392,11 +392,11 @@ public class KeyHandler {
|
||||
* Fleet needs to synchronously determine if the key will be handled by the plugin or should be passed elsewhere.
|
||||
* The key processing itself will be executed asynchronously at a later time.
|
||||
*/
|
||||
public sealed interface KeyProcessResult {
|
||||
sealed interface KeyProcessResult {
|
||||
/**
|
||||
* Key input that is not recognized by IdeaVim and should be passed to IDE.
|
||||
*/
|
||||
public object Unknown: KeyProcessResult
|
||||
object Unknown: KeyProcessResult
|
||||
|
||||
/**
|
||||
* Key input that is recognized by IdeaVim and can be executed.
|
||||
@ -406,17 +406,17 @@ public sealed interface KeyProcessResult {
|
||||
* This class should be returned after the first step is complete.
|
||||
* It will continue the key handling and finish the process.
|
||||
*/
|
||||
public class Executable(
|
||||
class Executable(
|
||||
private val originalState: KeyHandlerState,
|
||||
private val preProcessState: KeyHandlerState,
|
||||
private val processing: KeyProcessing,
|
||||
): KeyProcessResult {
|
||||
|
||||
public companion object {
|
||||
companion object {
|
||||
private val logger = vimLogger<KeyProcessResult>()
|
||||
}
|
||||
|
||||
public fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||
fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||
synchronized(KeyHandler.lock) {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
if (keyHandler.keyHandlerState != originalState) {
|
||||
@ -442,23 +442,23 @@ public sealed interface KeyProcessResult {
|
||||
* If there's need to alter the state following any of the execution steps, wrap the state modification as an
|
||||
* execution step. This will allow state modification to occur later rather than immediately.
|
||||
*/
|
||||
public abstract class KeyProcessResultBuilder {
|
||||
public abstract val state: KeyHandlerState
|
||||
abstract class KeyProcessResultBuilder {
|
||||
abstract val state: KeyHandlerState
|
||||
protected val processings: MutableList<KeyProcessing> = mutableListOf()
|
||||
public var onFinish: (() -> Unit)? = null // FIXME I'm a dirty hack to support recursion counter
|
||||
var onFinish: (() -> Unit)? = null // FIXME I'm a dirty hack to support recursion counter
|
||||
|
||||
public fun addExecutionStep(keyProcessing: KeyProcessing) {
|
||||
fun addExecutionStep(keyProcessing: KeyProcessing) {
|
||||
processings.add(keyProcessing)
|
||||
}
|
||||
|
||||
public abstract fun build(): KeyProcessResult
|
||||
abstract fun build(): KeyProcessResult
|
||||
}
|
||||
|
||||
// Works with existing state and modifies it during execution
|
||||
// It's the way IdeaVim worked for the long time and for this class we do not create
|
||||
// unnecessary objects and assume that the code will be executed immediately
|
||||
public class SynchronousKeyProcessBuilder(public override val state: KeyHandlerState): KeyProcessResultBuilder() {
|
||||
public override fun build(): KeyProcessResult {
|
||||
class SynchronousKeyProcessBuilder(override val state: KeyHandlerState): KeyProcessResultBuilder() {
|
||||
override fun build(): KeyProcessResult {
|
||||
return Executable(state, state) { keyHandlerState, vimEditor, executionContext ->
|
||||
try {
|
||||
for (processing in processings) {
|
||||
@ -473,11 +473,11 @@ public sealed interface KeyProcessResult {
|
||||
|
||||
// Works with a clone of current state, nothing is modified during the builder work (key processing)
|
||||
// The new state will be applied later, when we run Executable.execute() (it may not be run at all)
|
||||
public class AsyncKeyProcessBuilder(originalState: KeyHandlerState): KeyProcessResultBuilder() {
|
||||
class AsyncKeyProcessBuilder(originalState: KeyHandlerState): KeyProcessResultBuilder() {
|
||||
private val originalState: KeyHandlerState = KeyHandler.getInstance().keyHandlerState
|
||||
public override val state: KeyHandlerState = originalState.clone()
|
||||
override val state: KeyHandlerState = originalState.clone()
|
||||
|
||||
public override fun build(): KeyProcessResult {
|
||||
override fun build(): KeyProcessResult {
|
||||
return Executable(originalState, state) { keyHandlerState, vimEditor, executionContext ->
|
||||
try {
|
||||
for (processing in processings) {
|
||||
@ -492,7 +492,7 @@ public sealed interface KeyProcessResult {
|
||||
}
|
||||
}
|
||||
|
||||
public class KeyHandlerStateResetter : EditorListener {
|
||||
class KeyHandlerStateResetter : EditorListener {
|
||||
override fun focusGained(editor: VimEditor) {
|
||||
KeyHandler.getInstance().reset(editor)
|
||||
}
|
||||
@ -503,4 +503,4 @@ public class KeyHandlerStateResetter : EditorListener {
|
||||
}
|
||||
}
|
||||
|
||||
public typealias KeyProcessing = (KeyHandlerState, VimEditor, ExecutionContext) -> Unit
|
||||
typealias KeyProcessing = (KeyHandlerState, VimEditor, ExecutionContext) -> Unit
|
||||
|
@ -23,11 +23,11 @@ import java.io.InputStream
|
||||
* The primary functionality of this interface is to transform the JSON data into a collection of
|
||||
* {@code LazyVimCommand} instances.
|
||||
*/
|
||||
public interface CommandProvider {
|
||||
public val commandListFileName: String
|
||||
interface CommandProvider {
|
||||
val commandListFileName: String
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
public fun getCommands(): Collection<LazyVimCommand> {
|
||||
fun getCommands(): Collection<LazyVimCommand> {
|
||||
val classLoader = this.javaClass.classLoader
|
||||
val commands: List<CommandBean> = Json.decodeFromStream(getFile())
|
||||
return commands
|
||||
@ -46,4 +46,4 @@ public interface CommandProvider {
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public data class CommandBean(val keys: String, val `class`: String, val modes: String)
|
||||
data class CommandBean(val keys: String, val `class`: String, val modes: String)
|
||||
|
@ -8,6 +8,6 @@
|
||||
|
||||
package com.maddyhome.idea.vim.action
|
||||
|
||||
public object EngineCommandProvider : CommandProvider {
|
||||
object EngineCommandProvider : CommandProvider {
|
||||
override val commandListFileName: String = "engine_commands.json"
|
||||
}
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
import com.maddyhome.idea.vim.state.mode.mode
|
||||
|
||||
@CommandOrMotion(keys = ["<C-\\><C-N>"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.SELECT, Mode.OP_PENDING, Mode.INSERT, Mode.CMD_LINE])
|
||||
public class ResetModeAction : VimActionHandler.ConditionalMulticaret() {
|
||||
class ResetModeAction : VimActionHandler.ConditionalMulticaret() {
|
||||
private lateinit var modeBeforeReset: com.maddyhome.idea.vim.state.mode.Mode
|
||||
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
||||
override fun runAsMulticaret(
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["<C-G>u"], modes = [Mode.INSERT])
|
||||
public class BreakUndoSequenceAction : VimActionHandler.SingleExecution() {
|
||||
class BreakUndoSequenceAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
override fun execute(
|
||||
|
@ -11,8 +11,8 @@ package com.maddyhome.idea.vim.action.change
|
||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public object Extension {
|
||||
public var lastExtensionHandler: ExtensionHandler? = null
|
||||
object Extension {
|
||||
var lastExtensionHandler: ExtensionHandler? = null
|
||||
|
||||
private val keyStrokes = mutableListOf<KeyStroke>()
|
||||
private val strings = mutableListOf<String>()
|
||||
@ -20,10 +20,10 @@ public object Extension {
|
||||
private var keystrokePointer = 0
|
||||
private var stringPointer = 0
|
||||
|
||||
public fun addKeystroke(key: KeyStroke): Boolean = keyStrokes.add(key)
|
||||
public fun addString(key: String): Boolean = strings.add(key)
|
||||
fun addKeystroke(key: KeyStroke): Boolean = keyStrokes.add(key)
|
||||
fun addString(key: String): Boolean = strings.add(key)
|
||||
|
||||
public fun consumeKeystroke(): KeyStroke? {
|
||||
fun consumeKeystroke(): KeyStroke? {
|
||||
if (keystrokePointer in keyStrokes.indices) {
|
||||
keystrokePointer += 1
|
||||
return keyStrokes[keystrokePointer - 1]
|
||||
@ -31,7 +31,7 @@ public object Extension {
|
||||
return null
|
||||
}
|
||||
|
||||
public fun consumeString(): String? {
|
||||
fun consumeString(): String? {
|
||||
if (stringPointer in strings.indices) {
|
||||
stringPointer += 1
|
||||
return strings[stringPointer - 1]
|
||||
@ -39,12 +39,12 @@ public object Extension {
|
||||
return null
|
||||
}
|
||||
|
||||
public fun reset() {
|
||||
fun reset() {
|
||||
keystrokePointer = 0
|
||||
stringPointer = 0
|
||||
}
|
||||
|
||||
public fun clean() {
|
||||
fun clean() {
|
||||
keyStrokes.clear()
|
||||
strings.clear()
|
||||
keystrokePointer = 0
|
||||
|
@ -13,13 +13,13 @@ import com.maddyhome.idea.vim.handler.EditorActionHandlerBase
|
||||
import com.maddyhome.idea.vim.vimscript.model.LazyInstance
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public open class LazyVimCommand(
|
||||
public val keys: Set<List<KeyStroke>>,
|
||||
public val modes: Set<MappingMode>,
|
||||
open class LazyVimCommand(
|
||||
val keys: Set<List<KeyStroke>>,
|
||||
val modes: Set<MappingMode>,
|
||||
className: String,
|
||||
classLoader: ClassLoader,
|
||||
) : LazyInstance<EditorActionHandlerBase>(className, classLoader) {
|
||||
public val actionId: String = EditorActionHandlerBase.getActionId(className)
|
||||
val actionId: String = EditorActionHandlerBase.getActionId(className)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
@ -17,7 +17,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["<C-R>"], modes = [Mode.NORMAL])
|
||||
public class RedoAction : VimActionHandler.SingleExecution() {
|
||||
class RedoAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
override fun execute(
|
||||
|
@ -17,7 +17,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["u", "<Undo>"], modes = [Mode.NORMAL])
|
||||
public class UndoAction : VimActionHandler.SingleExecution() {
|
||||
class UndoAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
override fun execute(
|
||||
|
@ -11,14 +11,14 @@ package com.maddyhome.idea.vim.action.change
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.command.Command
|
||||
|
||||
public object VimRepeater {
|
||||
public var repeatHandler: Boolean = false
|
||||
object VimRepeater {
|
||||
var repeatHandler: Boolean = false
|
||||
|
||||
public var lastChangeCommand: Command? = null
|
||||
var lastChangeCommand: Command? = null
|
||||
private set
|
||||
public var lastChangeRegister: Char = injector.registerGroup.defaultRegister
|
||||
var lastChangeRegister: Char = injector.registerGroup.defaultRegister
|
||||
|
||||
public fun saveLastChange(command: Command) {
|
||||
fun saveLastChange(command: Command) {
|
||||
lastChangeCommand = command
|
||||
lastChangeRegister = injector.registerGroup.currentRegister
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["="], modes = [Mode.VISUAL])
|
||||
public class AutoIndentLinesVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class AutoIndentLinesVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
|
||||
@CommandOrMotion(keys = ["gu"], modes = [Mode.NORMAL])
|
||||
public class ChangeCaseLowerMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
class ChangeCaseLowerMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["u"], modes = [Mode.VISUAL])
|
||||
public class ChangeCaseLowerVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeCaseLowerVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun executeAction(
|
||||
|
@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["~"], modes = [Mode.NORMAL])
|
||||
public class ChangeCaseToggleCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
class ChangeCaseToggleCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun execute(
|
||||
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
|
||||
@CommandOrMotion(keys = ["g~"], modes = [Mode.NORMAL])
|
||||
public class ChangeCaseToggleMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
class ChangeCaseToggleMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["~"], modes = [Mode.VISUAL])
|
||||
public class ChangeCaseToggleVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeCaseToggleVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun executeAction(
|
||||
|
@ -21,7 +21,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
|
||||
@CommandOrMotion(keys = ["gU"], modes = [Mode.NORMAL])
|
||||
public class ChangeCaseUpperMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
class ChangeCaseUpperMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["U"], modes = [Mode.VISUAL])
|
||||
public class ChangeCaseUpperVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeCaseUpperVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun executeAction(
|
||||
|
@ -26,7 +26,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["r"], modes = [Mode.NORMAL])
|
||||
public class ChangeCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
class ChangeCharacterAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.DIGRAPH
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["s"], modes = [Mode.NORMAL])
|
||||
public class ChangeCharactersAction : ChangeInInsertSequenceAction() {
|
||||
class ChangeCharactersAction : ChangeInInsertSequenceAction() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_NO_REPEAT_INSERT)
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["C"], modes = [Mode.NORMAL])
|
||||
public class ChangeEndOfLineAction : ChangeInInsertSequenceAction() {
|
||||
class ChangeEndOfLineAction : ChangeInInsertSequenceAction() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_NO_REPEAT_INSERT)
|
||||
|
@ -16,7 +16,7 @@ import com.maddyhome.idea.vim.command.Argument
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
public abstract class ChangeInInsertSequenceAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
abstract class ChangeInInsertSequenceAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
final override fun execute(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
@ -31,7 +31,7 @@ public abstract class ChangeInInsertSequenceAction : ChangeEditorActionHandler.F
|
||||
return result
|
||||
}
|
||||
|
||||
public abstract fun executeInInsertSequence(
|
||||
abstract fun executeInInsertSequence(
|
||||
editor: VimEditor,
|
||||
caret: VimCaret,
|
||||
context: ExecutionContext,
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.vimscript.model.Script
|
||||
|
||||
@CommandOrMotion(keys = ["g&"], modes = [Mode.NORMAL])
|
||||
public class ChangeLastGlobalSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class ChangeLastGlobalSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
override fun execute(
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.vimscript.model.Script
|
||||
|
||||
@CommandOrMotion(keys = ["&"], modes = [Mode.NORMAL])
|
||||
public class ChangeLastSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class ChangeLastSearchReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
override fun execute(
|
||||
|
@ -23,7 +23,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["S"], modes = [Mode.NORMAL])
|
||||
public class ChangeLineAction : ChangeInInsertSequenceAction() {
|
||||
class ChangeLineAction : ChangeInInsertSequenceAction() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_NO_REPEAT_INSERT)
|
||||
|
@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.command.DuplicableOperatorAction
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
|
||||
@CommandOrMotion(keys = ["c"], modes = [Mode.NORMAL])
|
||||
public class ChangeMotionAction : ChangeInInsertSequenceAction(), DuplicableOperatorAction {
|
||||
class ChangeMotionAction : ChangeInInsertSequenceAction(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["R"], modes = [Mode.NORMAL])
|
||||
public class ChangeReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class ChangeReplaceAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun execute(
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["c", "s"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun executeAction(
|
||||
|
@ -29,7 +29,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["r"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualCharacterAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeVisualCharacterAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.DIGRAPH
|
||||
|
@ -30,7 +30,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["R", "S"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_MOT_LINEWISE)
|
||||
|
@ -30,7 +30,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["C"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualLinesEndAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ChangeVisualLinesEndAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(FLAG_MOT_LINEWISE)
|
||||
|
@ -24,7 +24,7 @@ import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["!"], modes = [Mode.VISUAL])
|
||||
public class FilterVisualLinesAction : VimActionHandler.SingleExecution(), FilterCommand {
|
||||
class FilterVisualLinesAction : VimActionHandler.SingleExecution(), FilterCommand {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
@ -43,7 +43,7 @@ public class FilterVisualLinesAction : VimActionHandler.SingleExecution(), Filte
|
||||
* the ex command line is started with the initial text `:[range]!`. The {filter} will be typed into the ex entry field.
|
||||
*/
|
||||
@CommandOrMotion(keys = ["!"], modes = [Mode.NORMAL])
|
||||
public class FilterMotionAction : VimActionHandler.SingleExecution(), FilterCommand, DuplicableOperatorAction {
|
||||
class FilterMotionAction : VimActionHandler.SingleExecution(), FilterCommand, DuplicableOperatorAction {
|
||||
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
@ -68,8 +68,8 @@ public class FilterMotionAction : VimActionHandler.SingleExecution(), FilterComm
|
||||
}
|
||||
}
|
||||
|
||||
public interface FilterCommand {
|
||||
public fun startFilterCommand(editor: VimEditor, context: ExecutionContext, cmd: Command) {
|
||||
interface FilterCommand {
|
||||
fun startFilterCommand(editor: VimEditor, context: ExecutionContext, cmd: Command) {
|
||||
injector.processGroup.startExEntry(editor, context, cmd, initialCommandText = "!")
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["gq"], modes = [Mode.NORMAL])
|
||||
public class ReformatCodeMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
class ReformatCodeMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -25,7 +25,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["gq"], modes = [Mode.VISUAL])
|
||||
public class ReformatCodeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class ReformatCodeVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
public sealed class IncAction(public val inc: Int) : ChangeEditorActionHandler.ForEachCaret() {
|
||||
sealed class IncAction(val inc: Int) : ChangeEditorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun execute(
|
||||
@ -33,7 +33,7 @@ public sealed class IncAction(public val inc: Int) : ChangeEditorActionHandler.F
|
||||
}
|
||||
|
||||
@CommandOrMotion(keys = ["<C-A>"], modes = [Mode.NORMAL])
|
||||
public class ChangeNumberIncAction : IncAction(1)
|
||||
class ChangeNumberIncAction : IncAction(1)
|
||||
|
||||
@CommandOrMotion(keys = ["<C-X>"], modes = [Mode.NORMAL])
|
||||
public class ChangeNumberDecAction : IncAction(-1)
|
||||
class ChangeNumberDecAction : IncAction(-1)
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||
|
||||
public sealed class IncNumber(public val inc: Int, private val avalanche: Boolean) : VisualOperatorActionHandler.ForEachCaret() {
|
||||
sealed class IncNumber(val inc: Int, private val avalanche: Boolean) : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
override fun executeAction(
|
||||
@ -34,13 +34,13 @@ public sealed class IncNumber(public val inc: Int, private val avalanche: Boolea
|
||||
}
|
||||
|
||||
@CommandOrMotion(keys = ["<C-A>"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualNumberIncAction : IncNumber(1, false)
|
||||
class ChangeVisualNumberIncAction : IncNumber(1, false)
|
||||
|
||||
@CommandOrMotion(keys = ["<C-X>"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualNumberDecAction : IncNumber(-1, false)
|
||||
class ChangeVisualNumberDecAction : IncNumber(-1, false)
|
||||
|
||||
@CommandOrMotion(keys = ["g<C-A>"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualNumberAvalancheIncAction : IncNumber(1, true)
|
||||
class ChangeVisualNumberAvalancheIncAction : IncNumber(1, true)
|
||||
|
||||
@CommandOrMotion(keys = ["g<C-X>"], modes = [Mode.VISUAL])
|
||||
public class ChangeVisualNumberAvalancheDecAction : IncNumber(-1, true)
|
||||
class ChangeVisualNumberAvalancheDecAction : IncNumber(-1, true)
|
||||
|
@ -19,15 +19,15 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["<Del>"], modes = [Mode.NORMAL])
|
||||
public class DeleteCharacterAction : DeleteCharacter({ 1 })
|
||||
class DeleteCharacterAction : DeleteCharacter({ 1 })
|
||||
|
||||
@CommandOrMotion(keys = ["X"], modes = [Mode.NORMAL])
|
||||
public class DeleteCharacterLeftAction : DeleteCharacter({ -it })
|
||||
class DeleteCharacterLeftAction : DeleteCharacter({ -it })
|
||||
|
||||
@CommandOrMotion(keys = ["x"], modes = [Mode.NORMAL])
|
||||
public class DeleteCharacterRightAction : DeleteCharacter({ it })
|
||||
class DeleteCharacterRightAction : DeleteCharacter({ it })
|
||||
|
||||
public abstract class DeleteCharacter(private val countModifier: (Int) -> Int) : ChangeEditorActionHandler.ForEachCaret() {
|
||||
abstract class DeleteCharacter(private val countModifier: (Int) -> Int) : ChangeEditorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun execute(
|
||||
|
@ -19,7 +19,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["D"], modes = [Mode.NORMAL])
|
||||
public class DeleteEndOfLineAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
class DeleteEndOfLineAction : ChangeEditorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun execute(
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["d"], modes = [Mode.NORMAL])
|
||||
public class DeleteMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
class DeleteMotionAction : ChangeEditorActionHandler.ForEachCaret(), DuplicableOperatorAction {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override val argumentType: Argument.Type = Argument.Type.MOTION
|
||||
|
@ -22,7 +22,7 @@ import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["d", "x", "<Del>"], modes = [Mode.VISUAL])
|
||||
public class DeleteVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class DeleteVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override fun executeAction(
|
||||
|
@ -29,7 +29,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["X"], modes = [Mode.VISUAL])
|
||||
public class DeleteVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class DeleteVisualLinesAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
|
@ -29,7 +29,7 @@ import java.util.*
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = ["D"], modes = [Mode.VISUAL])
|
||||
public class DeleteVisualLinesEndAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
class DeleteVisualLinesEndAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.DELETE
|
||||
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["a"], modes = [Mode.NORMAL])
|
||||
public class InsertAfterCursorAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class InsertAfterCursorAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.INSERT
|
||||
|
||||
override fun execute(
|
||||
|
@ -18,7 +18,7 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["A"], modes = [Mode.NORMAL])
|
||||
public class InsertAfterLineEndAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class InsertAfterLineEndAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.INSERT
|
||||
|
||||
override fun execute(
|
||||
|
@ -20,7 +20,7 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
|
||||
@CommandOrMotion(keys = ["gi"], modes = [Mode.NORMAL])
|
||||
public class InsertAtPreviousInsertAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
class InsertAtPreviousInsertAction : ChangeEditorActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.INSERT
|
||||
|
||||
override fun execute(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user