1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2024-11-25 16:42:55 +01:00

Compare commits

..

33 Commits

Author SHA1 Message Date
Alex Plate
e42b4d0ea3
Fix regex for changelog plugin 2022-08-12 10:14:31 +03:00
Alex Plate
43767b8500
Print error 2022-08-12 09:55:29 +03:00
Alex Plate
d05098c870 Update changelog 2022-08-12 06:47:15 +00:00
Alex Plate
505f485568
Update release version 2022-08-12 09:45:30 +03:00
Alex Plate
86f512fb91
Update for slack notification 2022-08-12 09:45:08 +03:00
Alex Plate
12903066b9
Workaround for VIM-2487 2022-08-12 09:45:07 +03:00
Alex Plate
118d0433cb
Fix(VIM-2728): Give access to global variables 2022-08-12 09:45:07 +03:00
filipp
eb781c3679 An attempt to avoid "No tests found" emails 2022-08-11 03:50:07 +03:00
filipp
3c6bffba03 Fix(VIM-749) 2022-08-11 03:27:19 +03:00
Alex Plate
89623b04d6
Update changelog 2022-08-09 10:25:14 +03:00
Alex Plate
444a96132c
Comment out test 2022-08-09 10:10:17 +03:00
Alex Plate
c008553127
Update TC constants 2022-08-09 09:51:25 +03:00
Alex Plate
162d7b021f
Update reference to changes 2022-08-09 09:50:02 +03:00
Alex Plate
c82364c1dd
Update changelog 2022-08-09 09:49:29 +03:00
Alex Plate
977402c6b0
Update changelog 2022-08-09 09:49:28 +03:00
Alex Plate
b14e59ab5b
Disable removing selection after undo 2022-08-09 09:49:28 +03:00
Alex Plate
47dcefcfbf Update formatting 2022-08-07 00:20:00 +00:00
Alex Plate
2b299cb422
Cut white edges on the gif 2022-08-05 08:47:50 +03:00
Alex Plate
d0ccbb4620
Use correct git for dark mode 2022-08-05 08:44:21 +03:00
Alex Plate
187b207271
Use gif instead of mp4 2022-08-05 08:37:05 +03:00
Alex Plate
a3e22c844c
Different gif in readme 2022-08-05 08:34:59 +03:00
Alex Plate
f8384b2732
Create dark screenshot for contributing 2022-08-05 08:16:38 +03:00
Alex Plate
2dae43258c
Skip unsupported arguments in command
VIM-2720
2022-08-04 20:08:13 +03:00
Alex Plate
48033ecb85
Update changelog 2022-08-04 19:45:52 +03:00
Alex Plate
ad8df027ac
Skip neovim check in extensions and multicaret tests 2022-08-04 19:44:58 +03:00
Alex Plate
91f580771d
Fix test with closing buffer 2022-08-04 19:18:26 +03:00
Matt Ellis
9c6f0981f5 Consolidate doTest methods 2022-08-04 19:17:59 +03:00
Alex Plate
2212569688 Update changelog 2022-08-02 15:07:49 +00:00
Alex Plate
6711f1dbab
Specify update thread for actions 2022-08-01 13:09:23 +03:00
Alex Plate
0b7a883efb
Fix(VIM-2723): Move focus to editor after :q 2022-08-01 09:29:44 +03:00
Alex Plate
8ae84c62c0
Update changelog 2022-07-26 09:39:51 +03:00
Alex Plate
0d168c8115 Update formatting 2022-07-24 00:20:23 +00:00
c7b51b7fa5 Implement partial code completion support in macros
Works ok with insertions (Enter, Ctrl+Enter) but not with replacements (Tab)
2022-07-22 10:02:23 +03:00
76 changed files with 717 additions and 1258 deletions

View File

