1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-04-30 22:34:04 +02:00

Fix(VIM-3543): Disable IdeaVim in the new terminal

This commit is contained in:
Alex Plate 2025-01-23 12:21:58 +02:00
parent d3864ab02b
commit 00d9ed93ec
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
6 changed files with 74 additions and 1 deletions
build.gradle.kts
src/main
java/com/maddyhome/idea/vim
resources/META-INF

View File

@ -139,6 +139,8 @@ dependencies {
"LATEST-EAP-SNAPSHOT", "2024.3" -> bundledPlugins("com.intellij.modules.json")
else -> error("Unsupported version: $ideaVersion")
}
bundledPlugins("org.jetbrains.plugins.terminal")
}
moduleSources(project(":vim-engine", "sourcesJarArtifacts"))

View File

@ -0,0 +1,26 @@
/*
* Copyright 2003-2025 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.customization.feature.terminal
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint
import org.jetbrains.plugins.terminal.block.util.TerminalDataContextUtils.isAlternateBufferEditor
import org.jetbrains.plugins.terminal.block.util.TerminalDataContextUtils.isOutputEditor
import org.jetbrains.plugins.terminal.block.util.TerminalDataContextUtils.isPromptEditor
/**
* The only implementation is defined right here.
*/
// [VERSION UPDATE] 2025.1+ Add 2 new predicates
internal class IdeaVimTerminalDisablerExtension : IdeaVimDisablerExtensionPoint {
override fun isDisabledForEditor(editor: Editor): Boolean {
return editor.isPromptEditor || editor.isOutputEditor || editor.isAlternateBufferEditor
// || editor.isOutputModelEditor || editor.isAlternateBufferModelEditor
}
}

View File

@ -19,6 +19,7 @@ import com.intellij.util.ui.table.JBTableRowEditor
import com.maddyhome.idea.vim.api.StringListOptionValue
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.IjOptionConstants
import com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint
import com.maddyhome.idea.vim.newapi.globalIjOptions
import java.awt.Component
import javax.swing.JComponent
@ -37,7 +38,8 @@ internal val Editor.isIdeaVimDisabledHere: Boolean
val ideaVimSupportValue = injector.globalIjOptions().ideavimsupport
return (ideaVimDisabledInDialog(ideaVimSupportValue) && isInDialog()) ||
!ClientId.isCurrentlyUnderLocalId || // CWM-927
(ideaVimDisabledForSingleLine(ideaVimSupportValue) && isSingleLine())
(ideaVimDisabledForSingleLine(ideaVimSupportValue) && isSingleLine()) ||
IdeaVimDisablerExtensionPoint.isDisabledForEditor(this)
}
private fun ideaVimDisabledInDialog(ideaVimSupportValue: StringListOptionValue): Boolean {

View File

@ -0,0 +1,27 @@
/*
* Copyright 2003-2025 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.key
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.extensions.ExtensionPointName
/**
* This extension point is available only for the IdeaVim internally
*/
internal interface IdeaVimDisablerExtensionPoint {
fun isDisabledForEditor(editor: Editor): Boolean
companion object {
private val EP_NAME = ExtensionPointName.create<IdeaVimDisablerExtensionPoint>("IdeaVIM.internal.disabler")
fun isDisabledForEditor(editor: Editor): Boolean {
return EP_NAME.extensionList.any { it.isDisabledForEditor(editor) }
}
}
}

View File

@ -0,0 +1,13 @@
<!--
~ Copyright 2003-2025 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.
-->
<idea-plugin>
<extensions defaultExtensionNs="IdeaVIM">
<internal.disabler implementation="com.maddyhome.idea.vim.customization.feature.terminal.IdeaVimTerminalDisablerExtension"/>
</extensions>
</idea-plugin>

View File

@ -36,6 +36,7 @@
<!--suppress PluginXmlValidity -->
<depends optional="true" config-file="ides/ideavim-withAppCode.xml">com.intellij.modules.appcode</depends>
<depends optional="true" config-file="ideavim-withAceJump.xml">AceJump</depends>
<depends optional="true" config-file="features/ideavim-withTerminal.xml">org.jetbrains.plugins.terminal</depends>
<applicationListeners>
<listener class="com.maddyhome.idea.vim.PyNotebooksCloseWorkaround"
@ -53,6 +54,8 @@
</extensionPoint>
<extensionPoint interface="com.maddyhome.idea.vim.ide.ClionNovaProvider" dynamic="true" name="clionNovaProvider"/>
<extensionPoint interface="com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint" dynamic="true"
name="internal.disabler"/>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">