mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-22 10:34:04 +02:00
[VIM-3815]: Disable Octopus Handler for Rider and other IDEs with the new typing engine
This commit is contained in:
parent
a836b31ebe
commit
692e4434d1
src/main
java/com/maddyhome/idea/vim
resources/META-INF
@ -19,7 +19,6 @@ import com.intellij.openapi.editor.Caret
|
|||||||
import com.intellij.openapi.editor.RangeMarker
|
import com.intellij.openapi.editor.RangeMarker
|
||||||
import com.intellij.openapi.editor.ex.EditorEx
|
import com.intellij.openapi.editor.ex.EditorEx
|
||||||
import com.intellij.openapi.ide.CopyPasteManager
|
import com.intellij.openapi.ide.CopyPasteManager
|
||||||
import com.intellij.util.PlatformUtils
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
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.RWLockLabel
|
||||||
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
|
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
|
||||||
import com.maddyhome.idea.vim.ide.isClionNova
|
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.mark.VimMarkConstants.MARK_CHANGE_POS
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCopiedText
|
import com.maddyhome.idea.vim.newapi.IjVimCopiedText
|
||||||
@ -206,7 +206,7 @@ internal class PutGroup : VimPutBase() {
|
|||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
): Int {
|
): Int {
|
||||||
// Temp fix for VIM-2808. Should be removed after rider will fix it's issues
|
// 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 startLine = editor.offsetToBufferPosition(startOffset).line
|
||||||
val endLine = editor.offsetToBufferPosition(endOffset - 1).line
|
val endLine = editor.offsetToBufferPosition(endOffset - 1).line
|
||||||
|
@ -25,6 +25,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
|
|||||||
import com.intellij.openapi.util.Key
|
import com.intellij.openapi.util.Key
|
||||||
import com.intellij.openapi.util.UserDataHolder
|
import com.intellij.openapi.util.UserDataHolder
|
||||||
import com.intellij.openapi.util.removeUserData
|
import com.intellij.openapi.util.removeUserData
|
||||||
|
import com.intellij.util.PlatformUtils
|
||||||
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.injector
|
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.inNormalMode
|
||||||
import com.maddyhome.idea.vim.helper.isPrimaryEditor
|
import com.maddyhome.idea.vim.helper.isPrimaryEditor
|
||||||
import com.maddyhome.idea.vim.helper.updateCaretsVisualAttributes
|
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.actionStartedFromVim
|
||||||
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
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
|
// 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.
|
// for the input field component. These keys are not dispatched via the octopus handler.
|
||||||
if (editor.vim.mode is Mode.CMD_LINE) return false
|
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 {
|
when {
|
||||||
s.keyCode == KeyEvent.VK_ENTER && s.modifiers == 0 -> return true
|
s.keyCode == KeyEvent.VK_ENTER && s.modifiers == 0 -> return true
|
||||||
s.keyCode == KeyEvent.VK_ESCAPE && s.modifiers == 0 -> return true
|
s.keyCode == KeyEvent.VK_ESCAPE && s.modifiers == 0 -> return true
|
||||||
|
25
src/main/java/com/maddyhome/idea/vim/ide/riderDetector.kt
Normal file
25
src/main/java/com/maddyhome/idea/vim/ide/riderDetector.kt
Normal 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() }
|
||||||
|
}
|
@ -18,4 +18,7 @@
|
|||||||
id="ideavim-rider-esc"
|
id="ideavim-rider-esc"
|
||||||
order="first, before idea.only.escape"/>
|
order="first, before idea.only.escape"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
<extensions defaultExtensionNs="IdeaVIM">
|
||||||
|
<riderProvider implementation="com.maddyhome.idea.vim.ide.RiderProviderImpl"/>
|
||||||
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
@ -28,6 +28,7 @@
|
|||||||
<depends>com.intellij.modules.platform</depends>
|
<depends>com.intellij.modules.platform</depends>
|
||||||
<resource-bundle>messages.IdeaVimBundle</resource-bundle>
|
<resource-bundle>messages.IdeaVimBundle</resource-bundle>
|
||||||
|
|
||||||
|
<!-- https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html#exploring-module-and-plugin-apis-->
|
||||||
<!-- IDE-Specific configurations -->
|
<!-- IDE-Specific configurations -->
|
||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
<depends optional="true" config-file="ides/ideavim-withRider.xml">com.intellij.modules.rider</depends>
|
<depends optional="true" config-file="ides/ideavim-withRider.xml">com.intellij.modules.rider</depends>
|
||||||
@ -52,6 +53,7 @@
|
|||||||
|
|
||||||
</extensionPoint>
|
</extensionPoint>
|
||||||
<extensionPoint interface="com.maddyhome.idea.vim.ide.ClionNovaProvider" dynamic="true" name="clionNovaProvider"/>
|
<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"
|
<extensionPoint interface="com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint" dynamic="true"
|
||||||
name="internal.disabler"/>
|
name="internal.disabler"/>
|
||||||
</extensionPoints>
|
</extensionPoints>
|
||||||
|
Loading…
Reference in New Issue
Block a user