@ -5,8 +5,8 @@ object Constants {
const val EAP_CHANNEL = "eap"
const val DEV_CHANNEL = "Dev"
const val VERSION = "1.10.3"
const val DEV_VERSION = "1.11.0"
const val VERSION = "1.11.1"
const val DEV_VERSION = "1.12.0"
const val GITHUB_TESTS = "LATEST-EAP-SNAPSHOT"
const val NVIM_TESTS = "LATEST-EAP-SNAPSHOT"

View File

@ -23,7 +23,7 @@ It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
## To Be Released
## 1.11.0, 2022-08-09
### Features:
* Add `gcu` command for Commentary plugin
@ -53,12 +53,14 @@ usual beta standards.
* [VIM-2595](https://youtrack.jetbrains.com/issue/VIM-2595) Support plugins in macro execution
* [VIM-2671](https://youtrack.jetbrains.com/issue/VIM-2671) Fix using plugins from mappings
* [VIM-2675](https://youtrack.jetbrains.com/issue/VIM-2675) Fix numbering register in visual mode
* [VIM-696](https://youtrack.jetbrains.com/issue/VIM-696/vim-selection-issue-after-undo) Fix selection after undo
* [VIM-744](https://youtrack.jetbrains.com/issue/VIM-744/Use-undoredo-with-count-modifier) Add count to undo/redo
* [VIM-1862](https://youtrack.jetbrains.com/issue/VIM-1862/Ex-commands-executed-in-keymaps-and-macros-are-added-to-the-command-history) Fix command history
* [VIM-2227](https://youtrack.jetbrains.com/issue/VIM-2227) Wrong behavior when deleting / changing surround with invalid character
* [VIM-2691](https://youtrack.jetbrains.com/issue/VIM-2691) Save file on :w
* [VIM-2710](https://youtrack.jetbrains.com/issue/VIM-2710) Show options value on `set opt`
* [VIM-913](https://youtrack.jetbrains.com/issue/VIM-913) Partially fix the issue with macros and autocompletion
* [VIM-2723](https://youtrack.jetbrains.com/issue/VIM-2723) Move focus to editor after :q
* [VIM-2728](https://youtrack.jetbrains.com/issue/VIM-2728) Give access to global variables
### Merged PRs:
* [468](https://github.com/JetBrains/ideavim/pull/468) by [Thomas Schouten](https://github.com/PHPirates): Implement UserDataHolder for EditorDataContext
@ -70,6 +72,8 @@ usual beta standards.
* [519](https://github.com/JetBrains/ideavim/pull/519) by [chylex](https://github.com/chylex): Fix(VIM-2227): Wrong behavior when deleting / changing surround with invalid character
* [525](https://github.com/JetBrains/ideavim/pull/525) by [Matt Ellis](https://github.com/citizenmatt): Improve handling of fractional width fonts
* [526](https://github.com/JetBrains/ideavim/pull/526) by [Alex Pláte](https://github.com/AlexPl292): Create gradle.properties
* [528](https://github.com/JetBrains/ideavim/pull/528) by [chylex](https://github.com/chylex): Implement partial code completion support in macros
* [531](https://github.com/JetBrains/ideavim/pull/531) by [Matt Ellis](https://github.com/citizenmatt): Consolidate doTest methods
## 1.10.0, 2022-02-17

View File

@ -32,7 +32,7 @@ OK, ready to do some coding?
Yoo hoo! Youre all set to begin contributing.
We've prepared some useful configurations for you:
![Prepared configurations](assets/contributing/configurations.png)
![Prepared configurations light](assets/contributing/configs-light.png#gh-light-mode-only)![Prepared configurations dark](assets/contributing/configs-dark.png#gh-dark-mode-only)
And here are useful gradle commands:

View File

@ -226,7 +226,10 @@ Ex commands or via `:map` command mappings:
<details>
<summary><strong>"Track action Ids" Details</strong> (click to see)</summary>
<img src="assets/readme/track_action_id.gif" alt="track action ids"/>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/readme/track_action_dark.gif">
<img src="assets/readme/track_action_light.gif" alt="track action ids"/>
</picture>
</details>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 KiB

View File

@ -15,7 +15,9 @@ buildscript {
classpath("com.github.AlexPl292:mark-down-to-slack:1.1.2")
classpath("org.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r")
classpath("org.kohsuke:github-api:1.305")
classpath("org.jetbrains:markdown:0.3.1")
// This comes from the changelog plugin
// classpath("org.jetbrains:markdown:0.3.1")
}
}
@ -24,7 +26,7 @@ plugins {
java
kotlin("jvm") version "1.6.21"
id("org.jetbrains.intellij") version "1.7.0-SNAPSHOT"
id("org.jetbrains.intellij") version "1.8.0"
id("org.jetbrains.changelog") version "1.3.1"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
@ -273,7 +275,7 @@ changelog {
itemPrefix.set("*")
path.set("${project.projectDir}/CHANGES.md")
unreleasedTerm.set("To Be Released")
headerParserRegex.set("\\d\\.\\d+(.\\d+)?".toRegex())
headerParserRegex.set("(\\d\\.\\d+(.\\d+)?)".toRegex())
// header = { "${project.version}" }
// version = "0.60"
}
@ -326,6 +328,8 @@ tasks.register("slackNotification") {
println("Response code: $postRc")
if (postRc == 200) {
println(inputStream.bufferedReader().use { it.readText() })
} else {
println(errorStream.bufferedReader().use { it.readText() })
}
}
}

View File

@ -18,8 +18,14 @@
package com.maddyhome.idea.vim
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.ProjectManagerListener
import com.intellij.openapi.startup.StartupActivity
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.localEditors
import com.maddyhome.idea.vim.options.OptionScope
/**
* @author Alex Plate
@ -36,3 +42,19 @@ class PluginStartup : StartupActivity.DumbAware/*, LightEditCompatible*/ {
VimPlugin.getInstance().initialize()
}
}
// This is a temporal workaround for VIM-2487
class PyNotebooksCloseWorkaround : ProjectManagerListener {
override fun projectClosingBeforeSave(project: Project) {
val close = injector.optionService.getOptionValue(OptionScope.GLOBAL, "closenotebooks").asBoolean()
if (close) {
localEditors().forEach { editor ->
val virtualFile = EditorHelper.getVirtualFile(editor)
if (virtualFile?.extension == "ipynb") {
val fileEditorManager = FileEditorManagerEx.getInstanceEx(project)
fileEditorManager.closeFile(virtualFile)
}
}
}
}
}

View File

@ -19,6 +19,7 @@
package com.maddyhome.idea.vim.action
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareToggleAction
import com.maddyhome.idea.vim.VimPlugin
@ -42,4 +43,6 @@ class VimPluginToggleAction : DumbAwareToggleAction()/*, LightEditCompatible*/ {
if (VimPlugin.isEnabled()) MessageHelper.message("action.VimPluginToggle.enabled") else MessageHelper.message("action.VimPluginToggle.enable")
} else MessageHelper.message("action.VimPluginToggle.text")
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}

View File

@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.action
import com.google.common.collect.ImmutableSet
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.EmptyAction
@ -95,6 +96,10 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
}
}
// There is a chance that we can use BGT, but we call for isCell inside the update.
// Not sure if can can use BGT with this call. Let's use EDT for now.
override fun getActionUpdateThread() = ActionUpdateThread.EDT
override fun update(e: AnActionEvent) {
val start = if (traceTime) System.currentTimeMillis() else null
e.presentation.isEnabled = isEnabled(e)

View File

@ -21,6 +21,7 @@ package com.maddyhome.idea.vim.extension.nerdtree
import com.intellij.ide.projectView.ProjectView
import com.intellij.ide.projectView.impl.ProjectViewImpl
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.application.ApplicationManager
@ -172,7 +173,7 @@ class NerdTree : VimExtension {
}
class ProjectViewListener(private val project: Project) : ToolWindowManagerListener {
override fun toolWindowShown(id: String, toolWindow: ToolWindow) {
override fun toolWindowShown(toolWindow: ToolWindow) {
if (ToolWindowId.PROJECT_VIEW != toolWindow.id) return
val dispatcher = NerdDispatcher.getInstance(project)
@ -242,6 +243,8 @@ class NerdTree : VimExtension {
e.presentation.isEnabled = !speedSearchIsHere(project)
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
private fun speedSearchIsHere(project: Project): Boolean {
val component = ProjectView.getInstance(project).currentProjectViewPane.tree ?: return false
return SpeedSearchSupply.getSupply(component) != null
@ -560,7 +563,3 @@ class NerdTree : VimExtension {
}
}
}
private fun <T> Node<T>.addLeafs(keys: String, actionHolder: T) {
addLeafs(injector.parser.parseKeys(keys), actionHolder)
}

View File

@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.group;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
@ -27,6 +28,7 @@ import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
import com.intellij.openapi.fileEditor.impl.EditorWindow;
import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.project.Project;
@ -159,6 +161,10 @@ public class FileGroup extends VimFileBase {
if (virtualFile != null && window != null) {
window.closeFile(virtualFile);
}
if (!ApplicationManager.getApplication().isUnitTestMode()) {
// This thing doesn't have an implementation in test mode
EditorsSplitters.focusDefaultComponentInSplittersIfPresent(project);
}
}
}
@ -175,6 +181,10 @@ public class FileGroup extends VimFileBase {
if (number >= 0 && number < editors.length) {
fileEditorManager.closeFile(editors[number], window);
}
if (!ApplicationManager.getApplication().isUnitTestMode()) {
// This thing doesn't have an implementation in test mode
EditorsSplitters.focusDefaultComponentInSplittersIfPresent(project);
}
}
/**

View File

@ -27,6 +27,7 @@ import com.intellij.notification.Notification
import com.intellij.notification.NotificationGroup
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.KeyboardShortcut
@ -221,6 +222,8 @@ class NotificationService(private val project: Project?) {
override fun update(e: AnActionEvent) {
e.presentation.isEnabled = id != null
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
class StopTracking : DumbAwareAction("Stop Tracking") {
@ -257,6 +260,8 @@ class NotificationService(private val project: Project?) {
val actionText = if (VimRcService.findIdeaVimRc() != null) "Open ~/.ideavimrc" else "Create ~/.ideavimrc"
e.presentation.text = actionText
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
@Suppress("DialogTitleCapitalization")

View File

@ -56,7 +56,6 @@ class UndoRedoHelper : UndoRedoBase() {
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
} else {
performUntilFileChanges(editor, { undoManager.isUndoAvailable(fileEditor) }, { undoManager.undo(fileEditor) })
}
editor?.carets()?.forEach {
val ijCaret = it.ij
@ -69,6 +68,8 @@ class UndoRedoHelper : UndoRedoBase() {
}
}
}
}
return true
}
return false
@ -85,10 +86,10 @@ class UndoRedoHelper : UndoRedoBase() {
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
} else {
performUntilFileChanges(editor, { undoManager.isRedoAvailable(fileEditor) }, { undoManager.redo(fileEditor) })
}
CommandProcessor.getInstance().runUndoTransparentAction {
editor?.carets()?.forEach { it.ij.removeSelection() }
}
}
return true
}
return false

View File

@ -19,8 +19,10 @@
package com.maddyhome.idea.vim.listener
import com.intellij.codeInsight.lookup.Lookup
import com.intellij.codeInsight.lookup.LookupManager
import com.intellij.codeInsight.lookup.LookupManagerListener
import com.intellij.codeInsight.lookup.impl.LookupImpl
import com.intellij.codeInsight.lookup.impl.actions.ChooseItemAction
import com.intellij.codeInsight.template.Template
import com.intellij.codeInsight.template.TemplateEditingAdapter
import com.intellij.codeInsight.template.TemplateManagerListener
@ -35,10 +37,10 @@ import com.intellij.openapi.actionSystem.ex.AnActionListener
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.DumbAwareToggleAction
import com.intellij.openapi.util.TextRange
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.group.NotificationService
import com.maddyhome.idea.vim.helper.EditorDataContext
import com.maddyhome.idea.vim.helper.inNormalMode
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
@ -49,6 +51,8 @@ import com.maddyhome.idea.vim.options.OptionScope
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimInt
import com.maddyhome.idea.vim.vimscript.model.options.helpers.IdeaRefactorModeHelper
import org.jetbrains.annotations.NonNls
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
/**
* @author Alex Plate
@ -60,6 +64,8 @@ object IdeaSpecifics {
private val surrounderAction =
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
private var editor: Editor? = null
private var completionPrevDocumentLength: Int? = null
private var completionPrevDocumentOffset: Int? = null
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
if (!VimPlugin.isEnabled()) return
@ -68,19 +74,52 @@ object IdeaSpecifics {
editor = hostEditor
}
//region Track action id
if (VimPlugin.getOptionService().isSet(OptionScope.GLOBAL, OptionConstants.trackactionidsName)) {
if (action !is NotificationService.ActionIdNotifier.CopyActionId && action !is NotificationService.ActionIdNotifier.StopTracking) {
val id: String? = ActionManager.getInstance().getId(action) ?: (action.shortcutSet as? ProxyShortcutSet)?.actionId
VimPlugin.getNotifications(event.dataContext.getData(CommonDataKeys.PROJECT)).notifyActionId(id)
}
if (hostEditor != null && action is ChooseItemAction && hostEditor.vimStateMachine?.isRecording == true) {
val lookup = LookupManager.getActiveLookup(hostEditor)
if (lookup != null) {
val charsToRemove = hostEditor.caretModel.primaryCaret.offset - lookup.lookupStart
val register = VimPlugin.getRegister()
val backSpace = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)
repeat(charsToRemove) {
register.recordKeyStroke(backSpace)
}
completionPrevDocumentLength = hostEditor.document.textLength - charsToRemove
completionPrevDocumentOffset = lookup.lookupStart
}
}
//endregion
}
override fun afterActionPerformed(action: AnAction, event: AnActionEvent, result: AnActionResult) {
if (!VimPlugin.isEnabled()) return
val editor = editor
if (editor != null && action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
val prevDocumentLength = completionPrevDocumentLength
val prevDocumentOffset = completionPrevDocumentOffset
if (prevDocumentLength != null && prevDocumentOffset != null) {
val register = VimPlugin.getRegister()
val addedTextLength = editor.document.textLength - prevDocumentLength
val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
repeat(caretShift.coerceAtLeast(0)) {
register.recordKeyStroke(leftArrow)
}
}
this.completionPrevDocumentLength = null
this.completionPrevDocumentOffset = null
}
//region Enter insert mode after surround with if
if (surrounderAction == action.javaClass.name && surrounderItems.any {
action.templatePresentation.text.endsWith(
@ -99,7 +138,7 @@ object IdeaSpecifics {
}
//endregion
editor = null
this.editor = null
}
}

View File

@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.ui
import com.intellij.icons.AllIcons
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.actionSystem.PlatformDataKeys
@ -144,6 +145,8 @@ class ReloadVimRc : DumbAwareAction() {
e.presentation.isEnabledAndVisible = true
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
FileDocumentManager.getInstance().saveDocumentAsIs(editor.document)

View File

@ -23,6 +23,7 @@ import com.intellij.ide.BrowserUtil
import com.intellij.ide.DataManager
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DefaultActionGroup
@ -158,6 +159,8 @@ class VimActions : DumbAwareAction() {
val project = e.project
e.presentation.isEnabledAndVisible = project != null && !project.isDisposed
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
private object VimActionsPopup {
@ -264,4 +267,6 @@ internal object JoinEap : DumbAwareAction()/*, LightEditCompatible*/ {
e.presentation.text = MessageHelper.message("action.subscribe.to.eap.text")
}
}
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}

View File

@ -18,6 +18,7 @@
package com.maddyhome.idea.vim.ui.ex
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.KeyboardShortcut
import com.intellij.openapi.project.DumbAwareAction
@ -69,4 +70,7 @@ class ExShortcutKeyAction(private val exEntryPanel: ExEntryPanel) : DumbAwareAct
registerCustomShortcutSet({ shortcuts }, exEntryPanel)
}
// / Or EDT? We access ExEntryPanel actually. But seems to work with BGT
override fun getActionUpdateThread() = ActionUpdateThread.BGT
}

View File

@ -2,7 +2,110 @@
<name>IdeaVim</name>
<id>IdeaVIM</id>
<change-notes><![CDATA[
<a href="https://github.com/JetBrains/ideavim/blob/master/CHANGES.md">Changes</a>
<h3>Features:</h3>
<ul>
<li>Add <code>gcu</code> command for Commentary plugin</li>
<li>Add <code>:Commentary</code> command, which works great for commands such as <code>:%g/fun/Commentary</code></li>
<li>Support <code>gc</code> commentary text objects. E.g. <code>dgc</code>: delete commented text.</li>
<li>Support <code>redo-register feature</code> | <a
href="https://youtrack.jetbrains.com/issue/VIM-2643/Dot-operator-doesn-t-increment-number-register-after-pasting-fro">VIM-2643</a>
| <a href="http://vimdoc.sourceforge.net/htmldoc/undo.html#redo-register">viminfo</a></li>
</ul>
<h3>Changes:</h3>
<ul>
<li>Uses the same mappings as Commentary, so custom bindings for the Vim plugin will work with IdeaVim, too.
E.g. <code>&lt;Plug&gt;Commentary</code> instead of <code>&lt;Plug&gt;(CommentMotion)</code>. Old mappings are
maintained for compatibility.
</li>
<li>If you open <code>~/.ideavimrc</code> in IDE, remove a mapping, and reload the config using the reload button,
the mapping will actually be unmapped.
</li>
<li>New vim (and IdeaVim) behaviour: <code>ci(</code>&amp; friends searches for the brackets in the line.</li>
</ul>
<h3>Fixes:</h3>
<ul>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2587">VIM-2587</a> Use ctrl-6 as ctrl-^</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2590">VIM-2590</a> Fix caret shape in PyCharm</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2553">VIM-2553</a> Substitute consecutive matches</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-1687">VIM-1687</a> Support count for <code>gcc</code></li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2381">VIM-2381</a> Fall back to line comment if block comment is
not available
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2589">VIM-2589</a> Add <code>gc</code> text object</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2604">VIM-2604</a> Update action execution rules</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2654">VIM-2654</a> Add support for <code>return</code> without
expression
</li>
<li><a
href="https://youtrack.jetbrains.com/issue/VIM-2630/Please-fix-warning-Shall-not-be-called-on-a-template-presentatio">VIM-2630</a>
Fix IDE freeze
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2661/Spamming-does-not-work">VIM-2661</a> Fix repeating the
<code>@@</code> command
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2668/tabm-or-tabm-with-no-number-does-not-match-vim-behavior">VIM-2668</a>
Fix omitted numbers in <code>tabm</code> command
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2595">VIM-2595</a> Support plugins in macro execution</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2671">VIM-2671</a> Fix using plugins from mappings</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2675">VIM-2675</a> Fix numbering register in visual mode</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-744/Use-undoredo-with-count-modifier">VIM-744</a> Add count to
undo/redo
</li>
<li><a
href="https://youtrack.jetbrains.com/issue/VIM-1862/Ex-commands-executed-in-keymaps-and-macros-are-added-to-the-command-history">VIM-1862</a>
Fix command history
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2227">VIM-2227</a> Wrong behavior when deleting / changing
surround with invalid character
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2691">VIM-2691</a> Save file on :w</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2710">VIM-2710</a> Show options value on <code>set opt</code>
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-913">VIM-913</a> Partially fix the issue with macros and
autocompletion
</li>
<li><a href="https://youtrack.jetbrains.com/issue/VIM-2723">VIM-2723</a> Move focus to editor after :q</li>
</ul>
<h3>Merged PRs:</h3>
<ul>
<li><a href="https://github.com/JetBrains/ideavim/pull/468">468</a> by <a href="https://github.com/PHPirates">Thomas
Schouten</a>: Implement UserDataHolder for EditorDataContext
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/483">483</a> by <a href="https://github.com/Vvalter">Simon
Rainer</a>: Fix(VIM-2553): Substitute consecutive matches
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/488">488</a> by <a href="https://github.com/myzeiri">Martin
Yzeiri</a>: Add Matchit support for the C family of languages
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/493">493</a> by <a href="https://github.com/citizenmatt">Matt
Ellis</a>: Improvements to Commentary extension
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/494">494</a> by <a href="https://github.com/citizenmatt">Matt
Ellis</a>: Cleanup pre-212 CaretVisualAttributes compatibility code
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/504">504</a> by <a href="https://github.com/citizenmatt">Matt
Ellis</a>: Minor bug fixes
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/519">519</a> by <a href="https://github.com/chylex">chylex</a>:
Fix(VIM-2227): Wrong behavior when deleting / changing surround with invalid character
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/525">525</a> by <a href="https://github.com/citizenmatt">Matt
Ellis</a>: Improve handling of fractional width fonts
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/526">526</a> by <a href="https://github.com/AlexPl292">Alex
Pláte</a>: Create gradle.properties
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/528">528</a> by <a href="https://github.com/chylex">chylex</a>:
Implement partial code completion support in macros
</li>
<li><a href="https://github.com/JetBrains/ideavim/pull/531">531</a> by <a href="https://github.com/citizenmatt">Matt
Ellis</a>: Consolidate doTest methods
</li>
</ul>
]]>
</change-notes>
<description><![CDATA[
@ -36,6 +139,11 @@
<depends optional="true" config-file="ides/ideavim-withAppCode.xml">com.intellij.modules.appcode</depends>
<depends optional="true" config-file="ideavim-withAceJump.xml">AceJump</depends>
<applicationListeners>
<listener class="com.maddyhome.idea.vim.PyNotebooksCloseWorkaround"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>
<application-components>
<component>
<implementation-class>com.maddyhome.idea.vim.DynamicLoaderStopper</implementation-class>

View File

@ -53,6 +53,8 @@ internal object NeovimTesting {
private lateinit var escapeCommand: String
private lateinit var ctrlcCommand: String
private var singleCaret = true
fun setUp(test: VimTestCase) {
if (!neovimEnabled(test)) return
val nvimPath = System.getenv("ideavim.nvim.path") ?: "nvim"
@ -90,25 +92,35 @@ internal object NeovimTesting {
}
}
private fun neovimEnabled(test: VimTestCase): Boolean {
private fun neovimEnabled(test: VimTestCase, editor: Editor? = null): Boolean {
val method = test.javaClass.getMethod(test.name)
val noBehaviourDiffers = !method.isAnnotationPresent(VimBehaviorDiffers::class.java)
val noTestingWithoutNeovim = !method.isAnnotationPresent(TestWithoutNeovim::class.java)
val neovimTestingEnabled = System.getProperty("ideavim.nvim.test", "false")!!.toBoolean()
val notParserTest = "org.jetbrains.plugins.ideavim.ex.parser" !in test.javaClass.packageName
val notScriptImplementation = "org.jetbrains.plugins.ideavim.ex.implementation" !in test.javaClass.packageName
return noBehaviourDiffers && noTestingWithoutNeovim && neovimTestingEnabled && notParserTest && notScriptImplementation
val notExtension = "org.jetbrains.plugins.ideavim.extension" !in test.javaClass.packageName
if (singleCaret) {
singleCaret = editor == null || editor.caretModel.caretCount == 1
}
return noBehaviourDiffers &&
noTestingWithoutNeovim &&
neovimTestingEnabled &&
notParserTest &&
notScriptImplementation &&
notExtension &&
singleCaret
}
fun setupEditor(editor: Editor, test: VimTestCase) {
if (!neovimEnabled(test)) return
if (!neovimEnabled(test, editor)) return
neovimApi.currentBuffer.get().setLines(0, -1, false, editor.document.text.split("\n")).get()
val charPosition = CharacterPosition.fromOffset(editor, editor.caretModel.offset)
neovimApi.currentWindow.get().setCursor(VimCoords(charPosition.line + 1, charPosition.column)).get()
}
fun typeCommand(keys: String, test: VimTestCase) {
if (!neovimEnabled(test)) return
fun typeCommand(keys: String, test: VimTestCase, editor: Editor) {
if (!neovimEnabled(test, editor)) return
when {
keys.equals("<esc>", ignoreCase = true) -> neovimApi.input(escapeCommand).get()
keys.equals("<C-C>", ignoreCase = true) -> neovimApi.input(ctrlcCommand).get()
@ -120,7 +132,7 @@ internal object NeovimTesting {
}
fun assertState(editor: Editor, test: VimTestCase) {
if (!neovimEnabled(test)) return
if (!neovimEnabled(test, editor)) return
if (currentTestName != "") {
currentTestName = ""
neovimTestsCounter++
@ -140,7 +152,7 @@ internal object NeovimTesting {
private fun getText(): String = neovimApi.currentBuffer.get().getLines(0, -1, false).get().joinToString("\n")
fun assertCaret(editor: Editor, test: VimTestCase) {
if (!neovimEnabled(test)) return
if (!neovimEnabled(test, editor)) return
if (currentTestName != "") {
currentTestName = ""
neovimTestsCounter++
@ -200,7 +212,6 @@ annotation class TestWithoutNeovim(val reason: SkipNeovimReason, val description
enum class SkipNeovimReason {
PLUGIN,
MULTICARET,
@Suppress("unused")
INLAYS,
@ -221,7 +232,6 @@ enum class SkipNeovimReason {
EDITOR_MODIFICATION,
CMD,
IDEAVIMRC,
ACTION_COMMAND,
PLUG,
FOLDING,

View File

@ -20,7 +20,6 @@ package org.jetbrains.plugins.ideavim
import com.maddyhome.idea.vim.RegisterActions.VIM_ACTIONS_EP
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.handler.ActionBeanClass
@ -42,10 +41,9 @@ class RegisterActionsTest : VimTestCase() {
setupChecks {
caretShape = false
}
val keys = injector.parser.parseKeys("jklwB") // just random keys
val before = "I ${c}found it in a legendary land"
val after = "I jklwB${c}found it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("jklwB", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
VimPlugin.setEnabled(false)
}
} finally {
@ -55,10 +53,9 @@ class RegisterActionsTest : VimTestCase() {
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test turn plugin off and on`() {
val keys = injector.parser.parseKeys("l")
val before = "I ${c}found it in a legendary land"
val after = "I f${c}ound it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("l", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
VimPlugin.setEnabled(false)
VimPlugin.setEnabled(true)
}
@ -66,10 +63,9 @@ class RegisterActionsTest : VimTestCase() {
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test enable twice`() {
val keys = injector.parser.parseKeys("l")
val before = "I ${c}found it in a legendary land"
val after = "I f${c}ound it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("l", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
VimPlugin.setEnabled(false)
VimPlugin.setEnabled(true)
VimPlugin.setEnabled(true)
@ -78,11 +74,10 @@ class RegisterActionsTest : VimTestCase() {
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test unregister extension`() {
val keys = injector.parser.parseKeys("l")
val before = "I ${c}found it in a legendary land"
val after = "I f${c}ound it in a legendary land"
var motionRightAction: ActionBeanClass? = null
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("l", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
motionRightAction = VIM_ACTIONS_EP.extensions().filter { it.actionId == "VimPreviousTabAction" }.findFirst().get()
assertNotNull(getCommandNode())

View File

@ -229,6 +229,7 @@ abstract class VimTestCase : UsefulTestCase() {
private fun configureByText(fileName: String, content: String): Editor {
@Suppress("IdeaVimAssertState")
myFixture.configureByText(fileName, content)
NeovimTesting.setupEditor(myFixture.editor, this)
setEditorVisibleSize(screenWidth, screenHeight)
return myFixture.editor
}
@ -236,6 +237,7 @@ abstract class VimTestCase : UsefulTestCase() {
protected fun configureByFileName(fileName: String): Editor {
@Suppress("IdeaVimAssertState")
myFixture.configureByText(fileName, "\n")
NeovimTesting.setupEditor(myFixture.editor, this)
setEditorVisibleSize(screenWidth, screenHeight)
return myFixture.editor
}
@ -298,8 +300,12 @@ abstract class VimTestCase : UsefulTestCase() {
}
protected fun typeText(keys: List<KeyStroke?>): Editor {
NeovimTesting.typeCommand(keys.filterNotNull().joinToString(separator = "") { injector.parser.toKeyNotation(it) }, this)
val editor = myFixture.editor
NeovimTesting.typeCommand(
keys.filterNotNull().joinToString(separator = "") { injector.parser.toKeyNotation(it) },
this,
editor
)
val project = myFixture.project
when (Checks.keyHandler) {
Checks.KeyHandlerMethod.DIRECT_TO_VIM -> typeText(keys, editor, project)
@ -328,6 +334,12 @@ abstract class VimTestCase : UsefulTestCase() {
NeovimTesting.assertState(myFixture.editor, this)
}
protected fun assertState(modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
assertMode(modeAfter)
assertSubMode(subModeAfter)
assertCaretsVisualAttributes()
}
fun assertPosition(line: Int, column: Int) {
val carets = myFixture.editor.caretModel.allCarets
Assert.assertEquals("Wrong amount of carets", 1, carets.size)
@ -459,7 +471,7 @@ abstract class VimTestCase : UsefulTestCase() {
val actual = getInstance(myFixture.editor).text
Assert.assertNotNull("No Ex output", actual)
Assert.assertEquals(expected, actual)
NeovimTesting.typeCommand("<esc>", this)
NeovimTesting.typeCommand("<esc>", this, myFixture.editor)
}
fun assertNoExOutput() {
@ -501,95 +513,46 @@ abstract class VimTestCase : UsefulTestCase() {
}
}
@JvmOverloads
fun doTest(
keys: List<String>,
before: String,
after: String,
modeAfter: VimStateMachine.Mode = VimStateMachine.Mode.COMMAND,
subModeAfter: SubMode = SubMode.NONE,
fileType: FileType? = null,
fileName: String? = null,
afterEditorInitialized: ((Editor) -> Unit)? = null,
) {
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, SubMode.NONE)
}
fun doTest(
keys: List<String>,
before: String,
after: String,
modeAfter: VimStateMachine.Mode,
subModeAfter: SubMode,
) {
doTest(keys.joinToString(separator = ""), before, after, modeAfter, subModeAfter)
doTest(keys.joinToString(separator = ""), before, after, modeAfter, subModeAfter, fileType, fileName, afterEditorInitialized)
}
@JvmOverloads
fun doTest(
keys: String,
before: String,
after: String,
modeAfter: VimStateMachine.Mode,
subModeAfter: SubMode,
) {
configureByText(before)
performTest(keys, after, modeAfter, subModeAfter)
NeovimTesting.assertState(myFixture.editor, this)
}
fun doTest(
keys: String,
before: String,
after: String,
modeAfter: VimStateMachine.Mode,
subModeAfter: SubMode,
fileType: FileType,
) {
configureByText(fileType, before)
NeovimTesting.setupEditor(myFixture.editor, this)
NeovimTesting.typeCommand(keys, this)
performTest(keys, after, modeAfter, subModeAfter)
NeovimTesting.assertState(myFixture.editor, this)
}
fun doTest(
keys: String,
before: String,
after: String,
modeAfter: VimStateMachine.Mode,
subModeAfter: SubMode,
fileName: String,
modeAfter: VimStateMachine.Mode = VimStateMachine.Mode.COMMAND,
subModeAfter: SubMode = SubMode.NONE,
fileType: FileType? = null,
fileName: String? = null,
afterEditorInitialized: ((Editor) -> Unit)? = null,
) {
if (fileName != null) {
configureByText(fileName, before)
NeovimTesting.setupEditor(myFixture.editor, this)
NeovimTesting.typeCommand(keys, this)
} else if (fileType != null) {
configureByText(fileType, before)
} else {
configureByText(before)
}
afterEditorInitialized?.invoke(myFixture.editor)
performTest(keys, after, modeAfter, subModeAfter)
NeovimTesting.assertState(myFixture.editor, this)
}
protected fun performTest(keys: String, after: String, modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
typeText(injector.parser.parseKeys(keys))
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
@Suppress("IdeaVimAssertState")
myFixture.checkResult(after)
assertState(modeAfter, subModeAfter)
}
fun doTest(
keys: List<KeyStroke>,
before: String,
after: String?,
modeAfter: VimStateMachine.Mode,
subModeAfter: SubMode,
afterEditorInitialized: (Editor) -> Unit,
) {
configureByText(before)
afterEditorInitialized(myFixture.editor)
typeText(keys)
@Suppress("IdeaVimAssertState")
myFixture.checkResult(after!!)
assertState(after)
assertState(modeAfter, subModeAfter)
}
@ -598,12 +561,6 @@ abstract class VimTestCase : UsefulTestCase() {
NeovimTesting.setRegister(register, keys, this)
}
protected fun assertState(modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
assertMode(modeAfter)
assertSubMode(subModeAfter)
assertCaretsVisualAttributes()
}
protected val fileManager: FileEditorManagerEx
get() = FileEditorManagerEx.getInstanceEx(myFixture.project)

View File

@ -131,7 +131,6 @@ class RepeatChangeActionTest : VimTestCase() {
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test multicaret`() {
val keys = listOf("v2erXj^", ".")
val before = """

View File

@ -41,7 +41,8 @@ class UndoActionTest : VimTestCase() {
assertFalse(editor.caretModel.primaryCaret.hasSelection())
}
fun `test undo after selection`() {
// Not yet supported
fun `undo after selection`() {
val keys = listOf("v3eld", "u")
val before = """
A Discovery

View File

@ -23,8 +23,6 @@ package org.jetbrains.plugins.ideavim.action.change.change
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class ChangeVisualActionTest : VimTestCase() {
@ -155,7 +153,6 @@ class ChangeVisualActionTest : VimTestCase() {
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test change visual action`() {
typeTextInFile(
injector.parser.parseKeys("v2lc" + "aaa" + "<ESC>"),

View File

@ -0,0 +1,46 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2022 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jetbrains.plugins.ideavim.action.change.change
//class InsertRegisterTest : VimTestCase() {
// todo test cursor position VIM-2732
// fun `test multiline insert from expression register`() {
// val keys = "VjyGo<C-r>=@\"<CR>"
// val before = """
// A Discovery
//
// ${c}I found it in a legendary land
// all rocks and lavender and tufted grass,
// where it was settled on some sodden sand
// hard by the torrent of a mountain pass.
// """.trimIndent()
// val after = """
// A Discovery
//
// I found it in a legendary land
// all rocks and lavender and tufted grass,
// where it was settled on some sodden sand
// hard by the torrent of a mountain pass.
// I found it in a legendary land
// all rocks and lavender and tufted grass,
// ${c}
// """.trimIndent()
// doTest(keys, before, after, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
// }
//}

View File

@ -20,8 +20,6 @@ package org.jetbrains.plugins.ideavim.action.change.change.number
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
/**
@ -114,7 +112,6 @@ class ChangeVisualNumberDecActionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test change number dec visual action`() {
typeTextInFile(
injector.parser.parseKeys("Vj<C-X>"),

View File

@ -20,8 +20,6 @@ package org.jetbrains.plugins.ideavim.action.change.change.number
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
/**
@ -114,7 +112,6 @@ class ChangeVisualNumberIncActionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test change number inc visual multiple cursor`() {
typeTextInFile(
injector.parser.parseKeys("Vj<C-A>"),

View File

@ -92,7 +92,6 @@ class DeleteMotionActionTest : VimTestCase() {
assertEquals(" expression two\n", savedText)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test delete line action multicaret`() {
typeTextInFile(
injector.parser.parseKeys("d3d"),
@ -110,7 +109,6 @@ class DeleteMotionActionTest : VimTestCase() {
assertState("${c}abcde\n${c}")
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test delete motion action multicaret`() {
typeTextInFile(
injector.parser.parseKeys("dt)"),

View File

@ -20,12 +20,9 @@ package org.jetbrains.plugins.ideavim.action.change.insert
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class InsertAfterLineEndActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert after line end action`() {
typeTextInFile(
injector.parser.parseKeys("A" + " four" + "<ESC>"),
@ -44,7 +41,6 @@ class InsertAfterLineEndActionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test multiple carets`() {
doTest(
"AHello<esc>",

View File

@ -19,12 +19,9 @@
package org.jetbrains.plugins.ideavim.action.change.insert
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class InsertBeforeFirstNonBlankActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert multiple carets`() {
doTest(
"IHello<esc>",

View File

@ -23,8 +23,6 @@ package org.jetbrains.plugins.ideavim.action.change.insert
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class InsertDeletePreviousWordActionTest : VimTestCase() {
@ -146,7 +144,6 @@ class InsertDeletePreviousWordActionTest : VimTestCase() {
assertState("hello\n" + "one two \n")
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert delete previous word action`() {
typeTextInFile(
injector.parser.parseKeys("i" + "<C-W>" + "<ESC>"),

View File

@ -99,7 +99,6 @@ class InsertNewLineAboveActionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert new line above with multiple carets`() {
val before = """ I fou${c}nd it in a legendary land
| all rocks and laven${c}der and tufted grass,

View File

@ -117,7 +117,6 @@ class InsertNewLineBelowActionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert new line below with multiple carets`() {
val before = """ I fou${c}nd it in a legendary land
| all rocks and laven${c}der and tufted grass,
@ -190,6 +189,7 @@ class InsertNewLineBelowActionTest : VimTestCase() {
performTest("o", after, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.FOLDING, "Neovim doesn't support arbitrary folds")
fun `test insert new line below with folds 2`() {
val before = """I found it in a legendary land
|${c}all rocks [and lavender and tufted grass,

View File

@ -28,7 +28,6 @@ import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class InsertTabActionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test insert tab`() {
setupChecks {
keyHandler = Checks.KeyHandlerMethod.DIRECT_TO_VIM

View File

@ -57,7 +57,6 @@ class VisualBlockAppendActionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test append in non block mode`() {
doTest(
"vwAHello<esc>",

View File

@ -73,9 +73,7 @@ Xbar
ba_quux_r
""".trimIndent(),
VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE
""".trimIndent()
)
}
@ -97,9 +95,7 @@ Xbar
quux spam eggs
""".trimIndent()
),
VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE
)
)
}
@ -136,9 +132,7 @@ Xbar
ba_quux_r
""".trimIndent()
),
VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE
)
)
}
@ -162,10 +156,7 @@ Xbar
where it was settled on some sodden sand
hard by the torrent of a mountain pass.
""".trimIndent(),
VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE
)
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)
@ -179,7 +170,7 @@ Xbar
hard by the torrent of a mountain pass.
"""
doTest(
injector.parser.parseKeys("<C-V>" + "jjI" + " Hello " + "<ESC>"),
listOf("<C-V>" + "jjI" + " Hello " + "<ESC>"),
before.trimIndent(),
"""
A Discovery
@ -189,14 +180,11 @@ Xbar
where it was s Hello ettled on some sodden sand
hard by the torrent of a mountain pass.
""".trimIndent(),
VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE
) {
it.inlayModel.addInlineElement(before.indexOf("found"), HintRenderer("Hello"))
it.inlayModel.addInlineElement(before.indexOf("l rocks"), HintRenderer("Hello"))
it.inlayModel.addInlineElement(before.indexOf("ere it"), HintRenderer("Hello"))
}
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)

View File

@ -24,8 +24,6 @@ import com.maddyhome.idea.vim.command.SelectionType
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
import org.junit.Test
@ -78,7 +76,6 @@ class PutTestAfterCursorActionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
@Test
fun `test inserting same content to multiple carets`() {
val before = """

View File

@ -19,13 +19,10 @@
package org.jetbrains.plugins.ideavim.action.motion.search
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.common.Direction
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import javax.swing.KeyStroke
class SearchAgainPreviousActionTest : VimTestCase() {
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
@ -36,14 +33,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
...${c}all it was settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
val keys = injector.parser.parseKeys("N")
val after = """
I found it in a legendary land
...${c}all rocks and lavender and tufted grass,
...all it was settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
doTestWithSearch(keys, before, after)
doTestWithSearch("N", before, after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
@ -54,14 +50,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
...all it was .${c}all settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
val keys = injector.parser.parseKeys("N")
val after = """
I found it in a legendary land
...all rocks and lavender and tufted grass,
...${c}all it was .all settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
doTestWithSearch(keys, before, after)
doTestWithSearch("N", before, after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
@ -72,14 +67,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
...all it was .all.${c}all settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
val keys = injector.parser.parseKeys("N")
val after = """
I found it in a legendary land
...all rocks and lavender and tufted grass,
...all it was .${c}all.all settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
doTestWithSearch(keys, before, after)
doTestWithSearch("N", before, after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
@ -90,14 +84,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
...all it was settled on some sodden sand
...all by the torrent of a mountain pass
""".trimIndent().dotToTab()
val keys = injector.parser.parseKeys("N")
val after = """
I found it in a legendary land
...all rocks and lavender and tufted grass,
...all it was settled on some sodden sand
...${c}all by the torrent of a mountain pass
""".trimIndent().dotToTab()
doTestWithSearch(keys, before, after)
doTestWithSearch("N", before, after)
}
fun `test search previous after search command with offset`() {
@ -174,8 +167,8 @@ class SearchAgainPreviousActionTest : VimTestCase() {
doTest(listOf(searchCommand("/land/1"), exCommand("s/and/or"), "G", "N"), before, after)
}
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
private fun doTestWithSearch(keys: String, before: String, after: String) {
doTest(keys, before, after) {
VimPlugin.getSearch().setLastSearchState(it, "all", "", Direction.FORWARDS)
}
}

View File

@ -18,8 +18,6 @@
package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.vimLastColumn
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
@ -36,12 +34,11 @@ class MotionUpActionTest : VimTestCase() {
I found it in a le${c}gendary land
all rocks and lavender and tufted grass,
""".trimIndent()
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
doTest(keys, before, after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test last column is incorrect`() {
val keys = injector.parser.parseKeys("k")
val before = """
I found it in a legendary land
all rocks and lave${c}nder and tufted grass,
@ -50,7 +47,7 @@ class MotionUpActionTest : VimTestCase() {
I found it in a le${c}gendary land
all rocks and lavender and tufted grass,
""".trimIndent()
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("k", before, after) {
it.caretModel.primaryCaret.vimLastColumn = 5
}
}
@ -69,12 +66,11 @@ class MotionUpActionTest : VimTestCase() {
I found it in a legendary land
all rocks and lavender and tufted ${c}grass,
""".trimIndent()
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
doTest(keys, before, after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test last column wrong lastColumn`() {
val keys = injector.parser.parseKeys("k")
val before = """
I found it in a legendary land
all rocks and lavender and tufted ${c}grass,
@ -83,7 +79,7 @@ class MotionUpActionTest : VimTestCase() {
I found it in a legendary lan${c}d
all rocks and lavender and tufted grass,
""".trimIndent()
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest("k", before, after) {
it.caretModel.primaryCaret.vimLastColumn = 0
}
}

View File

@ -28,8 +28,6 @@ import com.maddyhome.idea.vim.helper.vimSelectionStart
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.options.OptionScope
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
@ -230,7 +228,6 @@ class VisualToggleCharacterModeActionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test enter visual with count after visual operation multicaret`() {
doTest(
listOf("vedx", "1v"),

View File

@ -54,20 +54,18 @@ class CommandParserTest : VimTestCase() {
setupChecks {
caretShape = false
}
val keys = commandToKeys(">>")
val before = "I ${c}found it in a legendary land"
val after = "I :>>${c}found it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest(exCommand(">>"), before, after) {
VimPlugin.setEnabled(false)
}
}
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test turn off and on`() {
val keys = commandToKeys(">>")
val before = "I ${c}found it in a legendary land"
val after = " ${c}I found it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest(exCommand(">>"), before, after) {
VimPlugin.setEnabled(false)
VimPlugin.setEnabled(true)
}
@ -75,10 +73,9 @@ class CommandParserTest : VimTestCase() {
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
fun `test turn off and on twice`() {
val keys = commandToKeys(">>")
val before = "I ${c}found it in a legendary land"
val after = " ${c}I found it in a legendary land"
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
doTest(exCommand(">>"), before, after) {
VimPlugin.setEnabled(false)
VimPlugin.setEnabled(true)
VimPlugin.setEnabled(true)

View File

@ -68,7 +68,6 @@ class MultipleCaretsTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testJoinLines() {
val before = "qwe\n" + "r${c}ty\n" + "asd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
configureByText(before)
@ -86,7 +85,6 @@ class MultipleCaretsTest : VimTestCase() {
// myFixture.checkResult(after)
// }
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testCopyText() {
val before = "qwe\n" + "rty\n" + "a${c}sd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
configureByText(before)
@ -104,7 +102,6 @@ class MultipleCaretsTest : VimTestCase() {
// myFixture.checkResult(after)
// }
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testPutText() {
// This test produces double ${c}zxc on 3rd line if non-idea paste is used
val before = """
@ -173,7 +170,6 @@ class MultipleCaretsTest : VimTestCase() {
// myFixture.checkResult(after)
// }
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testMoveTextBeforeCarets() {
val before = "qwe\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "z${c}xc\n" + "vbn\n"
configureByText(before)
@ -182,7 +178,6 @@ class MultipleCaretsTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testMoveTextAfterCarets() {
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
configureByText(before)
@ -191,7 +186,6 @@ class MultipleCaretsTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testMoveTextBetweenCarets() {
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
configureByText(before)
@ -200,7 +194,6 @@ class MultipleCaretsTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testYankLines() {
val before = """qwe
|rt${c}y
@ -230,7 +223,6 @@ class MultipleCaretsTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun testDeleteLines() {
val before = """qwe
|r${c}ty

View File

@ -19,6 +19,7 @@
package org.jetbrains.plugins.ideavim.ex.implementation.commands
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import org.jetbrains.plugins.ideavim.VimTestCase
/**
@ -130,6 +131,22 @@ class CmdCommandTest : VimTestCase() {
assertPluginError(false)
}
fun `test add command with range`() {
VimPlugin.getCommand().resetAliases()
configureByText("\n")
typeText(commandToKeys("command! -range Error echo <args>"))
assertPluginError(false)
assertEquals("'-range' is not supported by `command`", injector.messages.getStatusBarMessage())
}
fun `test add command with complete`() {
VimPlugin.getCommand().resetAliases()
configureByText("\n")
typeText(commandToKeys("command! -complete=color Error echo <args>"))
assertPluginError(false)
assertEquals("'-complete' is not supported by `command`", injector.messages.getStatusBarMessage())
}
fun `test add command with arguments short`() {
VimPlugin.getCommand().resetAliases()
configureByText("\n")

View File

@ -21,8 +21,6 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class JoinLinesCommandTest : VimTestCase() {
@ -97,7 +95,6 @@ class JoinLinesCommandTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test join multicaret`() {
configureByText(
"""

View File

@ -102,7 +102,6 @@ class ShiftLeftCommandTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test multiple carets`() {
val before = """ I found it in a legendary land
|${c}all rocks and lavender and tufted grass,

View File

@ -83,7 +83,6 @@ class ShiftRightCommandTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
fun `test multiple carets`() {
val before = """ I found it in a legendary land
|${c}all rocks and lavender and tufted grass,

View File

@ -0,0 +1,33 @@
/*
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
* Copyright (C) 2003-2022 The IdeaVim authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jetbrains.plugins.ideavim.ex.implementation.expressions
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.vimscript.model.expressions.Register
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.ex.evaluate
class ExpressionTest: VimTestCase() {
fun `test multiline register content`() {
configureByText("${c}Oh\nHi\nMark\n")
typeText(parseKeys("VGy"))
assertEquals("Oh\nHi\nMark\n", Register('"').evaluate().toString())
}
}

View File

@ -41,8 +41,6 @@ import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionScope
import junit.framework.TestCase
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class OpMappingTest : VimTestCase() {
@ -68,7 +66,6 @@ class OpMappingTest : VimTestCase() {
super.tearDown()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test simple delete`() {
doTest(
"dI",
@ -79,7 +76,6 @@ class OpMappingTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test simple delete backwards`() {
doTest(
"dP",
@ -90,7 +86,6 @@ class OpMappingTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test delete emulate inclusive`() {
doTest(
"dU",
@ -101,7 +96,6 @@ class OpMappingTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test linewise delete`() {
doTest(
"dO",
@ -124,7 +118,6 @@ class OpMappingTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test disable extension via set`() {
configureByText("${c}I found it in a legendary land")
typeText(injector.parser.parseKeys("Q"))
@ -139,7 +132,6 @@ class OpMappingTest : VimTestCase() {
assertState("I ${c}found it in a legendary land")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test disable extension as extension point`() {
configureByText("${c}I found it in a legendary land")
typeText(injector.parser.parseKeys("Q"))
@ -158,7 +150,6 @@ class OpMappingTest : VimTestCase() {
assertState("I ${c}found it in a legendary land")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test disable disposed extension`() {
configureByText("${c}I found it in a legendary land")
typeText(injector.parser.parseKeys("Q"))
@ -176,7 +167,6 @@ class OpMappingTest : VimTestCase() {
assertState("I ${c}found it in a legendary land")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test delayed action`() {
configureByText("${c}I found it in a legendary land")
typeText(injector.parser.parseKeys("R"))
@ -191,7 +181,6 @@ class OpMappingTest : VimTestCase() {
/**
* This test tests an intentionally incorrectly implemented action
*/
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test delayed incorrect action`() {
configureByText("${c}I found it in a legendary land")
typeText(injector.parser.parseKeys("E"))
@ -221,21 +210,18 @@ class PlugExtensionsTest : VimTestCase() {
super.tearDown()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test enable via plug`() {
injector.vimscriptExecutor.execute("Plug 'MyTest'", false)
assertTrue(extension.ext.initialized)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test enable via plugin`() {
injector.vimscriptExecutor.execute("Plugin 'MyTest'", false)
assertTrue(extension.ext.initialized)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test enable via plug and disable via set`() {
injector.vimscriptExecutor.execute("Plug 'MyTest'")
injector.vimscriptExecutor.execute("set noTestExtension")
@ -261,7 +247,6 @@ class PlugMissingKeysTest : VimTestCase() {
super.tearDown()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test missing keys`() {
executeLikeVimrc(
"map myKey <Plug>TestMissing",
@ -277,7 +262,6 @@ class PlugMissingKeysTest : VimTestCase() {
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test missing keys enable plugin first`() {
executeLikeVimrc(
"Plug 'MyTest'",
@ -293,7 +277,6 @@ class PlugMissingKeysTest : VimTestCase() {
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test packadd`() {
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
executeLikeVimrc(
@ -303,7 +286,6 @@ class PlugMissingKeysTest : VimTestCase() {
assertTrue(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test packadd ex`() {
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
executeLikeVimrc(

View File

@ -22,8 +22,6 @@ import com.google.common.collect.Lists;
import com.maddyhome.idea.vim.api.VimInjectorKt;
import com.maddyhome.idea.vim.command.VimStateMachine;
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers;
import org.jetbrains.plugins.ideavim.SkipNeovimReason;
import org.jetbrains.plugins.ideavim.TestWithoutNeovim;
import org.jetbrains.plugins.ideavim.VimTestCase;
import java.util.Collections;
@ -41,7 +39,7 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimInjectorKt.getInjector().getVimscriptExecutor().execute("let argtextobj_pairs='" + value + "'", true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testDeleteAnArgument() {
doTest(Lists.newArrayList("daa"), "function(int arg1, char<caret>* arg2=\"a,b,c(d,e)\")",
"function(int arg1<caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -49,13 +47,11 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testChangeInnerArgument() {
doTest(Lists.newArrayList("cia"), "function(int arg1, char<caret>* arg2=\"a,b,c(d,e)\")",
"function(int arg1, <caret>)", VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testSmartArgumentRecognition() {
doTest(Lists.newArrayList("dia"), "function(1, (20<caret>*30)+40, somefunc2(3, 4))",
"function(1, <caret>, somefunc2(3, 4))", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -63,7 +59,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
"function(1, (20*30)+40, somefunc2(<caret>4))", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testIgnoreQuotedArguments() {
doTest(Lists.newArrayList("daa"), "function(int arg1, char* arg2=a,b,c(<caret>arg,e))",
"function(int arg1, char* arg2=a,b,c(<caret>e))", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -75,7 +70,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
"function(int arg1<caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testDeleteTwoArguments() {
doTest(Lists.newArrayList("d2aa"), "function(int <caret>arg1, char* arg2=\"a,b,c(d,e)\")", "function(<caret>)",
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -91,7 +85,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
"function(int arg1, <caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testSelectTwoArguments() {
doTest(Lists.newArrayList("v2aa"), "function(int <caret>arg1, char* arg2=\"a,b,c(d,e)\", bool arg3)",
"function(<selection>int arg1, char* arg2=\"a,b,c(d,e)\", </selection>bool arg3)",
@ -101,14 +94,12 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testArgumentsInsideAngleBrackets() {
setArgTextObjPairsVariable("(:),<:>");
doTest(Lists.newArrayList("dia"), "std::vector<int, std::unique_p<caret>tr<bool>> v{};",
"std::vector<int, <caret>> v{};", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testWhenUnbalancedHigherPriorityPairIsUsed() {
setArgTextObjPairsVariable("{:},(:)");
doTest(Lists.newArrayList("dia"), "namespace foo { void foo(int arg1, bool arg2<caret> { body }\n}",
@ -117,7 +108,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
"namespace foo { <caret>, bool arg2 { body }\n}", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testBracketPriorityToHangleShiftOperators() {
doTest(Lists.newArrayList("dia"), "foo(30 << 10, 20 << <caret>3) >> 17", "foo(30 << 10, <caret>) >> 17",
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -127,7 +117,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testEmptyFile() {
assertPluginError(false);
doTest(Lists.newArrayList("daa"), "<caret>", "<caret>", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -136,7 +125,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testEmptyLine() {
assertPluginError(false);
doTest(Lists.newArrayList("daa"), "<caret>\n", "<caret>\n", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -145,7 +133,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testEmptyArg() {
assertPluginError(false);
doTest(Lists.newArrayList("daa"), "foo(<caret>)", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
@ -156,7 +143,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testSkipCommasInsideNestedPairs() {
final String before =
"void foo(int arg1)\n{" + " methodCall(arg1, \"{ arg1 , 2\");\n" + " otherMeth<caret>odcall(arg, 3);\n" + "}";
@ -164,19 +150,16 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testHandleNestedPairs() {
doTest(Lists.newArrayList("dia"), "foo(arg1, arr<caret>ay[someexpr(Class{arg1 << 3, arg2})] + 3)\n{",
"foo(arg1, <caret>)\n{", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testHandleNestedParenthesisForASingleArgument() {
doTest(Lists.newArrayList("dia"), "foo((20*<caret>30))", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testHandleImbalancedPairs() {
doTest(Lists.newArrayList("dia"), "foo(arg1, ba<caret>r(not-an-arg{body", "foo(arg1, ba<caret>r(not-an-arg{body",
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
@ -192,14 +175,12 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testArgumentBoundsSearchIsLimitedByLineCount() {
final String before = "foo(\n" + String.join("", Collections.nCopies(10, " arg,\n")) + " last<caret>Arg" + ")";
doTest(Lists.newArrayList("dia"), before, before, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
assertPluginError(true);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testExtendVisualSelection() {
doTest(Lists.newArrayList("vllia"), "function(int arg1, ch<caret>ar* arg2=\"a,b,c(d,e)\")",
"function(int arg1, <selection>char* arg2=\"a,b,c(d,e)\"</selection>)", VimStateMachine.Mode.VISUAL,
@ -209,13 +190,11 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.SubMode.VISUAL_CHARACTER);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testExtendVisualSelectionUsesCaretPos() {
doTest(Lists.newArrayList("vllia"), "fu<caret>n(arg)", "fun(<selection>arg</selection>)", VimStateMachine.Mode.VISUAL,
VimStateMachine.SubMode.VISUAL_CHARACTER);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testDeleteArrayArgument() {
setArgTextObjPairsVariable("[:],(:)");
doTest(Lists.newArrayList("dia"), "function(int a, String[<caret>] b)", "function(int a, <caret>)",
@ -224,7 +203,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testDeleteInClass() {
doTest(Lists.newArrayList("dia"), "class MyClass{ public int myFun() { some<caret>Call(); } }",
"class MyClass{ public int myFun() { some<caret>Call(); } }", VimStateMachine.Mode.COMMAND,
@ -234,7 +212,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testFunctionWithSpaceAfterName() {
doTest(Lists.newArrayList("dia"), "function (int <caret>a)", "function (int <caret>a)", VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE);
@ -243,7 +220,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
}
@VimBehaviorDiffers(originalVimAfter = "function (int <caret>a, int b)", description = "Should work the same as testFunctionWithSpaceAfterName")
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testFunctionWithSpaceAfterNameWithTwoArgs() {
doTest(Lists.newArrayList("dia"), "function (int <caret>a, int b)", "function (, int b)", VimStateMachine.Mode.COMMAND,
VimStateMachine.SubMode.NONE);
@ -251,7 +227,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testDeleteInIf() {
doTest(Lists.newArrayList("dia"), "class MyClass{ public int myFun() { if (tr<caret>ue) { somFunction(); } } }",
"class MyClass{ public int myFun() { if (tr<caret>ue) { somFunction(); } } }", VimStateMachine.Mode.COMMAND,
@ -261,7 +236,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
VimStateMachine.SubMode.NONE);
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testParseVariablePairs() {
assertPluginError(false);
setArgTextObjPairsVariable("[:], (:)");
@ -306,7 +280,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
public void testCppLambaArguments() {
setArgTextObjPairsVariable("[:],(:),{:},<:>");
doTest(Lists.newArrayList("daa"),

View File

@ -22,21 +22,17 @@ import com.intellij.ide.highlighter.HtmlFileType
import com.intellij.ide.highlighter.JavaFileType
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.yaml.YAMLFileType
@Suppress("SpellCheckingInspection")
class CommentaryExtensionTest : VimTestCase() {
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
override fun setUp() {
super.setUp()
enableExtensions("commentary")
}
// |gc| |l| + move caret
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testBlockCommentSingle() {
doTest(
"gcll",
@ -48,7 +44,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |iw|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testBlockCommentInnerWord() {
doTest(
"gciw",
@ -60,7 +55,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |iw|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testBlockCommentTillForward() {
doTest(
"gct{",
@ -71,7 +65,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |ab|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testBlockCommentOuterParens() {
doTest(
"gcab",
@ -86,7 +79,6 @@ class CommentaryExtensionTest : VimTestCase() {
* otherwise, they are incredibly difficult to undo
*/
// |gc| |j|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentDown() {
doTest(
"gcj",
@ -97,7 +89,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentDownPreservesAbsoluteCaretLocation() {
doTest(
"gcj",
@ -109,7 +100,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentInnerParagraph() {
doTest(
"gcip",
@ -121,7 +111,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentSingleLineInnerParagraph() {
doTest(
"gcip",
@ -132,7 +121,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
/* Ensure uncommenting works as well */ // |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineUncommentInnerParagraph() {
doTest(
"gcip",
@ -145,7 +133,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineUncommentSingleLineInnerParagraph() {
doTest(
"gcip",
@ -156,7 +143,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
/* Visual mode */ // |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentVisualInnerParagraph() {
doTest(
"vipgc",
@ -168,7 +154,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gc| |ip|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineUncommentVisualInnerParagraph() {
doTest(
"vipgc",
@ -180,7 +165,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
/* Special shortcut gcc is always linewise */ // |gcc|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentShortcut() {
doTest(
"gccj",
@ -193,7 +177,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gcc|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineCommentShortcutSetsCaretToMotionLocation() {
doTest(
"gcc",
@ -205,7 +188,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gcc|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testLineUncommentShortcut() {
doTest(
"gcc",
@ -218,7 +200,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
// |gcc|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testHTMLCommentShortcut() {
doTest(
"gcc",
@ -231,7 +212,6 @@ class CommentaryExtensionTest : VimTestCase() {
assertSelection(null)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test comment motion repeat`() {
doTest(
"gcj" + "jj.",
@ -251,7 +231,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test comment motion right repeat`() {
doTest(
"gciw" + "jj.",
@ -271,7 +250,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test comment line repeat`() {
doTest(
"gcc" + "j.",
@ -288,7 +266,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test uncomment with gcgc`() {
doTest(
"gcgc",
@ -309,7 +286,6 @@ class CommentaryExtensionTest : VimTestCase() {
}
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test uncomment with gcu`() {
doTest(
"gcu",
@ -329,7 +305,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test comment line with count`() {
// Caret position is kept as the position *before* the commenting. This is how Vim works
doTest(
@ -354,7 +329,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment`() {
doTest(
"dgc",
@ -369,7 +343,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes multiple line comments`() {
doTest(
"dgc",
@ -388,7 +361,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes multiple line comments 2`() {
doTest(
"dgc",
@ -407,7 +379,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from leading whitespace`() {
doTest(
"dgc",
@ -422,7 +393,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from leading whitespace 2`() {
doTest(
"dgc",
@ -439,7 +409,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from leading whitespace 3`() {
doTest(
"dgc",
@ -458,7 +427,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from trailing whitespace`() {
doTest(
"dgc",
@ -476,7 +444,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comments separated by whitespace`() {
doTest(
"dgc",
@ -493,7 +460,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes disjointed single line comments from whitespace`() {
doTest(
"dgc",
@ -515,7 +481,6 @@ class CommentaryExtensionTest : VimTestCase() {
final Int value = 42;
"""
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from current line`() {
doTest(
"dgc",
@ -531,7 +496,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes single line comment from current line 2`() {
doTest(
"dgc",
@ -548,7 +512,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object does not delete line with comment and text`() {
doTest(
"dgc",
@ -562,7 +525,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes block comment`() {
doTest(
"dgc",
@ -577,7 +539,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes multi-line block comment`() {
doTest(
"dgc",
@ -594,7 +555,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes adjoining multi-line block comments`() {
doTest(
"dgc",
@ -614,7 +574,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes adjoining multi-line block comments 2`() {
doTest(
"dgc",
@ -635,7 +594,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object does not delete line with text and block comment`() {
doTest(
"dgc",
@ -649,7 +607,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes JavaDoc comment`() {
doTest(
"dgc",
@ -670,7 +627,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes JavaDoc comment from leading whitespace`() {
doTest(
"dgc",
@ -692,7 +648,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes JavaDoc comment and adjoining comments`() {
doTest(
"dgc",
@ -714,7 +669,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test text object deletes JavaDoc comment and adjoining comments separated by whitespace`() {
doTest(
"dgc",
@ -739,7 +693,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test Commentary command comments current line`() {
doTest(
":Commentary<CR>",
@ -757,7 +710,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test Commentary command comments simple line range`() {
doTest(
":2Commentary<CR>",
@ -775,7 +727,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test Commentary command comments line range`() {
doTest(
":1,3Commentary<CR>",
@ -804,7 +755,6 @@ class CommentaryExtensionTest : VimTestCase() {
"Note that Escape exits Visual mode, but leaves the caret where it is",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test Commentary command comments visual range`() {
doTest(
"Vjj" + ":Commentary<CR>",
@ -822,7 +772,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test Commentary command comments search range`() {
doTest(
":g/value2/Commentary<CR>",
@ -844,7 +793,6 @@ class CommentaryExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test block comment falls back to line comment when not available`() {
doTest(
"gcw",

View File

@ -23,8 +23,6 @@ import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class VimExchangeExtensionTest : VimTestCase() {
@ -35,7 +33,6 @@ class VimExchangeExtensionTest : VimTestCase() {
}
// |cx|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words left to right`() {
doTest(
listOf("cxe", "w", "cxe"),
@ -47,7 +44,6 @@ class VimExchangeExtensionTest : VimTestCase() {
}
// |cx|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words dot repeat`() {
doTest(
listOf("cxiw", "w", "."),
@ -59,7 +55,6 @@ class VimExchangeExtensionTest : VimTestCase() {
}
// |cx|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words right to left`() {
doTest(
listOf("cxe", "b", "cxe"),
@ -71,7 +66,6 @@ class VimExchangeExtensionTest : VimTestCase() {
}
// |cx|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words right to left with dot`() {
doTest(
listOf("cxe", "b", "."),
@ -83,7 +77,6 @@ class VimExchangeExtensionTest : VimTestCase() {
}
// |X|
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words left to right`() {
doTest(
listOf("veX", "w", "veX"),
@ -99,7 +92,6 @@ class VimExchangeExtensionTest : VimTestCase() {
originalVimAfter = "The ${c}brown catch over the lazy dog",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words from inside`() {
doTest(
listOf("veX", "b", "v3e", "X"),
@ -115,7 +107,6 @@ class VimExchangeExtensionTest : VimTestCase() {
originalVimAfter = "The brown ${c}catch over the lazy dog",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words from outside`() {
doTest(
listOf("v3e", "X", "w", "veX"),
@ -136,7 +127,6 @@ class VimExchangeExtensionTest : VimTestCase() {
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange lines top down`() {
doTest(
listOf("cxx", "j", "cxx"),
@ -165,7 +155,6 @@ class VimExchangeExtensionTest : VimTestCase() {
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange lines top down with dot`() {
doTest(
listOf("cxx", "j", "."),
@ -192,7 +181,6 @@ class VimExchangeExtensionTest : VimTestCase() {
lazy dog
"""
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange to the line end`() {
doTest(
listOf("v$", "X", "jj^ve", "X"),
@ -221,7 +209,6 @@ class VimExchangeExtensionTest : VimTestCase() {
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange visual lines`() {
doTest(
listOf("Vj", "X", "jj", "Vj", "X"),
@ -243,7 +230,6 @@ class VimExchangeExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual char highlighter`() {
val before = """
The ${c}quick
@ -260,7 +246,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual line highdhitligthhter`() {
val before = """
The ${c}quick
@ -277,7 +262,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test till the line end highlighter`() {
val before = """
The ${c}quick
@ -292,7 +276,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test pre line end highlighter`() {
val before = """
The ${c}quick
@ -307,7 +290,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test pre pre line end highlighter`() {
val before = """
The ${c}quick
@ -322,7 +304,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test to file end highlighter`() {
val before = """
The quick
@ -344,7 +325,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test to file end with new line highlighter`() {
val before = """
The quick
@ -367,7 +347,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test back selection`() {
val before = """
The quick
@ -383,7 +362,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test back selection exchange 1`() {
doTest(
listOf("vb", "X", "bevb", "X"),
@ -394,7 +372,6 @@ class VimExchangeExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test back selection exchange 2`() {
doTest(
listOf("vb", "X", "wve", "X"),
@ -405,7 +382,6 @@ class VimExchangeExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test back selection exchange 3`() {
doTest(
listOf("ve", "X", "wevb", "X"),
@ -416,7 +392,6 @@ class VimExchangeExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test change with down motion`() {
val before = """
The ${c}quick
@ -436,7 +411,6 @@ class VimExchangeExtensionTest : VimTestCase() {
exitExchange()
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test cxx`() {
val before = """
The ${c}quick

View File

@ -25,8 +25,6 @@ import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.OptionValueType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimOptionTestCase
import org.jetbrains.plugins.ideavim.VimOptionTestConfiguration
import org.jetbrains.plugins.ideavim.VimTestOption
@ -40,7 +38,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
// |cx|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words left to right`() {
doTest(
listOf("cxe", "w", "cxe"),
@ -53,7 +50,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
// |cx|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words dot repeat`() {
doTest(
listOf("cxiw", "w", "."),
@ -66,7 +62,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
// |cx|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words right to left`() {
doTest(
listOf("cxe", "b", "cxe"),
@ -79,7 +74,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
// |cx|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange words right to left with dot`() {
doTest(
listOf("cxe", "b", "."),
@ -92,7 +86,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
// |X|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words left to right`() {
doTest(
listOf("veX", "w", "veX"),
@ -109,7 +102,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
originalVimAfter = "The ${c}brown catch over the lazy dog",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words from inside`() {
doTest(
listOf("veX", "b", "v3e", "X"),
@ -126,7 +118,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
originalVimAfter = "The brown ${c}catch over the lazy dog",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test visual exchange words from outside`() {
doTest(
listOf("v3e", "X", "w", "veX"),
@ -148,7 +139,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange lines top down`() {
doTest(
listOf("cxx", "j", "cxx"),
@ -178,7 +168,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange lines top down with dot`() {
doTest(
listOf("cxx", "j", "."),
@ -206,7 +195,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
lazy dog
"""
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange to the line end`() {
doTest(
listOf("v$", "X", "jj^ve", "X"),
@ -236,7 +224,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
""",
shouldBeFixed = true
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test exchange visual lines`() {
doTest(
listOf("Vj", "X", "jj", "Vj", "X"),

View File

@ -23,8 +23,6 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.extension.highlightedyank.DEFAULT_HIGHLIGHT_DURATION
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.assertHappened
@ -34,7 +32,6 @@ class VimHighlightedYankTest : VimTestCase() {
enableExtensions("highlightedyank")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test highlighting whole line when whole line is yanked`() {
doTest("yy", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
@ -42,7 +39,6 @@ class VimHighlightedYankTest : VimTestCase() {
assertHighlighterRange(1, 40, getFirstHighlighter())
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test highlighting single word when single word is yanked`() {
doTest("yiw", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
@ -58,7 +54,6 @@ class VimHighlightedYankTest : VimTestCase() {
assertHighlighterRange(40, 59, getFirstHighlighter())
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test removing previous highlight when entering insert mode`() {
doTest("yyi", code, code, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
@ -110,7 +105,6 @@ class VimHighlightedYankTest : VimTestCase() {
}
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test highlighting with multiple cursors`() {
doTest("yiw", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
@ -121,14 +115,12 @@ class VimHighlightedYankTest : VimTestCase() {
assertHighlighterRange(28, 31, highlighters[2])
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test clearing all highlighters with multiple cursors`() {
doTest("yiwi", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
assertAllHighlightersCount(0)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test highlighting for a correct default amount of time`() {
doTest("yiw", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
@ -137,7 +129,6 @@ class VimHighlightedYankTest : VimTestCase() {
}
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test highlighting for a correct user provided amount of time`() {
configureByJavaText(code)
typeText(injector.parser.parseKeys(":let g:highlightedyank_highlight_duration = \"1000\"<CR>"))

View File

@ -18,9 +18,6 @@
package org.jetbrains.plugins.ideavim.extension.matchit
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class MatchitCMakeTest : VimTestCase() {
@ -30,7 +27,6 @@ class MatchitCMakeTest : VimTestCase() {
enableExtensions("matchit")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from if to else`() {
doTest(
"%",
@ -48,11 +44,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else to endif`() {
doTest(
"%",
@ -70,11 +65,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
${c}endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to if`() {
doTest(
"%",
@ -92,11 +86,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from if to elseif in if-else structure`() {
doTest(
"%",
@ -122,11 +115,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from elseif to elseif`() {
doTest(
"%",
@ -152,11 +144,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from elseif to else`() {
doTest(
"%",
@ -182,11 +173,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else to endif in if-else structure`() {
doTest(
"%",
@ -212,11 +202,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
${c}endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to if in if-else structure`() {
doTest(
"%",
@ -242,11 +231,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from foreach to endforeach`() {
doTest(
"%",
@ -260,11 +248,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
${c}endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endforeach to foreach`() {
doTest(
"%",
@ -278,11 +265,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from foreach to break`() {
doTest(
"%",
@ -302,11 +288,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from break to endforeach`() {
doTest(
"%",
@ -326,11 +311,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
${c}endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from while to endwhile`() {
doTest(
"%",
@ -344,11 +328,10 @@ class MatchitCMakeTest : VimTestCase() {
MATH(EXPR VAR "${"\${index}"}+1")
${c}endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endwhile to while`() {
doTest(
"%",
@ -362,11 +345,10 @@ class MatchitCMakeTest : VimTestCase() {
MATH(EXPR VAR "${"\${index}"}+1")
endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from while to break`() {
doTest(
"%",
@ -386,11 +368,10 @@ class MatchitCMakeTest : VimTestCase() {
endif()
endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from break to endwhile`() {
doTest(
"%",
@ -410,11 +391,10 @@ class MatchitCMakeTest : VimTestCase() {
endif()
${c}endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from function to endfunction`() {
doTest(
"%",
@ -428,11 +408,10 @@ class MatchitCMakeTest : VimTestCase() {
bar(x y z)
${c}endfunction()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endfunction to function`() {
doTest(
"%",
@ -446,11 +425,10 @@ class MatchitCMakeTest : VimTestCase() {
bar(x y z)
endfunction()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from macro to endmacro`() {
doTest(
"%",
@ -464,11 +442,10 @@ class MatchitCMakeTest : VimTestCase() {
message("arg = ${"\${arg}\""}")
${c}endmacro()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endmacro to macro`() {
doTest(
"%",
@ -482,13 +459,12 @@ class MatchitCMakeTest : VimTestCase() {
message("arg = ${"\${arg}\""}")
endmacro()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
// Tests for reverse motion
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from if to endif`() {
doTest(
"g%",
@ -506,11 +482,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
${c}endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else to if`() {
doTest(
"g%",
@ -528,11 +503,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to else`() {
doTest(
"g%",
@ -550,11 +524,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Non-linux system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from if to endif in if-else block`() {
doTest(
"g%",
@ -580,11 +553,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
${c}endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from elseif to if`() {
doTest(
"g%",
@ -610,11 +582,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from elseif in else block to elseif`() {
doTest(
"g%",
@ -640,11 +611,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else to elseif`() {
doTest(
"g%",
@ -670,11 +640,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to else in if-else block`() {
doTest(
"g%",
@ -700,11 +669,10 @@ class MatchitCMakeTest : VimTestCase() {
message("Unknown system")
endif()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from foreach to endforeach`() {
doTest(
"g%",
@ -718,11 +686,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
${c}endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endforeach to foreach`() {
doTest(
"g%",
@ -736,11 +703,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from foreach to endforeach over a break`() {
doTest(
"g%",
@ -760,11 +726,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
${c}endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endforeach to break`() {
doTest(
"g%",
@ -784,11 +749,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from break to foreach`() {
doTest(
"g%",
@ -808,11 +772,10 @@ class MatchitCMakeTest : VimTestCase() {
message(STATUS "X=${"\${X}"}")
endforeach()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from while to endwhile`() {
doTest(
"g%",
@ -826,11 +789,10 @@ class MatchitCMakeTest : VimTestCase() {
MATH(EXPR VAR "${"\${index}"}+1")
${c}endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endwhile to while`() {
doTest(
"g%",
@ -844,11 +806,10 @@ class MatchitCMakeTest : VimTestCase() {
MATH(EXPR VAR "${"\${index}"}+1")
endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from while to endwhile over a break`() {
doTest(
"g%",
@ -868,11 +829,10 @@ class MatchitCMakeTest : VimTestCase() {
endif()
${c}endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endwhile to break`() {
doTest(
"g%",
@ -892,11 +852,10 @@ class MatchitCMakeTest : VimTestCase() {
endif()
endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from break to while`() {
doTest(
"g%",
@ -916,11 +875,10 @@ class MatchitCMakeTest : VimTestCase() {
endif()
endwhile()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from function to endfunction`() {
doTest(
"g%",
@ -934,11 +892,10 @@ class MatchitCMakeTest : VimTestCase() {
bar(x y z)
${c}endfunction()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endfunction to function`() {
doTest(
"g%",
@ -952,11 +909,10 @@ class MatchitCMakeTest : VimTestCase() {
bar(x y z)
endfunction()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from macro to endmacro`() {
doTest(
"g%",
@ -970,11 +926,10 @@ class MatchitCMakeTest : VimTestCase() {
message("arg = ${"\${arg}\""}")
${c}endmacro()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endmacro to macro`() {
doTest(
"g%",
@ -988,7 +943,7 @@ class MatchitCMakeTest : VimTestCase() {
message("arg = ${"\${arg}\""}")
endmacro()
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
fileName = "CMakeLists.txt"
)
}
}

View File

@ -18,9 +18,6 @@
package org.jetbrains.plugins.ideavim.extension.matchit
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class MatchitCTest : VimTestCase() {
@ -30,7 +27,6 @@ class MatchitCTest : VimTestCase() {
enableExtensions("matchit")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #if to #endif`() {
doTest(
"%",
@ -42,11 +38,10 @@ class MatchitCTest : VimTestCase() {
#if !defined (VAL_1)
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from whitespace before #if to #endif`() {
doTest(
"%",
@ -58,11 +53,10 @@ class MatchitCTest : VimTestCase() {
#if !defined (VAL_1)
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #if to #elif`() {
doTest(
"%",
@ -78,11 +72,10 @@ class MatchitCTest : VimTestCase() {
$c#elif !defined (VAL_2)
#define VAL_2 2
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #if to #else`() {
doTest(
"%",
@ -98,11 +91,10 @@ class MatchitCTest : VimTestCase() {
$c#else
#define VAL_2 2
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #elif to #else`() {
doTest(
"%",
@ -114,11 +106,10 @@ class MatchitCTest : VimTestCase() {
#elif !defined (VAL_2)
$c#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from whitespace before #elif to #else`() {
doTest(
"%",
@ -130,11 +121,10 @@ class MatchitCTest : VimTestCase() {
#elif !defined (VAL_2)
$c#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #else to #endif`() {
doTest(
"%",
@ -146,11 +136,10 @@ class MatchitCTest : VimTestCase() {
#else
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from whitespace before #else to #endif`() {
doTest(
"%",
@ -162,11 +151,10 @@ class MatchitCTest : VimTestCase() {
#else !defined (VAL_2)
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #endif to #if`() {
doTest(
"%",
@ -188,11 +176,10 @@ class MatchitCTest : VimTestCase() {
#define VAL_3 3
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifdef to #endif`() {
doTest(
"%",
@ -204,11 +191,10 @@ class MatchitCTest : VimTestCase() {
#ifdef DEBUG
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifdef to #elif`() {
doTest(
"%",
@ -220,11 +206,10 @@ class MatchitCTest : VimTestCase() {
#ifdef DEBUG
$c#elif PROD
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifdef to #else`() {
doTest(
"%",
@ -236,11 +221,10 @@ class MatchitCTest : VimTestCase() {
#ifdef DEBUG
$c#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #endif to #ifdef`() {
doTest(
"%",
@ -252,11 +236,10 @@ class MatchitCTest : VimTestCase() {
$c#ifdef DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifndef to #endif`() {
doTest(
"%",
@ -268,11 +251,10 @@ class MatchitCTest : VimTestCase() {
#ifndef DEBUG
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifndef to #elif`() {
doTest(
"%",
@ -284,11 +266,10 @@ class MatchitCTest : VimTestCase() {
#ifndef DEBUG
$c#elif PROD
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #ifndef to #else`() {
doTest(
"%",
@ -300,11 +281,10 @@ class MatchitCTest : VimTestCase() {
#ifndef DEBUG
$c#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #endif to #ifndef`() {
doTest(
"%",
@ -316,11 +296,10 @@ class MatchitCTest : VimTestCase() {
$c#ifndef DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't jump from malformed #if`() {
doTest(
"%",
@ -332,11 +311,10 @@ class MatchitCTest : VimTestCase() {
$c#ifff DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from #if with whitespace to #endif`() {
doTest(
"%",
@ -348,11 +326,10 @@ class MatchitCTest : VimTestCase() {
# if DEBUG
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from nested #if to #endif`() {
doTest(
"%",
@ -368,7 +345,7 @@ class MatchitCTest : VimTestCase() {
$c# endif
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@ -376,7 +353,6 @@ class MatchitCTest : VimTestCase() {
* Tests for reverse g% motion
*/
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #if to #endif`() {
doTest(
"g%",
@ -388,11 +364,10 @@ class MatchitCTest : VimTestCase() {
#if !defined (VAL_1)
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from whitespace before #if to #endif`() {
doTest(
"g%",
@ -404,11 +379,10 @@ class MatchitCTest : VimTestCase() {
#if !defined (VAL_1)
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #endif to #if with whitespace`() {
doTest(
"g%",
@ -420,11 +394,10 @@ class MatchitCTest : VimTestCase() {
$c# if DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #endif to #else`() {
doTest(
"g%",
@ -438,11 +411,10 @@ class MatchitCTest : VimTestCase() {
#define VAL_3 3
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #else to #elif`() {
doTest(
"g%",
@ -460,11 +432,10 @@ class MatchitCTest : VimTestCase() {
#define VAL_3 3
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from whitespace before #else to #elif`() {
doTest(
"g%",
@ -482,11 +453,10 @@ class MatchitCTest : VimTestCase() {
#define VAL_3 3
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #elif to #if`() {
doTest(
"g%",
@ -502,11 +472,10 @@ class MatchitCTest : VimTestCase() {
#elif !defined (VAL_2)
#define VAL_2 2
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #ifdef to #endif`() {
doTest(
"g%",
@ -518,11 +487,10 @@ class MatchitCTest : VimTestCase() {
#ifdef DEBUG
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #endif to #ifdef`() {
doTest(
"g%",
@ -534,11 +502,10 @@ class MatchitCTest : VimTestCase() {
$c#ifdef DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #else to #ifdef`() {
doTest(
"g%",
@ -550,11 +517,10 @@ class MatchitCTest : VimTestCase() {
$c#ifdef DEBUG
#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #elif to #ifdef`() {
doTest(
"g%",
@ -566,11 +532,10 @@ class MatchitCTest : VimTestCase() {
$c#ifdef DEBUG
#elif PROD
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #ifndef to #endif`() {
doTest(
"g%",
@ -582,11 +547,10 @@ class MatchitCTest : VimTestCase() {
#ifndef DEBUG
$c#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #endif to #ifndef`() {
doTest(
"g%",
@ -598,11 +562,10 @@ class MatchitCTest : VimTestCase() {
$c#ifndef DEBUG
#endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #elif to #ifndef`() {
doTest(
"g%",
@ -614,11 +577,10 @@ class MatchitCTest : VimTestCase() {
$c#ifndef DEBUG
#elif PROD
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from #else to #ifndef`() {
doTest(
"g%",
@ -630,7 +592,7 @@ class MatchitCTest : VimTestCase() {
$c#ifndef DEBUG
#else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
fileName = "main.c"
)
}
}

View File

@ -18,9 +18,6 @@
package org.jetbrains.plugins.ideavim.extension.matchit
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class MatchitGNUMakeTest : VimTestCase() {
@ -30,7 +27,6 @@ class MatchitGNUMakeTest : VimTestCase() {
enableExtensions("matchit")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from define to endef`() {
doTest(
"%",
@ -46,11 +42,10 @@ class MatchitGNUMakeTest : VimTestCase() {
second line
${c}endef
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endef to define`() {
doTest(
"%",
@ -66,11 +61,10 @@ class MatchitGNUMakeTest : VimTestCase() {
second line
endef
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifdef to endif`() {
doTest(
"%",
@ -84,11 +78,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info defined)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifdef`() {
doTest(
"%",
@ -102,11 +95,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info defined)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifndef to endif`() {
doTest(
"%",
@ -120,11 +112,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not defined)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifndef`() {
doTest(
"%",
@ -138,11 +129,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not defined)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifeq to endif`() {
doTest(
"%",
@ -156,11 +146,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info empty)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifeq`() {
doTest(
"%",
@ -174,11 +163,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info empty)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifneq to endif`() {
doTest(
"%",
@ -192,11 +180,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifneq`() {
doTest(
"%",
@ -210,11 +197,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifneq to else`() {
doTest(
"%",
@ -228,11 +214,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifeq to else in ifeq-else block`() {
doTest(
"%",
@ -254,11 +239,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else ifeq to else`() {
doTest(
"%",
@ -280,11 +264,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifeq in else block to else`() {
doTest(
"%",
@ -306,11 +289,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else to endif in ifeq-else block`() {
doTest(
"%",
@ -332,11 +314,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifeq in ifeq-else block`() {
doTest(
"%",
@ -358,11 +339,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifneq to else in ifneq-else block`() {
doTest(
"%",
@ -384,11 +364,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else ifneq to else`() {
doTest(
"%",
@ -410,11 +389,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from ifneq in else block to else`() {
doTest(
"%",
@ -436,11 +414,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from else to endif in ifneq-else block`() {
doTest(
"%",
@ -462,11 +439,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from endif to ifneq in ifneq-else block`() {
doTest(
"%",
@ -488,13 +464,12 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
// Reverse tests
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from define to endef`() {
doTest(
"g%",
@ -510,11 +485,10 @@ class MatchitGNUMakeTest : VimTestCase() {
second line
${c}endef
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endef to define`() {
doTest(
"g%",
@ -530,11 +504,10 @@ class MatchitGNUMakeTest : VimTestCase() {
second line
endef
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifdef to endif`() {
doTest(
"g%",
@ -548,11 +521,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info defined)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to ifdef`() {
doTest(
"g%",
@ -566,11 +538,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info defined)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifndef to endif`() {
doTest(
"g%",
@ -584,11 +555,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not defined)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to ifndef`() {
doTest(
"g%",
@ -602,11 +572,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not defined)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifeq to endif`() {
doTest(
"g%",
@ -620,11 +589,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info empty)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to ifeq`() {
doTest(
"g%",
@ -638,11 +606,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info empty)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifneq to endif`() {
doTest(
"g%",
@ -656,11 +623,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to ifneq`() {
doTest(
"g%",
@ -674,11 +640,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifneq to else`() {
doTest(
"g%",
@ -692,11 +657,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not empty)
else
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifeq to endif in ifeq-else block`() {
doTest(
"g%",
@ -718,11 +682,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else ifeq to ifeq`() {
doTest(
"g%",
@ -744,11 +707,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifeq in else block to ifeq`() {
doTest(
"g%",
@ -770,11 +732,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else to else in ifeq-else block`() {
doTest(
"g%",
@ -796,11 +757,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to else in ifeq-else block`() {
doTest(
"g%",
@ -822,11 +782,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info not x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifneq to endif in ifneq-else block`() {
doTest(
"g%",
@ -848,11 +807,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
${c}endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else ifneq to ifneq`() {
doTest(
"g%",
@ -874,11 +832,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from ifneq in else block to ifneq`() {
doTest(
"g%",
@ -900,11 +857,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from else to else in ifneq-else block`() {
doTest(
"g%",
@ -926,11 +882,10 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from endif to else in ifneq-else block`() {
doTest(
"g%",
@ -952,7 +907,7 @@ class MatchitGNUMakeTest : VimTestCase() {
$(info x86 based)
endif
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
fileName = "Makefile"
)
}
}

View File

@ -23,8 +23,6 @@ import com.intellij.ide.highlighter.JavaFileType
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.helper.experimentalApi
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class MatchitGeneralTest : VimTestCase() {
@ -38,7 +36,6 @@ class MatchitGeneralTest : VimTestCase() {
* Tests to make sure we didn't break the default % motion
*/
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from Java comment start to end`() {
doTest(
"%",
@ -52,11 +49,10 @@ class MatchitGeneralTest : VimTestCase() {
*
*$c/
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, JavaFileType.INSTANCE
fileType = JavaFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from Java comment end to start`() {
doTest(
"%",
@ -70,11 +66,10 @@ class MatchitGeneralTest : VimTestCase() {
*
*/
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, JavaFileType.INSTANCE
fileType = JavaFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test 25 percent jump`() {
doTest(
"25%",
@ -90,11 +85,10 @@ class MatchitGeneralTest : VimTestCase() {
int c;
int d;
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, HtmlFileType.INSTANCE
fileType = HtmlFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from visual end of line to opening parenthesis`() {
doTest(
"v$%",
@ -104,7 +98,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from visual end of line to opening parenthesis then back to closing`() {
doTest(
"v$%%",
@ -114,15 +107,13 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from opening parenthesis to closing parenthesis`() {
doTest(
"d%",
"$c(x == 123)", "", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, HtmlFileType.INSTANCE
"$c(x == 123)", "", fileType = HtmlFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from closing parenthesis to opening parenthesis`() {
doTest(
"d%",
@ -130,7 +121,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from opening curly brace to closing curly brace`() {
doTest(
"d%",
@ -138,7 +128,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from closing curly brace to opening curly brace`() {
doTest(
"d%",
@ -146,7 +135,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from opening square bracket to closing square bracket`() {
doTest(
"d%",
@ -154,7 +142,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete everything from closing square bracket to opening square bracket`() {
doTest(
"d%",
@ -165,7 +152,6 @@ class MatchitGeneralTest : VimTestCase() {
/*
* Tests for visual mode and deleting on the new Matchit patterns.
*/
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from visual end of line to opening angle bracket`() {
doTest(
"v$%",
@ -175,7 +161,6 @@ class MatchitGeneralTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from visual end of line to start of for loop`() {
doTest(
"v$%",
@ -189,7 +174,7 @@ class MatchitGeneralTest : VimTestCase() {
puts n
en${se}d
""".trimIndent(),
VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER, "ruby.rb"
VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER, fileName = "ruby.rb"
)
}
@ -203,7 +188,6 @@ class MatchitGeneralTest : VimTestCase() {
""",
description = "Our code changes the motion type to linewise, but it should not"
)
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete from elseif to else`() {
doTest(
"d%",
@ -232,11 +216,10 @@ class MatchitGeneralTest : VimTestCase() {
end
""".trimIndent()
},
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete from elseif to else 2`() {
doTest(
"d%",
@ -256,11 +239,10 @@ class MatchitGeneralTest : VimTestCase() {
puts "Positive"
end
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete from else to elsif with reverse motion`() {
doTest(
"dg%",
@ -280,11 +262,10 @@ class MatchitGeneralTest : VimTestCase() {
puts "Positive"
end
""".trimIndent(),
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete from opening to closing div`() {
doTest(
"d%",
@ -293,22 +274,22 @@ class MatchitGeneralTest : VimTestCase() {
<img src="fff">
</div>
""".trimIndent(),
"$c<", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, HtmlFileType.INSTANCE
"$c<",
fileType = HtmlFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete from opening angle bracket to closing angle bracket`() {
doTest(
"d%",
"""
$c<div></div>
""".trimIndent(),
"$c</div>", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, HtmlFileType.INSTANCE
"$c</div>",
fileType = HtmlFileType.INSTANCE
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete whole function from def`() {
doTest(
"d%",
@ -317,11 +298,11 @@ class MatchitGeneralTest : VimTestCase() {
puts "hello"
end
""".trimIndent(),
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
"",
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete whole function from def with reverse motion`() {
doTest(
"dg%",
@ -330,11 +311,11 @@ class MatchitGeneralTest : VimTestCase() {
puts "hello"
end
""".trimIndent(),
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
"",
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete whole function from end`() {
doTest(
"d%",
@ -343,11 +324,11 @@ class MatchitGeneralTest : VimTestCase() {
puts "hello"
en${c}d
""".trimIndent(),
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
"",
fileName = "ruby.rb"
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test delete whole function from end with reverse motion`() {
doTest(
"dg%",
@ -356,7 +337,8 @@ class MatchitGeneralTest : VimTestCase() {
puts "hello"
en${c}d
""".trimIndent(),
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
"",
fileName = "ruby.rb"
)
}
}

View File

@ -20,8 +20,6 @@ package org.jetbrains.plugins.ideavim.extension.matchit
import com.intellij.ide.highlighter.HtmlFileType
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class MatchitHtmlTest : VimTestCase() {
@ -31,7 +29,6 @@ class MatchitHtmlTest : VimTestCase() {
enableExtensions("matchit")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test basic jump to closing tag`() {
doTest(
"%",
@ -45,7 +42,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test basic jump to opening tag`() {
doTest(
"%",
@ -59,7 +55,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test multiline jump to closing tag`() {
doTest(
"%",
@ -77,7 +72,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test multiline jump to opening tag`() {
doTest(
"%",
@ -95,7 +89,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to closing tag while ignoring nested tags`() {
doTest(
"%",
@ -117,7 +110,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to closing tag while ignoring outer tags`() {
doTest(
"%",
@ -135,7 +127,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to opening tag while ignoring nested tags`() {
doTest(
"%",
@ -157,7 +148,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to opening tag while ignoring outer tags`() {
doTest(
"%",
@ -175,7 +165,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to closing tag while in tag attributes`() {
doTest(
"%",
@ -189,7 +178,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't jump on standalone tags`() {
doTest(
"%",
@ -207,7 +195,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't jump on empty lines`() {
doTest(
"%",
@ -225,7 +212,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump forwards to matching angle bracket on opening tag`() {
doTest(
"%",
@ -239,7 +225,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump forwards to matching angle bracket when on whitespace`() {
doTest(
"%",
@ -249,7 +234,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to last angle bracket when in tag body`() {
doTest(
"%",
@ -263,7 +247,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump forwards to matching angle bracket on closing tag`() {
doTest(
"%",
@ -277,7 +260,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump backwards to matching angle bracket on opening tag`() {
doTest(
"%",
@ -291,7 +273,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump backwards to matching angle bracket on closing tag`() {
doTest(
"%",
@ -305,7 +286,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to matching square bracket inside tag`() {
doTest(
"%",
@ -319,7 +299,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to matching parenthesis inside tag`() {
doTest(
"%",
@ -333,7 +312,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to matching curly brace in tag body`() {
doTest(
"%",
@ -347,7 +325,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to closing tag when inside brackets in opening tag`() {
doTest(
"%",
@ -361,7 +338,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump to opening curly brace when in tag body`() {
doTest(
"%",
@ -375,7 +351,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't jump on standalone tag with brackets on the same line`() {
doTest(
"%",
@ -389,7 +364,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from opening to closing tag while ignoring comments`() {
doTest(
"%",
@ -419,7 +393,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from closing to opening tag while ignoring comments`() {
doTest(
"%",
@ -449,7 +422,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from opening to closing tag inside a comment block`() {
doTest(
"%",
@ -467,7 +439,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from closing to opening tag inside a comment block`() {
doTest(
"%",
@ -485,7 +456,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from opening to closing angle bracket inside a comment block`() {
doTest(
"%",
@ -503,7 +473,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from closing to opening angle bracket inside a comment block`() {
doTest(
"%",
@ -521,7 +490,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from opening to closing angle bracket on a comment marker`() {
doTest(
"%",
@ -539,7 +507,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from opening to closing angle bracket ignoring bracket in string`() {
doTest(
"%",
@ -557,7 +524,6 @@ class MatchitHtmlTest : VimTestCase() {
* g% motion tests. For HTML, g% should behave the same as %.
*/
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing tag`() {
doTest(
"g%",
@ -571,7 +537,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to opening tag`() {
doTest(
"g%",
@ -585,7 +550,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing tag while ignoring nested tags`() {
doTest(
"g%",
@ -607,7 +571,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing tag while ignoring outer tags`() {
doTest(
"g%",
@ -625,7 +588,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to opening tag while ignoring nested tags`() {
doTest(
"g%",
@ -647,7 +609,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to opening tag while ignoring outer tags`() {
doTest(
"g%",
@ -665,7 +626,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing tag while in tag attributes`() {
doTest(
"g%",
@ -679,7 +639,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't reverse jump on standalone tags`() {
doTest(
"g%",
@ -697,7 +656,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't reverse jump on empty lines`() {
doTest(
"g%",
@ -715,7 +673,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing angle bracket`() {
doTest(
"g%",
@ -729,7 +686,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing angle bracket when on whitespace`() {
doTest(
"g%",
@ -739,7 +695,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to last angle bracket when in tag body`() {
doTest(
"g%",
@ -753,7 +708,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to opening angle bracket`() {
doTest(
"g%",
@ -767,7 +721,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to matching square bracket inside tag`() {
doTest(
"g%",
@ -781,7 +734,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to matching parenthesis inside tag`() {
doTest(
"g%",
@ -795,7 +747,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to matching curly brace in tag body`() {
doTest(
"g%",
@ -809,7 +760,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to closing tag when inside brackets in opening tag`() {
doTest(
"g%",
@ -823,7 +773,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump to opening curly brace when in tag body`() {
doTest(
"g%",
@ -837,7 +786,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test don't reverse jump on standalone tag with brackets on the same line`() {
doTest(
"g%",
@ -851,7 +799,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from opening to closing tag while ignoring comments`() {
doTest(
"g%",
@ -881,7 +828,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from closing to opening tag while ignoring comments`() {
doTest(
"g%",
@ -911,7 +857,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from opening to closing tag inside a comment block`() {
doTest(
"g%",
@ -929,7 +874,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from closing to opening tag inside a comment block`() {
doTest(
"g%",
@ -947,7 +891,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from opening to closing angle bracket inside a comment block`() {
doTest(
"g%",
@ -965,7 +908,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from closing to opening angle bracket inside a comment block`() {
doTest(
"g%",
@ -983,7 +925,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from opening to closing angle bracket on a comment marker`() {
doTest(
"g%",
@ -1001,7 +942,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test reverse jump from opening to closing angle bracket ignoring bracket in string`() {
doTest(
"g%",
@ -1015,7 +955,6 @@ class MatchitHtmlTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test jump from multiline opening tag to closing`() {
doTest(
"%",

View File

@ -34,7 +34,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
enableExtensions("multiple-cursors")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testNextOccurrence() {
val before = """public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
@ -74,7 +73,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testAllOccurrencesIterative() {
val before = """public class ChangeLineAction extends EditorAction {
public ChangeLineAction() {
@ -114,7 +112,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testNotWholeOccurrence() {
val before = """Int
|Integer
@ -139,7 +136,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectSubstring() {
val before = """q${c}we
|asdqweasd
@ -158,7 +154,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectSingleOccurrence() {
val before = """q${c}we
|asd
@ -181,7 +176,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectionWithMultipleCarets() {
val before = """qwe
|sdfgdfs${c}fdasfg
@ -195,7 +189,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(before)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectAll() {
val before = """qwe
|asd
@ -216,7 +209,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectAllNotWhole() {
val before = """Int
|Integer
@ -240,7 +232,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectAllSingleOccurrence() {
val before = """qwe
|asd
@ -267,7 +258,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
"additional cursors. IdeaVim has native support, so doesn't track if a selection is due to an additional cursor " +
"so IdeaVim will remove arbitrary selections, while vim-multiple-cursors do not."
)
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testRemoveSelectionVisualMode() {
val before = """q${s}we
|dsgkldfjs ldfl gkjsdsl kj
@ -287,7 +277,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testRemoveSubSelection() {
val before = """Int
|kekInteger
@ -304,7 +293,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testRemoveOccurrence() {
val before = """private i${c}nt a = 0;
|private int b = 1;
@ -325,7 +313,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSkipOccurrence() {
val before = """pr${c}ivate int a = 0;
|private int b = 1;
@ -343,7 +330,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSkipAndThenSelectAllOccurrences() {
val before = """pr${c}ivate int a = 0;
|private int b = 1;
@ -361,7 +347,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSeveralActions() {
val before = """public class Main {
| public static void main(String[] args) {
@ -430,7 +415,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(afterInsert)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSelectTwice() {
val before = """qwe
|asd
@ -455,7 +439,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSkipSelectionSubstring() {
val before = """qw${c}e
|asdqweasd
@ -476,7 +459,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testSkipSelectionVisualMode() {
val before = """q${s}we
|dsgkldfjs ldfl gkjsdsl kj
@ -491,7 +473,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(before)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testAddSelectionVisualMode() {
val before = """jdfsg sdf${c}dfkgjhfkgkldfjsg
|dfkjghdfsgs
@ -506,7 +487,6 @@ class VimMultipleCursorsExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun testNextOccurrenceCaseSensitive() {
val before = """@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun getCellType(${c}pos: VisualPosition): CellType {
@ -557,7 +537,6 @@ fun getCellType(${s}pos$se: VisualPosition): CellType {
doTest(keys, before, after, VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test pattern is always case sensitive`() {
val before = """test ${c}Test tEst TeSt tEST Test test Test test"""
configureByText(before)
@ -568,7 +547,6 @@ fun getCellType(${s}pos$se: VisualPosition): CellType {
assertState(after)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test ignores regex in search pattern`() {
val before = "test ${s}t.*st${c}$se toast tallest t.*st"
val editor = configureByText(before)

View File

@ -19,8 +19,6 @@
package org.jetbrains.plugins.ideavim.extension.paragraphmotion
import com.maddyhome.idea.vim.command.VimStateMachine
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
class ParagraphMotionTest : VimTestCase() {
@ -30,7 +28,6 @@ class ParagraphMotionTest : VimTestCase() {
enableExtensions("vim-paragraph-motion")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph next without whitespace`() {
val before = """I found it in a legendary land
|${c}all rocks and lavender and tufted grass,
@ -45,7 +42,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("}", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph next with whitespace`() {
val before = """I found it in a legendary land
|${c}all rocks and lavender and tufted grass,
@ -60,7 +56,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("}", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph next with whitespace visual`() {
val before = """I found it in a legendary land
|${c}all rocks and lavender and tufted grass,
@ -75,7 +70,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("v}", before, after, VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph next with whitespace delete`() {
val before = """I found it in a legendary land
|${c}all rocks and lavender and tufted grass,
@ -90,7 +84,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("d}", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph prev without whitespace`() {
val before = """I found it in a legendary land
|all rocks and lavender and tufted grass,
@ -105,7 +98,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("{", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph prev with whitespace`() {
val before = """I found it in a legendary land
|all rocks and lavender and tufted grass,
@ -120,7 +112,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("{", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph prev with whitespace visual`() {
val before = """I found it in a legendary land
|all rocks and lavender and tufted grass,
@ -135,7 +126,6 @@ class ParagraphMotionTest : VimTestCase() {
doTest("v{", before, after, VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test paragraph prev with whitespace delete`() {
val before = """I found it in a legendary land
|all rocks and lavender and tufted grass,

View File

@ -25,8 +25,6 @@ import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.register.RegisterConstants.UNNAMED_REGISTER
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
@ -37,7 +35,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
enableExtensions("ReplaceWithRegister")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with empty register`() {
val text = "one ${c}two three"
VimPlugin.getRegister().resetRegisters()
@ -47,7 +44,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertState(text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test simple replace`() {
val text = "one ${c}two three"
@ -58,7 +54,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test empty text`() {
val text = ""
@ -68,7 +63,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertState("on${c}e")
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with empty text`() {
val text = "${c}one"
@ -78,7 +72,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertState(c)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace use different register`() {
val text = "one ${c}two three four"
@ -91,7 +84,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertEquals("two", VimPlugin.getRegister().lastRegister?.text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace use clipboard register`() {
val text = "one ${c}two three four"
@ -101,7 +93,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertEquals("two", VimPlugin.getRegister().lastRegister?.text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace use wrong register`() {
val text = "one ${c}two three"
@ -110,7 +101,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertState(text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with line`() {
val text = """
|I fou${c}nd it in a legendary land|
@ -127,7 +117,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with line with clipboard register`() {
val text = """
|I fou${c}nd it in a legendary land|
@ -144,7 +133,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace block selection`() {
val text = """
${c}one two three
@ -165,7 +153,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with number`() {
val text = "one ${c}two three four"
@ -177,7 +164,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
}
@VimBehaviorDiffers("one on${c}e on${c}e four")
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test replace with multiple carets`() {
val text = "one ${c}two ${c}three four"
@ -188,7 +174,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertEquals("one", VimPlugin.getRegister().lastRegister?.text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test dot repeat`() {
val text = "one ${c}two three four"
@ -201,7 +186,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
// --------------------------------------- grr --------------------------
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line replace`() {
val text = """
I found it in ${c}a legendary land
@ -224,7 +208,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertEquals("legendary", VimPlugin.getRegister().lastRegister?.text)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line replace with line`() {
val text = """
I found it in ${c}a legendary land
@ -245,7 +228,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line replace with line empty line`() {
val text = """
I found it in ${c}a legendary land
@ -269,7 +251,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
}
@VimBehaviorDiffers(description = "Where is the new line comes from?...")
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line replace with block`() {
val text = """
${c}one two three
@ -300,7 +281,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
hard by the torrent of a mountain pass.
"""
)
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line with number`() {
val text = """
I found it in ${c}a legendary land
@ -321,7 +301,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line dot repeat`() {
val text = """
I found it in ${c}a legendary land
@ -350,7 +329,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
${c}where it was settled on some sodden sand
"""
)
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test line multicaret`() {
val text = """
I found it in ${c}a legendary land
@ -374,7 +352,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
// ------------------------------------- gr + visual ----------------------
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test visual replace`() {
val text = """
I ${c}found it in a legendary land
@ -398,7 +375,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test visual replace with line`() {
val text = """
|I fo${c}und it in a legendary land|
@ -420,7 +396,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test visual replace with two lines`() {
val text = """
|I found it in ${c}a legendary land|
@ -443,7 +418,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test visual line replace`() {
val text = """
I fo${c}und it in a legendary land
@ -466,7 +440,6 @@ class ReplaceWithRegisterTest : VimTestCase() {
assertMode(VimStateMachine.Mode.COMMAND)
}
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
fun `test visual line replace with line`() {
val text = """
I fo${c}und it in a legendary land

View File

@ -23,8 +23,6 @@ package org.jetbrains.plugins.ideavim.extension.surround
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.VimStateMachine
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
/**
@ -39,7 +37,6 @@ class VimSurroundExtensionTest : VimTestCase() {
/* surround */
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundWordParens() {
val before = "if ${c}condition {\n" + "}\n"
val after = "if ${c}(condition) {\n" + "}\n"
@ -49,7 +46,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("yse(", before, "if ( condition ) {\n" + "}\n", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundWORDBlock() {
val before = "if (condition) ${c}return;\n"
val after = "if (condition) {return;}\n"
@ -59,7 +55,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ysE{", before, "if (condition) { return; }\n", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundWordArray() {
val before = "int foo = bar${c}index;"
val after = "int foo = bar[index];"
@ -69,7 +64,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("yse[", before, "int foo = bar[ index ];", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundWordAngle() {
val before = "foo = new Bar${c}Baz();"
val after = "foo = new Bar<Baz>();"
@ -78,7 +72,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("yse>", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundQuotes() {
val before = "foo = ${c}new Bar.Baz;"
val after = "foo = \"new Bar.Baz\";"
@ -87,7 +80,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ys4w\"", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundTag() {
configureByText("Hello ${c}World!\n")
typeText(injector.parser.parseKeys("ysiw<em>"))
@ -95,7 +87,6 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-1569
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundTagWithAttributes() {
configureByText("Hello ${c}World!")
typeText(injector.parser.parseKeys("ysiw<span class=\"important\" data-foo=\"bar\">"))
@ -103,28 +94,24 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-1569
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurraungTagAsInIssue() {
configureByText("<p>${c}Hello</p>")
typeText(injector.parser.parseKeys("VS<div class = \"container\">"))
assertState("<div class = \"container\"><p>Hello</p></div>")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundCustomElement() {
configureByText("${c}Click me!")
typeText(injector.parser.parseKeys("VS<custom-button>"))
assertState("<custom-button>Click me!</custom-button>")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundFunctionName() {
configureByText("foo = b${c}ar")
typeText(injector.parser.parseKeys("ysiwfbaz"))
assertState("foo = ${c}baz(bar)")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundFunctionNameDoesNothingIfInputIsEmpty() {
// The cursor does not move. This is different from Vim
// where the cursor moves to the beginning of the text object.
@ -133,21 +120,18 @@ class VimSurroundExtensionTest : VimTestCase() {
assertState("foo = b${c}ar")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundFunctionNameWithInnerSpacing() {
configureByText("foo = b${c}ar")
typeText(injector.parser.parseKeys("ysiwFbaz"))
assertState("foo = ${c}baz( bar )")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundSpace() {
configureByText("foo(b${c}ar)")
typeText(injector.parser.parseKeys("csbs"))
assertState("foo${c} bar")
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatSurround() {
val before = "if ${c}condition {\n}\n"
val after = "if ((condition)) {\n}\n"
@ -155,7 +139,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("ysiw)", "l", "."), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatSurroundDouble() {
val before = "if ${c}condition {\n}\n"
val after = "if (((condition))) {\n}\n"
@ -163,7 +146,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("ysiw)", "l", ".", "l", "."), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatDifferentChanges() {
val before = """
if "${c}condition" { }
@ -177,7 +159,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("ysiw)", "cs\"'", "j", "."), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatWrapWithFunction() {
val before = """
if "${c}condition" { }
@ -197,7 +178,6 @@ class VimSurroundExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatWrapWithTag() {
val before = """
${c}abc
@ -213,7 +193,6 @@ class VimSurroundExtensionTest : VimTestCase() {
/* visual surround */
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testVisualSurroundWordParens() {
val before = "if ${c}condition {\n" + "}\n"
val after = "if ${c}(condition) {\n" + "}\n"
@ -231,7 +210,6 @@ class VimSurroundExtensionTest : VimTestCase() {
/* Delete surroundings */
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingParens() {
val before = "if (${c}condition) {\n" + "}\n"
val after = "if condition {\n" + "}\n"
@ -241,7 +219,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ds)", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingQuote() {
val before = "if (\"${c}foo\".equals(foo)) {\n" + "}\n"
val after = "if (${c}foo.equals(foo)) {\n" + "}\n"
@ -249,7 +226,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ds\"", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingBlock() {
val before = "if (condition) {${c}return;}\n"
val after = "if (condition) return;\n"
@ -259,7 +235,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ds{", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingArray() {
val before = "int foo = bar[${c}index];"
val after = "int foo = barindex;"
@ -269,7 +244,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ds[", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingAngle() {
val before = "foo = new Bar<${c}Baz>();"
val after = "foo = new BarBaz();"
@ -279,7 +253,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("ds<", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingTag() {
val before = "<div><p>${c}Foo</p></div>"
val after = "<div>${c}Foo</div>"
@ -288,7 +261,6 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-1085
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteSurroundingParamsAtLineEnd() {
val before = "Foo\n" + "Seq(\"-${c}Yrangepos\")\n"
val after = "Foo\n" + "Seq\"-Yrangepos\"\n"
@ -297,7 +269,6 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-1085
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteMultiLineSurroundingParamsAtLineEnd() {
val before = "Foo\n" +
"Bar\n" +
@ -314,7 +285,6 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-2227
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testDeleteInvalidSurroundingCharacter() {
val text = "if (${c}condition) {"
@ -324,7 +294,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("yibds{", text, text, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatDeleteSurroundParens() {
val before = "if ((${c}condition)) {\n}\n"
val after = "if condition {\n}\n"
@ -332,7 +301,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("dsb."), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatDeleteSurroundQuotes() {
val before = "if (\"${c}condition\") {\n}\n"
val after = "if (condition) {\n}\n"
@ -342,7 +310,6 @@ class VimSurroundExtensionTest : VimTestCase() {
/* Change surroundings */
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testChangeSurroundingParens() {
val before = "if (${c}condition) {\n" + "}\n"
val after = "if [condition] {\n" + "}\n"
@ -350,7 +317,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("csbr"), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testChangeSurroundingBlock() {
val before = "if (condition) {${c}return;}"
val after = "if (condition) (return;)"
@ -358,7 +324,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("csBb"), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testChangeSurroundingTagSimple() {
val before = "<div><p>${c}Foo</p></div>"
val after = "<div>${c}(Foo)</div>"
@ -366,7 +331,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("cstb"), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testChangeSurroundingTagAnotherTag() {
val before = "<div><p>${c}Foo</p></div>"
val after = "<div>${c}<b>Foo</b></div>"
@ -374,7 +338,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("cst<b>"), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testRepeatChangeSurroundingParens() {
val before = "foo(${c}index)(index2) = bar;"
val after = "foo[index][index2] = bar;"
@ -383,7 +346,6 @@ class VimSurroundExtensionTest : VimTestCase() {
}
// VIM-2227
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testChangeInvalidSurroundingCharacter() {
val text = "if (${c}condition) {"
@ -404,7 +366,6 @@ class VimSurroundExtensionTest : VimTestCase() {
<p>Some text</p>
"""
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test wrap with tag full line`() {
doTest(
listOf("VS<p>"),
@ -437,7 +398,6 @@ class VimSurroundExtensionTest : VimTestCase() {
</div>
"""
)
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test wrap with tag full line in middle`() {
doTest(
listOf("VS<p>"),
@ -459,7 +419,6 @@ class VimSurroundExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test wrap line with char selection`() {
doTest(
listOf("vawES<p>"),
@ -481,7 +440,6 @@ class VimSurroundExtensionTest : VimTestCase() {
)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testWithAnExistingMapping() {
val before = "(foo)"
val after = "[foo]"
@ -493,7 +451,6 @@ class VimSurroundExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test change new line`() {
val before = """
"\n"
@ -505,7 +462,6 @@ class VimSurroundExtensionTest : VimTestCase() {
assertState(after)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testMappingSurroundPlugin() {
val before = "if (condition) ${c}return;\n"
val after = "if (condition) \"return\";\n"
@ -513,7 +469,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(":map gw ysiw\"<CR>gw", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundPluginWithMacro() {
val before = """
if (con${c}dition) return;
@ -527,7 +482,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest("qqds)qj@q", before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun testSurroundPluginWithMacroAndMapping() {
val before = """
if (con${c}dition) return;
@ -542,7 +496,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test change surround with multicaret`() {
val before = """
(${c}abc)
@ -556,7 +509,6 @@ class VimSurroundExtensionTest : VimTestCase() {
doTest(listOf("cs(]"), before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
}
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
fun `test delete surround with multicaret`() {
val before = """
(${c}abc)

View File

@ -64,7 +64,7 @@ class IncrementDecrementTest : VimPropertyTestBase() {
moveCaretToRandomPlace(env, editor)
NeovimTesting.setupEditor(editor, this)
NeovimTesting.typeCommand(":set nrformats+=octal<CR>", this)
NeovimTesting.typeCommand(":set nrformats+=octal<CR>", this, editor)
env.executeCommands(Generator.sampledFrom(IncrementDecrementActions(editor, this)))
@ -84,7 +84,7 @@ private class IncrementDecrementActions(private val editor: Editor, val test: Vi
val action = injector.parser.parseKeys(key).single()
env.logMessage("Use command: ${injector.parser.toKeyNotation(action)}.")
VimTestCase.typeText(listOf(action), editor, editor.project)
NeovimTesting.typeCommand(key, test)
NeovimTesting.typeCommand(key, test, editor)
IdeEventQueue.getInstance().flushQueue()
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()

View File

@ -158,8 +158,8 @@ abstract class VimChangeGroupBase : VimChangeGroup {
}
}
if (type == null ||
operatorArguments.mode.inInsertMode || caret.registerStorage.storeText(editor, updatedRange, type, true)
|| caret != editor.primaryCaret() // sticky tape for VIM-2703 todo remove in the next release
operatorArguments.mode.inInsertMode || caret.registerStorage.storeText(editor, updatedRange, type, true) ||
caret != editor.primaryCaret() // sticky tape for VIM-2703 todo remove in the next release
) {
val startOffsets = updatedRange.startOffsets
val endOffsets = updatedRange.endOffsets

View File

@ -179,7 +179,8 @@ abstract class VimOptionServiceBase : OptionService {
}
},
ToggleOption(OptionConstants.experimentalapiName, OptionConstants.experimentalapiAlias, false)
ToggleOption(OptionConstants.experimentalapiName, OptionConstants.experimentalapiAlias, false),
ToggleOption("closenotebooks", "closenotebooks", true),
)
private val globalValues = mutableMapOf<String, VimDataType>()

View File

@ -35,6 +35,18 @@ import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
data class CmdCommand(val ranges: Ranges, val argument: String) : Command.SingleExecution(ranges) {
override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_OPTIONAL, Access.READ_ONLY)
private val unsupportedArgs = listOf(
Regex("-range(=[^ ])?") to "-range",
Regex("-complete=[^ ]*") to "-complete",
Regex("-count=[^ ]*") to "-count",
Regex("-addr=[^ ]*") to "-addr",
Regex("-bang") to "-bang",
Regex("-bar") to "-bar",
Regex("-register") to "-register",
Regex("-buffer") to "-buffer",
Regex("-keepscript") to "-keepscript",
)
// Static definitions needed for aliases.
private companion object {
const val overridePrefix = "!"
@ -76,6 +88,14 @@ data class CmdCommand(val ranges: Ranges, val argument: String) : Command.Single
argument = argument.removePrefix(overridePrefix).trim()
}
for ((arg, message) in unsupportedArgs) {
val match = arg.find(argument)
match?.range?.let {
argument = argument.removeRange(it)
injector.messages.showStatusBarMessage("'$message' is not supported by `command`")
}
}
// Handle alias arguments
val hasArguments = argument.startsWith(argsPrefix)
var minNumberOfArgs = 0

View File

@ -30,7 +30,6 @@ data class Register(val char: Char) : Expression() {
override fun evaluate(editor: VimEditor, context: ExecutionContext, vimContext: VimLContext): VimDataType {
val register = injector.registerGroup.getRegister(char) ?: throw ExException("Register is not supported yet")
// todo Esc like keys should be one char
return VimString(injector.parser.toKeyNotation(register.keys))
return VimString(injector.parser.toPrintableString(register.keys))
}
}

View File

@ -112,6 +112,8 @@ interface VariableService {
*/
fun unlockVariable(variable: Variable, depth: Int, editor: VimEditor, context: ExecutionContext, vimContext: VimLContext)
fun getGlobalVariables(): Map<String, VimDataType>
/**
* Clears all global variables
*/

View File

@ -71,6 +71,10 @@ abstract class VimVariableServiceBase : VariableService {
value.unlockVar(depth)
}
override fun getGlobalVariables(): Map<String, VimDataType> {
return globalVariables
}
override fun storeVariable(variable: Variable, value: VimDataType, editor: VimEditor, context: ExecutionContext, vimContext: VimLContext) {
val scope = variable.scope ?: getDefaultVariableScope(vimContext)
val name = variable.name.evaluate(editor, context, vimContext).value