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

[VIM-3815]: Disable Octopus Handler for Rider and other IDEs with the new typing engine

This commit is contained in:
Alex Plate 2025-02-28 17:13:57 +02:00
parent a836b31ebe
commit 692e4434d1
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
5 changed files with 37 additions and 2 deletions
src/main
java/com/maddyhome/idea/vim
resources/META-INF

View File

@ -19,7 +19,6 @@ import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.RangeMarker
import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.ide.CopyPasteManager
import com.intellij.util.PlatformUtils
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimCaret
@ -34,6 +33,7 @@ import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.RWLockLabel
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
import com.maddyhome.idea.vim.ide.isClionNova
import com.maddyhome.idea.vim.ide.isRider
import com.maddyhome.idea.vim.mark.VimMarkConstants.MARK_CHANGE_POS
import com.maddyhome.idea.vim.newapi.IjVimCaret
import com.maddyhome.idea.vim.newapi.IjVimCopiedText
@ -206,7 +206,7 @@ internal class PutGroup : VimPutBase() {
endOffset: Int,
): Int {
// Temp fix for VIM-2808. Should be removed after rider will fix it's issues
if (PlatformUtils.isRider() || isClionNova()) return endOffset
if (isRider() || isClionNova()) return endOffset
val startLine = editor.offsetToBufferPosition(startOffset).line
val endLine = editor.offsetToBufferPosition(endOffset - 1).line

View File

@ -25,6 +25,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.UserDataHolder
import com.intellij.openapi.util.removeUserData
import com.intellij.util.PlatformUtils
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
@ -34,6 +35,8 @@ import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.inNormalMode
import com.maddyhome.idea.vim.helper.isPrimaryEditor
import com.maddyhome.idea.vim.helper.updateCaretsVisualAttributes
import com.maddyhome.idea.vim.ide.isClionNova
import com.maddyhome.idea.vim.ide.isRider
import com.maddyhome.idea.vim.newapi.actionStartedFromVim
import com.maddyhome.idea.vim.newapi.globalIjOptions
import com.maddyhome.idea.vim.newapi.vim
@ -358,6 +361,8 @@ internal fun isOctopusEnabled(s: KeyStroke, editor: Editor): Boolean {
// CMD line has a different processing mechanizm: the processing actions are registered
// for the input field component. These keys are not dispatched via the octopus handler.
if (editor.vim.mode is Mode.CMD_LINE) return false
// Turn off octopus for some IDEs. They have issues with ENTER and ESC on the octopus like VIM-3815
if (isRider() || PlatformUtils.isJetBrainsClient() || isClionNova()) return false
when {
s.keyCode == KeyEvent.VK_ENTER && s.modifiers == 0 -> return true
s.keyCode == KeyEvent.VK_ESCAPE && s.modifiers == 0 -> return true

View File

@ -0,0 +1,25 @@
/*
* Copyright 2003-2024 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim.ide
import com.intellij.openapi.extensions.ExtensionPointName
internal val riderEP = ExtensionPointName.create<RiderProvider>("IdeaVIM.riderProvider")
internal interface RiderProvider {
fun isRider(): Boolean
}
internal class RiderProviderImpl : RiderProvider {
override fun isRider(): Boolean = true
}
internal fun isRider(): Boolean {
return riderEP.extensions.any { it.isRider() }
}

View File

@ -18,4 +18,7 @@
id="ideavim-rider-esc"
order="first, before idea.only.escape"/>
</extensions>
<extensions defaultExtensionNs="IdeaVIM">
<riderProvider implementation="com.maddyhome.idea.vim.ide.RiderProviderImpl"/>
</extensions>
</idea-plugin>

View File

@ -28,6 +28,7 @@
<depends>com.intellij.modules.platform</depends>
<resource-bundle>messages.IdeaVimBundle</resource-bundle>
<!-- https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html#exploring-module-and-plugin-apis-->
<!-- IDE-Specific configurations -->
<!--suppress PluginXmlValidity -->
<depends optional="true" config-file="ides/ideavim-withRider.xml">com.intellij.modules.rider</depends>
@ -52,6 +53,7 @@
</extensionPoint>
<extensionPoint interface="com.maddyhome.idea.vim.ide.ClionNovaProvider" dynamic="true" name="clionNovaProvider"/>
<extensionPoint interface="com.maddyhome.idea.vim.ide.RiderProvider" dynamic="true" name="riderProvider"/>
<extensionPoint interface="com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint" dynamic="true"
name="internal.disabler"/>
</extensionPoints>