mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-06-05 04:34:04 +02:00
Use the property to change the state of the octopus handler
This commit is contained in:
parent
6d01b5be77
commit
247aaed188
.github/workflows
build.gradle.ktssrc
main/java/com/maddyhome/idea/vim
test/java/org/jetbrains/plugins/ideavim/action/change/insert
tests/ui-ij-tests/src/test/kotlin/ui
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
action
api
5
.github/workflows/runUiOctopusTests.yml
vendored
5
.github/workflows/runUiOctopusTests.yml
vendored
@ -9,9 +9,6 @@ jobs:
|
|||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Apply Patch
|
|
||||||
run: |
|
|
||||||
git apply tests/ui-ij-tests/src/test/kotlin/ui/octopus.patch
|
|
||||||
- name: Setup Java
|
- name: Setup Java
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
@ -30,7 +27,7 @@ jobs:
|
|||||||
- name: Run Idea
|
- name: Run Idea
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build/reports
|
mkdir -p build/reports
|
||||||
gradle runIdeForUiTests > build/reports/idea.log &
|
gradle runIdeForUiTests -Doctopus.handler=false > build/reports/idea.log &
|
||||||
- name: Wait for Idea started
|
- name: Wait for Idea started
|
||||||
uses: jtalk/url-health-check-action@v3
|
uses: jtalk/url-health-check-action@v3
|
||||||
with:
|
with:
|
||||||
|
@ -206,6 +206,11 @@ tasks {
|
|||||||
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
|
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
|
||||||
systemProperty("jb.consents.confirmation.enabled", "false")
|
systemProperty("jb.consents.confirmation.enabled", "false")
|
||||||
systemProperty("ide.show.tips.on.startup.default.value", "false")
|
systemProperty("ide.show.tips.on.startup.default.value", "false")
|
||||||
|
systemProperty("octopus.handler", System.getProperty("octopus.handler") ?: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
runIde {
|
||||||
|
systemProperty("octopus.handler", System.getProperty("octopus.handler") ?: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponen
|
|||||||
private void registerRequiredShortcut(@NotNull List<KeyStroke> keys, MappingOwner owner) {
|
private void registerRequiredShortcut(@NotNull List<KeyStroke> keys, MappingOwner owner) {
|
||||||
for (KeyStroke key : keys) {
|
for (KeyStroke key : keys) {
|
||||||
if (key.getKeyChar() == KeyEvent.CHAR_UNDEFINED) {
|
if (key.getKeyChar() == KeyEvent.CHAR_UNDEFINED) {
|
||||||
if (!injector.getOptionGroup().getGlobalOptions().getOctopushandler() ||
|
if (!injector.getApplication().isOctopusEnabled() ||
|
||||||
!(key.getKeyCode() == KeyEvent.VK_ESCAPE && key.getModifiers() == 0) &&
|
!(key.getKeyCode() == KeyEvent.VK_ESCAPE && key.getModifiers() == 0) &&
|
||||||
!(key.getKeyCode() == KeyEvent.VK_ENTER && key.getModifiers() == 0)) {
|
!(key.getKeyCode() == KeyEvent.VK_ENTER && key.getModifiers() == 0)) {
|
||||||
getRequiredShortcutKeys().add(new RequiredShortcut(key, owner));
|
getRequiredShortcutKeys().add(new RequiredShortcut(key, owner));
|
||||||
|
@ -27,7 +27,6 @@ import com.intellij.openapi.util.UserDataHolder
|
|||||||
import com.intellij.openapi.util.removeUserData
|
import com.intellij.openapi.util.removeUserData
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.api.key
|
import com.maddyhome.idea.vim.api.key
|
||||||
import com.maddyhome.idea.vim.group.IjOptionConstants
|
import com.maddyhome.idea.vim.group.IjOptionConstants
|
||||||
@ -362,4 +361,4 @@ internal fun isOctopusEnabled(s: KeyStroke, editor: Editor): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal val enableOctopus: Boolean
|
internal val enableOctopus: Boolean
|
||||||
get() = injector.globalOptions().octopushandler
|
get() = injector.application.isOctopusEnabled()
|
||||||
|
@ -86,6 +86,12 @@ internal class IjVimApplication : VimApplicationBase() {
|
|||||||
com.maddyhome.idea.vim.helper.runAfterGotFocus(runnable)
|
com.maddyhome.idea.vim.helper.runAfterGotFocus(runnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isOctopusEnabled(): Boolean {
|
||||||
|
val property = System.getProperty("octopus.handler") ?: "true"
|
||||||
|
if (property.isBlank()) return true
|
||||||
|
return property.toBoolean()
|
||||||
|
}
|
||||||
|
|
||||||
private fun createKeyEvent(stroke: KeyStroke, component: Component): KeyEvent {
|
private fun createKeyEvent(stroke: KeyStroke, component: Component): KeyEvent {
|
||||||
return KeyEvent(
|
return KeyEvent(
|
||||||
component,
|
component,
|
||||||
|
@ -17,7 +17,6 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandlerBean
|
|||||||
import com.intellij.openapi.extensions.ExtensionPointName
|
import com.intellij.openapi.extensions.ExtensionPointName
|
||||||
import com.intellij.testFramework.ExtensionTestUtil
|
import com.intellij.testFramework.ExtensionTestUtil
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
@ -47,7 +46,7 @@ class InsertEnterActionTest : VimTestCase() {
|
|||||||
forEachBean.action = "EditorEnter"
|
forEachBean.action = "EditorEnter"
|
||||||
forEachBean.setPluginDescriptor(PluginManagerCore.getPlugin(VimPlugin.getPluginId())!!)
|
forEachBean.setPluginDescriptor(PluginManagerCore.getPlugin(VimPlugin.getPluginId())!!)
|
||||||
|
|
||||||
if (injector.globalOptions().octopushandler) {
|
if (injector.application.isOctopusEnabled()) {
|
||||||
if (repetitionInfo.currentRepetition == 1) {
|
if (repetitionInfo.currentRepetition == 1) {
|
||||||
ExtensionTestUtil.maskExtensions(
|
ExtensionTestUtil.maskExtensions(
|
||||||
ExtensionPointName("com.intellij.editorActionHandler"),
|
ExtensionPointName("com.intellij.editorActionHandler"),
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
Index: vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/Options.kt
|
|
||||||
IDEA additional info:
|
|
||||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
||||||
<+>UTF-8
|
|
||||||
===================================================================
|
|
||||||
diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/Options.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/Options.kt
|
|
||||||
--- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/Options.kt (revision 2cc7ce5b316be5665406dcf8d3e41116ccbfb0b0)
|
|
||||||
+++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/Options.kt (date 1706273373741)
|
|
||||||
@@ -302,7 +302,7 @@
|
|
||||||
public val ideaglobalmode: ToggleOption = addOption(ToggleOption("ideaglobalmode", GLOBAL, "ideaglobalmode", false))
|
|
||||||
public val ideastrictmode: ToggleOption = addOption(ToggleOption("ideastrictmode", GLOBAL, "ideastrictmode", false))
|
|
||||||
public val ideatracetime: ToggleOption = addOption(ToggleOption("ideatracetime", GLOBAL, "ideatracetime", false))
|
|
||||||
- public val octopushandler: ToggleOption = addOption(ToggleOption("octopushandler", GLOBAL, "octopushandler", true))
|
|
||||||
+ public val octopushandler: ToggleOption = addOption(ToggleOption("octopushandler", GLOBAL, "octopushandler", false))
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MultikeyMap(vararg entries: Option<VimDataType>) {
|
|
@ -11,7 +11,6 @@ import com.intellij.vim.annotations.CommandOrMotion
|
|||||||
import com.intellij.vim.annotations.Mode
|
import com.intellij.vim.annotations.Mode
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
@ -32,7 +31,7 @@ public class InsertEnterAction : VimActionHandler.SingleExecution() {
|
|||||||
cmd: Command,
|
cmd: Command,
|
||||||
operatorArguments: OperatorArguments,
|
operatorArguments: OperatorArguments,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (injector.globalOptions().octopushandler) {
|
if (injector.application.isOctopusEnabled()) {
|
||||||
if (editor.isInForEachCaretScope()) {
|
if (editor.isInForEachCaretScope()) {
|
||||||
editor.removeSecondaryCarets()
|
editor.removeSecondaryCarets()
|
||||||
injector.changeGroup.processEnter(editor, editor.primaryCaret(), context)
|
injector.changeGroup.processEnter(editor, editor.primaryCaret(), context)
|
||||||
|
@ -12,7 +12,6 @@ import com.intellij.vim.annotations.CommandOrMotion
|
|||||||
import com.intellij.vim.annotations.Mode
|
import com.intellij.vim.annotations.Mode
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
@ -33,7 +32,7 @@ public class SelectEnterAction : VimActionHandler.SingleExecution() {
|
|||||||
cmd: Command,
|
cmd: Command,
|
||||||
operatorArguments: OperatorArguments,
|
operatorArguments: OperatorArguments,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (injector.globalOptions().octopushandler) {
|
if (injector.application.isOctopusEnabled()) {
|
||||||
if (editor.isInForEachCaretScope()) {
|
if (editor.isInForEachCaretScope()) {
|
||||||
editor.removeSecondaryCarets()
|
editor.removeSecondaryCarets()
|
||||||
injector.changeGroup.processEnter(editor, editor.primaryCaret(), context)
|
injector.changeGroup.processEnter(editor, editor.primaryCaret(), context)
|
||||||
|
@ -58,7 +58,6 @@ public open class GlobalOptions(scope: OptionAccessScope): OptionsPropertiesBase
|
|||||||
// Temporary flags for work-in-progress behaviour. Hidden from the output of `:set all`
|
// Temporary flags for work-in-progress behaviour. Hidden from the output of `:set all`
|
||||||
public var ideastrictmode: Boolean by optionProperty(Options.ideastrictmode)
|
public var ideastrictmode: Boolean by optionProperty(Options.ideastrictmode)
|
||||||
public var ideatracetime: Boolean by optionProperty(Options.ideatracetime)
|
public var ideatracetime: Boolean by optionProperty(Options.ideatracetime)
|
||||||
public var octopushandler: Boolean by optionProperty(Options.octopushandler)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -322,7 +322,6 @@ public object Options {
|
|||||||
// Temporary feature flags for work-in-progress behaviour, diagnostic switches, etc. Hidden from the output of `:set all`
|
// Temporary feature flags for work-in-progress behaviour, diagnostic switches, etc. Hidden from the output of `:set all`
|
||||||
public val ideastrictmode: ToggleOption = addOption(ToggleOption("ideastrictmode", GLOBAL, "ideastrictmode", false, isHidden = true))
|
public val ideastrictmode: ToggleOption = addOption(ToggleOption("ideastrictmode", GLOBAL, "ideastrictmode", false, isHidden = true))
|
||||||
public val ideatracetime: ToggleOption = addOption(ToggleOption("ideatracetime", GLOBAL, "ideatracetime", false, isHidden = true))
|
public val ideatracetime: ToggleOption = addOption(ToggleOption("ideatracetime", GLOBAL, "ideatracetime", false, isHidden = true))
|
||||||
public val octopushandler: ToggleOption = addOption(ToggleOption("octopushandler", GLOBAL, "octopushandler", true, isHidden = true))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MultikeyMap(vararg entries: Option<VimDataType>) {
|
private class MultikeyMap(vararg entries: Option<VimDataType>) {
|
||||||
|
@ -28,4 +28,5 @@ public interface VimApplication {
|
|||||||
|
|
||||||
public fun currentStackTrace(): String
|
public fun currentStackTrace(): String
|
||||||
public fun runAfterGotFocus(runnable: Runnable)
|
public fun runAfterGotFocus(runnable: Runnable)
|
||||||
|
public fun isOctopusEnabled(): Boolean
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ public abstract class VimKeyGroupBase : VimKeyGroup {
|
|||||||
for (key in fromKeys) {
|
for (key in fromKeys) {
|
||||||
if (key.keyChar == KeyEvent.CHAR_UNDEFINED) {
|
if (key.keyChar == KeyEvent.CHAR_UNDEFINED) {
|
||||||
if (
|
if (
|
||||||
!injector.globalOptions().octopushandler ||
|
!injector.application.isOctopusEnabled() ||
|
||||||
!(key.keyCode == KeyEvent.VK_ESCAPE && key.modifiers == 0) &&
|
!(key.keyCode == KeyEvent.VK_ESCAPE && key.modifiers == 0) &&
|
||||||
!(key.keyCode == KeyEvent.VK_ENTER && key.modifiers == 0)
|
!(key.keyCode == KeyEvent.VK_ENTER && key.modifiers == 0)
|
||||||
) {
|
) {
|
||||||
|
@ -69,4 +69,8 @@ public class VimApplicationStub : VimApplicationBase() {
|
|||||||
override fun runAfterGotFocus(runnable: Runnable) {
|
override fun runAfterGotFocus(runnable: Runnable) {
|
||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isOctopusEnabled(): Boolean {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user