mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-20 14:34:02 +02:00
Fix(VIM-3543): Disable IdeaVim in the new terminal
This commit is contained in:
parent
d3864ab02b
commit
00d9ed93ec
build.gradle.kts
src/main
java/com/maddyhome/idea/vim
customization/feature/terminal
helper
key
resources/META-INF
@ -139,6 +139,8 @@ dependencies {
|
|||||||
"LATEST-EAP-SNAPSHOT", "2024.3" -> bundledPlugins("com.intellij.modules.json")
|
"LATEST-EAP-SNAPSHOT", "2024.3" -> bundledPlugins("com.intellij.modules.json")
|
||||||
else -> error("Unsupported version: $ideaVersion")
|
else -> error("Unsupported version: $ideaVersion")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bundledPlugins("org.jetbrains.plugins.terminal")
|
||||||
}
|
}
|
||||||
|
|
||||||
moduleSources(project(":vim-engine", "sourcesJarArtifacts"))
|
moduleSources(project(":vim-engine", "sourcesJarArtifacts"))
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@ import com.intellij.util.ui.table.JBTableRowEditor
|
|||||||
import com.maddyhome.idea.vim.api.StringListOptionValue
|
import com.maddyhome.idea.vim.api.StringListOptionValue
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.group.IjOptionConstants
|
import com.maddyhome.idea.vim.group.IjOptionConstants
|
||||||
|
import com.maddyhome.idea.vim.key.IdeaVimDisablerExtensionPoint
|
||||||
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
@ -37,7 +38,8 @@ internal val Editor.isIdeaVimDisabledHere: Boolean
|
|||||||
val ideaVimSupportValue = injector.globalIjOptions().ideavimsupport
|
val ideaVimSupportValue = injector.globalIjOptions().ideavimsupport
|
||||||
return (ideaVimDisabledInDialog(ideaVimSupportValue) && isInDialog()) ||
|
return (ideaVimDisabledInDialog(ideaVimSupportValue) && isInDialog()) ||
|
||||||
!ClientId.isCurrentlyUnderLocalId || // CWM-927
|
!ClientId.isCurrentlyUnderLocalId || // CWM-927
|
||||||
(ideaVimDisabledForSingleLine(ideaVimSupportValue) && isSingleLine())
|
(ideaVimDisabledForSingleLine(ideaVimSupportValue) && isSingleLine()) ||
|
||||||
|
IdeaVimDisablerExtensionPoint.isDisabledForEditor(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ideaVimDisabledInDialog(ideaVimSupportValue: StringListOptionValue): Boolean {
|
private fun ideaVimDisabledInDialog(ideaVimSupportValue: StringListOptionValue): Boolean {
|
||||||
|
@ -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) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
@ -36,6 +36,7 @@
|
|||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
<depends optional="true" config-file="ides/ideavim-withAppCode.xml">com.intellij.modules.appcode</depends>
|
<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="ideavim-withAceJump.xml">AceJump</depends>
|
||||||
|
<depends optional="true" config-file="features/ideavim-withTerminal.xml">org.jetbrains.plugins.terminal</depends>
|
||||||
|
|
||||||
<applicationListeners>
|
<applicationListeners>
|
||||||
<listener class="com.maddyhome.idea.vim.PyNotebooksCloseWorkaround"
|
<listener class="com.maddyhome.idea.vim.PyNotebooksCloseWorkaround"
|
||||||
@ -53,6 +54,8 @@
|
|||||||
|
|
||||||
</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.key.IdeaVimDisablerExtensionPoint" dynamic="true"
|
||||||
|
name="internal.disabler"/>
|
||||||
</extensionPoints>
|
</extensionPoints>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
Loading…
Reference in New Issue
Block a user