1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-28 08:34:02 +02:00

Commands don't start the read and write actions automatically. See the explanation in the previous commit messages.

Related to the implementation of VIM-3376
This commit is contained in:
Alex Plate 2025-02-21 19:11:28 +02:00
parent fedefea0aa
commit c9189ed7cb
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F

View File

@ -27,6 +27,7 @@ import com.maddyhome.idea.vim.state.mode.isBlock
import com.maddyhome.idea.vim.vimscript.model.Executable import com.maddyhome.idea.vim.vimscript.model.Executable
import com.maddyhome.idea.vim.vimscript.model.ExecutionResult import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
import com.maddyhome.idea.vim.vimscript.model.VimLContext import com.maddyhome.idea.vim.vimscript.model.VimLContext
import org.jetbrains.annotations.ApiStatus
enum class CommandModifier { enum class CommandModifier {
NONE, NONE,
@ -104,12 +105,7 @@ sealed class Command(
val operatorArguments = OperatorArguments(0, editor.mode) val operatorArguments = OperatorArguments(0, editor.mode)
val runCommand = { runCommand(editor, context, operatorArguments) } return runCommand(editor, context, operatorArguments)
return when (argFlags.access) {
Access.WRITABLE -> injector.application.runWriteAction(runCommand)
Access.READ_ONLY -> injector.application.runReadAction(runCommand)
Access.SELF_SYNCHRONIZED -> runCommand.invoke()
}
} }
private fun runCommand( private fun runCommand(
@ -220,12 +216,20 @@ sealed class Command(
enum class Access { enum class Access {
/** /**
* Indicates that this is a command that modifies the editor * Indicates that this is a command that modifies the editor
*
* Obsolete: It used to start a write action automatically, but now all actions are supposed to take care of locks
* individually.
*/ */
@ApiStatus.Obsolete
WRITABLE, WRITABLE,
/** /**
* Indicates that this command does not modify the editor * Indicates that this command does not modify the editor
*
* Obsolete: It used to start a read action automatically, but now all actions are supposed to take care of locks
* individually.
*/ */
@ApiStatus.Obsolete
READ_ONLY, READ_ONLY,
/** /**