mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-09-15 17:32:14 +02:00
Compare commits
102 Commits
86bf723791
...
customized
Author | SHA1 | Date | |
---|---|---|---|
9f469d0eb2
|
|||
f59d2f769c
|
|||
dc00b59733
|
|||
bc20e6af9c
|
|||
c40f07714a
|
|||
fa68842c2d
|
|||
eca9258607
|
|||
46fb030977
|
|||
![]() |
da3d83ecc6 | ||
![]() |
4af8e574c4 | ||
![]() |
bdcb5c4f33 | ||
![]() |
013f7a42c2 | ||
![]() |
d03398f3e8 | ||
![]() |
7a26307a2b | ||
![]() |
fa6a0369b8 | ||
![]() |
ad8cb0ba09 | ||
![]() |
8125ce5072 | ||
![]() |
6c0cc7285f | ||
![]() |
d3424021c8 | ||
![]() |
623aa40acd | ||
![]() |
c131cb338e | ||
![]() |
14d242a233 | ||
![]() |
a131b7d29a | ||
![]() |
85a1fbe89e | ||
![]() |
142550a1f8 | ||
![]() |
e3d3b73903 | ||
![]() |
45f18ff91c | ||
![]() |
2103163207 | ||
![]() |
19dd49670c | ||
![]() |
e738a1a821 | ||
![]() |
6e0f301fb8 | ||
![]() |
c76b8db293 | ||
![]() |
9fa4ca8fb3 | ||
![]() |
871b60fe8d | ||
![]() |
6715a5b61f | ||
![]() |
d7d91f1cc5 | ||
![]() |
9f00dbd6f4 | ||
![]() |
f95cf3d671 | ||
![]() |
7fbc17624f | ||
![]() |
b9c2ea37cb | ||
![]() |
ca0db15e01 | ||
![]() |
c32c62eacc | ||
![]() |
43a79dbad4 | ||
![]() |
2829a13187 | ||
![]() |
efc8c9207d | ||
![]() |
183ed10592 | ||
![]() |
926b47a31e | ||
![]() |
d272c919ea | ||
![]() |
f6e7d04fd5 | ||
![]() |
ccdff4f087 | ||
![]() |
ff14303e88 | ||
![]() |
48a592340b | ||
![]() |
da8f5f3231 | ||
![]() |
f8fa8b73fa | ||
![]() |
aee126b625 | ||
![]() |
396ac86939 | ||
![]() |
81816f903f | ||
![]() |
06a85b784b | ||
![]() |
7f1e3bb155 | ||
![]() |
241f554133 | ||
![]() |
9498d0779c | ||
![]() |
b12fd5100f | ||
![]() |
92f622430d | ||
![]() |
ef518f5b23 | ||
![]() |
7acb17ebdb | ||
![]() |
479a7dbbaf | ||
![]() |
4fd1a25557 | ||
![]() |
f32d42e625 | ||
![]() |
362b9a5c3a | ||
![]() |
e42b4d0ea3 | ||
![]() |
43767b8500 | ||
![]() |
d05098c870 | ||
![]() |
505f485568 | ||
![]() |
86f512fb91 | ||
![]() |
12903066b9 | ||
![]() |
118d0433cb | ||
![]() |
eb781c3679 | ||
![]() |
3c6bffba03 | ||
![]() |
89623b04d6 | ||
![]() |
444a96132c | ||
![]() |
c008553127 | ||
![]() |
162d7b021f | ||
![]() |
c82364c1dd | ||
![]() |
977402c6b0 | ||
![]() |
b14e59ab5b | ||
![]() |
47dcefcfbf | ||
![]() |
2b299cb422 | ||
![]() |
d0ccbb4620 | ||
![]() |
187b207271 | ||
![]() |
a3e22c844c | ||
![]() |
f8384b2732 | ||
![]() |
2dae43258c | ||
![]() |
48033ecb85 | ||
![]() |
ad8df027ac | ||
![]() |
91f580771d | ||
![]() |
9c6f0981f5 | ||
![]() |
2212569688 | ||
![]() |
6711f1dbab | ||
![]() |
0b7a883efb | ||
![]() |
8ae84c62c0 | ||
![]() |
0d168c8115 | ||
c7b51b7fa5 |
4
.teamcity/_Self/Constants.kt
vendored
4
.teamcity/_Self/Constants.kt
vendored
@@ -5,8 +5,8 @@ object Constants {
|
|||||||
const val EAP_CHANNEL = "eap"
|
const val EAP_CHANNEL = "eap"
|
||||||
const val DEV_CHANNEL = "Dev"
|
const val DEV_CHANNEL = "Dev"
|
||||||
|
|
||||||
const val VERSION = "1.10.3"
|
const val VERSION = "1.11.1"
|
||||||
const val DEV_VERSION = "1.11.0"
|
const val DEV_VERSION = "1.12.0"
|
||||||
|
|
||||||
const val GITHUB_TESTS = "LATEST-EAP-SNAPSHOT"
|
const val GITHUB_TESTS = "LATEST-EAP-SNAPSHOT"
|
||||||
const val NVIM_TESTS = "LATEST-EAP-SNAPSHOT"
|
const val NVIM_TESTS = "LATEST-EAP-SNAPSHOT"
|
||||||
|
2
.teamcity/_Self/Project.kt
vendored
2
.teamcity/_Self/Project.kt
vendored
@@ -6,6 +6,7 @@ import _Self.buildTypes.Nvim
|
|||||||
import _Self.buildTypes.PluginVerifier
|
import _Self.buildTypes.PluginVerifier
|
||||||
import _Self.buildTypes.PropertyBased
|
import _Self.buildTypes.PropertyBased
|
||||||
import _Self.buildTypes.Qodana
|
import _Self.buildTypes.Qodana
|
||||||
|
import _Self.buildTypes.TestsForIntelliJ20222
|
||||||
import _Self.buildTypes.TestsForIntelliJEAP
|
import _Self.buildTypes.TestsForIntelliJEAP
|
||||||
import _Self.subprojects.GitHub
|
import _Self.subprojects.GitHub
|
||||||
import _Self.subprojects.OldTests
|
import _Self.subprojects.OldTests
|
||||||
@@ -39,6 +40,7 @@ object Project : Project({
|
|||||||
|
|
||||||
// Builds
|
// Builds
|
||||||
buildType(TestsForIntelliJEAP)
|
buildType(TestsForIntelliJEAP)
|
||||||
|
buildType(TestsForIntelliJ20222)
|
||||||
|
|
||||||
buildType(PropertyBased)
|
buildType(PropertyBased)
|
||||||
buildType(LongRunning)
|
buildType(LongRunning)
|
||||||
|
2
.teamcity/_Self/buildTypes/ActiveTests.kt
vendored
2
.teamcity/_Self/buildTypes/ActiveTests.kt
vendored
@@ -55,4 +55,4 @@ sealed class ActiveTests(buildName: String, ijVersion: String) : BuildType({
|
|||||||
})
|
})
|
||||||
|
|
||||||
object TestsForIntelliJEAP : ActiveTests("Tests for IntelliJ Latest EAP", "LATEST-EAP-SNAPSHOT")
|
object TestsForIntelliJEAP : ActiveTests("Tests for IntelliJ Latest EAP", "LATEST-EAP-SNAPSHOT")
|
||||||
//object TestsForIntelliJ20213 : ActiveTests("Tests for IntelliJ 2021.3", "2021.3.2")
|
object TestsForIntelliJ20222 : ActiveTests("Tests for IntelliJ 2022.2", "2022.2.1")
|
||||||
|
69
AUTHORS.md
69
AUTHORS.md
@@ -32,16 +32,48 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/yole)
|
[![icon][github]](https://github.com/yole)
|
||||||
|
|
||||||
Dmitry Jemerov
|
Dmitry Jemerov
|
||||||
|
* [![icon][mail]](mailto:tony.kay@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/awkay)
|
||||||
|
|
||||||
|
Tony Kay
|
||||||
|
* [![icon][mail]](mailto:jamescmartinez@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/jamescmartinez)
|
||||||
|
|
||||||
|
James Martinez
|
||||||
|
* [![icon][mail]](mailto:almas337519@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/strogiyotec)
|
||||||
|
|
||||||
|
strogiyotec
|
||||||
|
* [![icon][mail]](mailto:raimon49@hotmail.com)
|
||||||
|
[![icon][github]](https://github.com/raimon49)
|
||||||
|
|
||||||
|
raimon
|
||||||
|
* [![icon][mail]](mailto:agrsbm@gmail.com)
|
||||||
|
[![icon][github-off]](#)
|
||||||
|
|
||||||
|
Alexander Griesbaum
|
||||||
|
* [![icon][mail]](mailto:manwe64@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/baldrs)
|
||||||
|
|
||||||
|
Baldrs
|
||||||
|
* [![icon][mail]](mailto:yury@shurup.com)
|
||||||
|
[![icon][github]](https://github.com/zyv)
|
||||||
|
|
||||||
|
Yury V. Zaytsev
|
||||||
|
* [![icon][mail]](mailto:jflorian@doubledog.org)
|
||||||
|
[![icon][github]](https://github.com/jflorian)
|
||||||
|
|
||||||
|
John Florian
|
||||||
* [![icon][mail]](mailto:marquis@marquiswang.com)
|
* [![icon][mail]](mailto:marquis@marquiswang.com)
|
||||||
[![icon][github]](https://github.com/marquiswang)
|
[![icon][github]](https://github.com/marquiswang)
|
||||||
|
|
||||||
Marquis Wang
|
Marquis Wang
|
||||||
* [![icon][mail]](mailto:madgnome@gmail.com)
|
* [![icon][mail]](mailto:madgnome@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/madgnome)
|
||||||
|
|
||||||
Julien Hoarau
|
Julien Hoarau
|
||||||
* [![icon][mail]](mailto:masanobu.imai@gmail.com)
|
* [![icon][mail]](mailto:masanobu.imai@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/masanobuimai)
|
||||||
|
|
||||||
Masanobu Imai
|
Masanobu Imai
|
||||||
* [![icon][mail]](mailto:poxvuibr@gmail.com)
|
* [![icon][mail]](mailto:poxvuibr@gmail.com)
|
||||||
@@ -57,7 +89,7 @@ Contributors:
|
|||||||
|
|
||||||
John Lindquist
|
John Lindquist
|
||||||
* [![icon][mail]](mailto:iklotzko@ltech.com)
|
* [![icon][mail]](mailto:iklotzko@ltech.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/iklotzko)
|
||||||
|
|
||||||
Ira Klotzko
|
Ira Klotzko
|
||||||
* [![icon][mail]](mailto:alex@selesse.com)
|
* [![icon][mail]](mailto:alex@selesse.com)
|
||||||
@@ -65,7 +97,7 @@ Contributors:
|
|||||||
|
|
||||||
Alex Selesse
|
Alex Selesse
|
||||||
* [![icon][mail]](mailto:dbennett@palantir.com)
|
* [![icon][mail]](mailto:dbennett@palantir.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/dathanb)
|
||||||
|
|
||||||
Dathan Bennett
|
Dathan Bennett
|
||||||
* [![icon][mail]](mailto:kphayen@gmail.com)
|
* [![icon][mail]](mailto:kphayen@gmail.com)
|
||||||
@@ -77,11 +109,11 @@ Contributors:
|
|||||||
|
|
||||||
Alexey Shmalko
|
Alexey Shmalko
|
||||||
* [![icon][mail]](mailto:a.m.brookins@gmail.com)
|
* [![icon][mail]](mailto:a.m.brookins@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/abrookins)
|
||||||
|
|
||||||
Andrew Brookins
|
Andrew Brookins
|
||||||
* [![icon][mail]](mailto:changwang83@gmail.com)
|
* [![icon][mail]](mailto:changwang83@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/changwang)
|
||||||
|
|
||||||
Chang Wang
|
Chang Wang
|
||||||
* [![icon][mail]](mailto:josejaime.sanchez@gmail.com)
|
* [![icon][mail]](mailto:josejaime.sanchez@gmail.com)
|
||||||
@@ -89,19 +121,19 @@ Contributors:
|
|||||||
|
|
||||||
Jaime Sanchez
|
Jaime Sanchez
|
||||||
* [![icon][mail]](mailto:thomas@homburg.dk)
|
* [![icon][mail]](mailto:thomas@homburg.dk)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/homburg)
|
||||||
|
|
||||||
Thomas B Homburg
|
Thomas B Homburg
|
||||||
* [![icon][mail]](mailto:smartbomb@server.fake)
|
* [![icon][mail]](mailto:smartbomb@server.fake)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/smartbomb)
|
||||||
|
|
||||||
smartbomb
|
smartbomb
|
||||||
* [![icon][mail]](mailto:tuomas.tynkkynen@iki.fi)
|
* [![icon][mail]](mailto:tuomas.tynkkynen@iki.fi)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/dezgeg)
|
||||||
|
|
||||||
Tuomas Tynkkynen
|
Tuomas Tynkkynen
|
||||||
* [![icon][mail]](mailto:jackson@donorschoose.org)
|
* [![icon][mail]](mailto:jackson@donorschoose.org)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/jdpopkin)
|
||||||
|
|
||||||
Jackson Popkin
|
Jackson Popkin
|
||||||
* [![icon][mail]](mailto:yuyuyu1999@gmail.com)
|
* [![icon][mail]](mailto:yuyuyu1999@gmail.com)
|
||||||
@@ -109,7 +141,7 @@ Contributors:
|
|||||||
|
|
||||||
Teruo Kunihiro
|
Teruo Kunihiro
|
||||||
* [![icon][mail]](mailto:lubashka.994@mail.ru)
|
* [![icon][mail]](mailto:lubashka.994@mail.ru)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/lubba)
|
||||||
|
|
||||||
Liubov Paina
|
Liubov Paina
|
||||||
* [![icon][mail]](mailto:me@dhleong.net)
|
* [![icon][mail]](mailto:me@dhleong.net)
|
||||||
@@ -137,7 +169,7 @@ Contributors:
|
|||||||
|
|
||||||
tieTYT
|
tieTYT
|
||||||
* [![icon][mail]](mailto:nickgieschen@gmail.com)
|
* [![icon][mail]](mailto:nickgieschen@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/nickgieschen)
|
||||||
|
|
||||||
Nick Gieschen
|
Nick Gieschen
|
||||||
* [![icon][mail]](mailto:ikenox@gmail.com)
|
* [![icon][mail]](mailto:ikenox@gmail.com)
|
||||||
@@ -149,7 +181,7 @@ Contributors:
|
|||||||
|
|
||||||
Maximilian Luz
|
Maximilian Luz
|
||||||
* [![icon][mail]](mailto:vparfinenko@excelsior-usa.com)
|
* [![icon][mail]](mailto:vparfinenko@excelsior-usa.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/cypok)
|
||||||
|
|
||||||
Vladimir Parfinenko
|
Vladimir Parfinenko
|
||||||
* [![icon][mail]](mailto:hassmann@hwdev.de)
|
* [![icon][mail]](mailto:hassmann@hwdev.de)
|
||||||
@@ -193,7 +225,7 @@ Contributors:
|
|||||||
|
|
||||||
Marcel Hild
|
Marcel Hild
|
||||||
* [![icon][mail]](mailto:vedranb@gmail.com)
|
* [![icon][mail]](mailto:vedranb@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github]](https://github.com/vedran)
|
||||||
|
|
||||||
Vedran Budimcic
|
Vedran Budimcic
|
||||||
* [![icon][mail]](mailto:andreigasparovici1@gmail.com)
|
* [![icon][mail]](mailto:andreigasparovici1@gmail.com)
|
||||||
@@ -208,10 +240,13 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/TonyArra)
|
[![icon][github]](https://github.com/TonyArra)
|
||||||
|
|
||||||
Tony Arra
|
Tony Arra
|
||||||
* [![icon][mail]](mailto:bradziolko@gmail.com)
|
* [![icon][mail]](mailto:mj@ziolko.dev)
|
||||||
[![icon][github]](https://github.com/bradziolko)
|
[![icon][github]](https://github.com/mjziolko)
|
||||||
|
|
||||||
Brad Ziolko
|
Madeline Ziolko
|
||||||
|
[Original contribution from:
|
||||||
|
[![icon][mail]](mailto:bradziolko@gmail.com)
|
||||||
|
[![icon][github]](https://github.com/bradziolko)]
|
||||||
* [![icon][mail]](mailto:sumoooru2@gmail.com)
|
* [![icon][mail]](mailto:sumoooru2@gmail.com)
|
||||||
[![icon][github]](https://github.com/sumoooru2)
|
[![icon][github]](https://github.com/sumoooru2)
|
||||||
|
|
||||||
|
17
CHANGES.md
17
CHANGES.md
@@ -25,6 +25,17 @@ usual beta standards.
|
|||||||
|
|
||||||
## To Be Released
|
## To Be Released
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* [VIM-1758](https://youtrack.jetbrains.com/issue/VIM-1758) Commentary plugin in rider
|
||||||
|
* [VIM-1903](https://youtrack.jetbrains.com/issue/VIM-1903) Autoindent now works in rider
|
||||||
|
* [VIM-2744](https://youtrack.jetbrains.com/issue/VIM-2744) Fix undo from ex line
|
||||||
|
* [VIM-2749](https://youtrack.jetbrains.com/issue/VIM-2749) Fix :tabn and :tabN commands
|
||||||
|
* [VIM-2718](https://youtrack.jetbrains.com/issue/VIM-2718) Fixed case where the primary caret was changed
|
||||||
|
* [VIM-2766](https://youtrack.jetbrains.com/issue/VIM-2766) Move NERDTree update to background thread
|
||||||
|
* [VIM-2768](https://youtrack.jetbrains.com/issue/VIM-2768) Refactor listeners
|
||||||
|
|
||||||
|
## 1.11.0, 2022-08-09
|
||||||
|
|
||||||
### Features:
|
### Features:
|
||||||
* Add `gcu` command for Commentary plugin
|
* Add `gcu` command for Commentary plugin
|
||||||
* Add `:Commentary` command, which works great for commands such as `:%g/fun/Commentary`
|
* Add `:Commentary` command, which works great for commands such as `:%g/fun/Commentary`
|
||||||
@@ -53,12 +64,14 @@ usual beta standards.
|
|||||||
* [VIM-2595](https://youtrack.jetbrains.com/issue/VIM-2595) Support plugins in macro execution
|
* [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-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-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-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-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-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-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-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:
|
### Merged PRs:
|
||||||
* [468](https://github.com/JetBrains/ideavim/pull/468) by [Thomas Schouten](https://github.com/PHPirates): Implement UserDataHolder for EditorDataContext
|
* [468](https://github.com/JetBrains/ideavim/pull/468) by [Thomas Schouten](https://github.com/PHPirates): Implement UserDataHolder for EditorDataContext
|
||||||
@@ -70,6 +83,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
|
* [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
|
* [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
|
* [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
|
## 1.10.0, 2022-02-17
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ OK, ready to do some coding?
|
|||||||
Yoo hoo! You’re all set to begin contributing.
|
Yoo hoo! You’re all set to begin contributing.
|
||||||
We've prepared some useful configurations for you:
|
We've prepared some useful configurations for you:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
And here are useful gradle commands:
|
And here are useful gradle commands:
|
||||||
|
|
||||||
|
13
README.md
13
README.md
@@ -11,7 +11,7 @@ IdeaVim
|
|||||||
[![Gitter][gitter-svg]][gitter]
|
[![Gitter][gitter-svg]][gitter]
|
||||||
[![Twitter][twitter-svg]][twitter]
|
[![Twitter][twitter-svg]][twitter]
|
||||||
|
|
||||||
IdeaVim is a Vim emulation plugin for IntelliJ Platform-based IDEs.
|
IdeaVim is a Vim engine for JetBrains IDEs.
|
||||||
|
|
||||||
##### Contact maintainers:
|
##### Contact maintainers:
|
||||||
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
|
* [Bug tracker](https://youtrack.jetbrains.com/issues/VIM)
|
||||||
@@ -36,7 +36,7 @@ Setup
|
|||||||
- IdeaVim can be installed via `Settings | Plugins`.
|
- IdeaVim can be installed via `Settings | Plugins`.
|
||||||
See the [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
|
See the [detailed instructions](https://www.jetbrains.com/help/idea/managing-plugins.html#).
|
||||||
|
|
||||||
- Use `Tools | Vim Emulator` in the menu to enable or disable emulation.
|
- Use `Tools | Vim` in the menu to enable or disable vim.
|
||||||
|
|
||||||
- Use the `~/.ideavimrc` file as an analog of `~/.vimrc` ([learn more](#Files)). The XDG standard is supported, as well.
|
- Use the `~/.ideavimrc` file as an analog of `~/.vimrc` ([learn more](#Files)). The XDG standard is supported, as well.
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ Here are some examples of supported vim features and commands:
|
|||||||
* Vim web help
|
* Vim web help
|
||||||
* `~/.ideavimrc` configuration file
|
* `~/.ideavimrc` configuration file
|
||||||
|
|
||||||
[Emulated Vim plugins](https://github.com/JetBrains/ideavim/wiki/Emulated-plugins):
|
[IdeaVim plugins](https://github.com/JetBrains/ideavim/wiki/Emulated-plugins):
|
||||||
|
|
||||||
* vim-easymotion
|
* vim-easymotion
|
||||||
* NERDTree
|
* NERDTree
|
||||||
@@ -198,7 +198,7 @@ Alternatively, you can set up initialization commands using [XDG](https://specif
|
|||||||
Put your settings to `$XDG_CONFIG_HOME/ideavim/ideavimrc` file.
|
Put your settings to `$XDG_CONFIG_HOME/ideavim/ideavimrc` file.
|
||||||
|
|
||||||
|
|
||||||
Emulated Vim Plugins
|
IdeaVim Plugins
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
See [doc/emulated-plugins.md](https://github.com/JetBrains/ideavim/wiki/Emulated-plugins)
|
See [doc/emulated-plugins.md](https://github.com/JetBrains/ideavim/wiki/Emulated-plugins)
|
||||||
@@ -226,7 +226,10 @@ Ex commands or via `:map` command mappings:
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><strong>"Track action Ids" Details</strong> (click to see)</summary>
|
<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>
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
BIN
assets/contributing/configs-dark.png
Normal file
BIN
assets/contributing/configs-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
assets/contributing/configs-light.png
Normal file
BIN
assets/contributing/configs-light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
BIN
assets/readme/track_action_dark.gif
Normal file
BIN
assets/readme/track_action_dark.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
Before Width: | Height: | Size: 2.1 MiB |
BIN
assets/readme/track_action_light.gif
Normal file
BIN
assets/readme/track_action_light.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 981 KiB |
@@ -15,7 +15,9 @@ buildscript {
|
|||||||
classpath("com.github.AlexPl292:mark-down-to-slack:1.1.2")
|
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.eclipse.jgit:org.eclipse.jgit:6.1.0.202203080745-r")
|
||||||
classpath("org.kohsuke:github-api:1.305")
|
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
|
java
|
||||||
kotlin("jvm") version "1.6.21"
|
kotlin("jvm") version "1.6.21"
|
||||||
|
|
||||||
id("org.jetbrains.intellij") version "1.7.0-SNAPSHOT"
|
id("org.jetbrains.intellij") version "1.10.0-SNAPSHOT"
|
||||||
id("org.jetbrains.changelog") version "1.3.1"
|
id("org.jetbrains.changelog") version "1.3.1"
|
||||||
|
|
||||||
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
|
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
|
||||||
@@ -164,6 +166,18 @@ tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain {
|
||||||
|
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
tasks.compileJava {
|
tasks.compileJava {
|
||||||
// options.compilerArgs.add("-Werror")
|
// options.compilerArgs.add("-Werror")
|
||||||
@@ -273,7 +287,7 @@ changelog {
|
|||||||
itemPrefix.set("*")
|
itemPrefix.set("*")
|
||||||
path.set("${project.projectDir}/CHANGES.md")
|
path.set("${project.projectDir}/CHANGES.md")
|
||||||
unreleasedTerm.set("To Be Released")
|
unreleasedTerm.set("To Be Released")
|
||||||
headerParserRegex.set("\\d\\.\\d+(.\\d+)?".toRegex())
|
headerParserRegex.set("(\\d\\.\\d+(.\\d+)?)".toRegex())
|
||||||
// header = { "${project.version}" }
|
// header = { "${project.version}" }
|
||||||
// version = "0.60"
|
// version = "0.60"
|
||||||
}
|
}
|
||||||
@@ -326,13 +340,22 @@ tasks.register("slackNotification") {
|
|||||||
println("Response code: $postRc")
|
println("Response code: $postRc")
|
||||||
if (postRc == 200) {
|
if (postRc == 200) {
|
||||||
println(inputStream.bufferedReader().use { it.readText() })
|
println(inputStream.bufferedReader().use { it.readText() })
|
||||||
|
} else {
|
||||||
|
println(errorStream.bufferedReader().use { it.readText() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Update authors
|
// Uncomment to enable FUS testing mode
|
||||||
|
// tasks {
|
||||||
|
// withType<org.jetbrains.intellij.tasks.RunIdeTask> {
|
||||||
|
// jvmArgs("-Didea.is.internal=true")
|
||||||
|
// jvmArgs("-Dfus.internal.test.mode=true")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// --- Update authors
|
||||||
tasks.register("updateAuthors") {
|
tasks.register("updateAuthors") {
|
||||||
doLast {
|
doLast {
|
||||||
val uncheckedEmails = setOf(
|
val uncheckedEmails = setOf(
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
ideaVersion=LATEST-EAP-SNAPSHOT
|
ideaVersion=2022.2.2
|
||||||
downloadIdeaSources=true
|
downloadIdeaSources=true
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=SNAPSHOT
|
version=chylex-13
|
||||||
javaVersion=11
|
javaVersion=17
|
||||||
remoteRobotVersion=0.11.15
|
remoteRobotVersion=0.11.15
|
||||||
antlrVersion=4.10.1
|
antlrVersion=4.10.1
|
||||||
|
|
||||||
|
|
||||||
# Please don't forget to update kotlin version in buildscript section
|
# Please don't forget to update kotlin version in buildscript section
|
||||||
kotlinVersion=1.6.21
|
kotlinVersion=1.6.21
|
||||||
publishToken=token
|
publishToken=token
|
||||||
|
@@ -27,6 +27,7 @@ import com.intellij.openapi.editor.EditorFactory;
|
|||||||
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
||||||
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
|
||||||
import com.intellij.openapi.editor.event.*;
|
import com.intellij.openapi.editor.event.*;
|
||||||
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.maddyhome.idea.vim.helper.HandlerInjector;
|
import com.maddyhome.idea.vim.helper.HandlerInjector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -101,32 +102,41 @@ public class EventFacade {
|
|||||||
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
|
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
|
public void addEditorMouseListener(@NotNull Editor editor,
|
||||||
editor.addEditorMouseListener(listener);
|
@NotNull EditorMouseListener listener,
|
||||||
|
@NotNull Disposable disposable) {
|
||||||
|
editor.addEditorMouseListener(listener, disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
|
public void removeEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
|
||||||
editor.removeEditorMouseListener(listener);
|
editor.removeEditorMouseListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
|
public void addComponentMouseListener(@NotNull Component component,
|
||||||
|
@NotNull MouseListener mouseListener,
|
||||||
|
@NotNull Disposable disposable) {
|
||||||
component.addMouseListener(mouseListener);
|
component.addMouseListener(mouseListener);
|
||||||
|
Disposer.register(disposable, () -> component.removeMouseListener(mouseListener));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
|
public void removeComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
|
||||||
component.removeMouseListener(mouseListener);
|
component.removeMouseListener(mouseListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
|
public void addEditorMouseMotionListener(@NotNull Editor editor,
|
||||||
editor.addEditorMouseMotionListener(listener);
|
@NotNull EditorMouseMotionListener listener,
|
||||||
|
@NotNull Disposable disposable) {
|
||||||
|
editor.addEditorMouseMotionListener(listener, disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
|
public void removeEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
|
||||||
editor.removeEditorMouseMotionListener(listener);
|
editor.removeEditorMouseMotionListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
|
public void addEditorSelectionListener(@NotNull Editor editor,
|
||||||
editor.getSelectionModel().addSelectionListener(listener);
|
@NotNull SelectionListener listener,
|
||||||
|
@NotNull Disposable disposable) {
|
||||||
|
editor.getSelectionModel().addSelectionListener(listener, disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
|
public void removeEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
|
||||||
|
@@ -18,8 +18,14 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim
|
package com.maddyhome.idea.vim
|
||||||
|
|
||||||
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
|
import com.intellij.openapi.project.ProjectManagerListener
|
||||||
import com.intellij.openapi.startup.StartupActivity
|
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
|
* @author Alex Plate
|
||||||
@@ -36,3 +42,19 @@ class PluginStartup : StartupActivity.DumbAware/*, LightEditCompatible*/ {
|
|||||||
VimPlugin.getInstance().initialize()
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -114,7 +114,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
LOG.debug("disposeComponent");
|
LOG.debug("disposeComponent");
|
||||||
turnOffPlugin();
|
turnOffPlugin(false);
|
||||||
LOG.debug("done");
|
LOG.debug("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
if (isEnabled() == enabled) return;
|
if (isEnabled() == enabled) return;
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
getInstance().turnOffPlugin();
|
getInstance().turnOffPlugin(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getInstance().enabled = enabled;
|
getInstance().enabled = enabled;
|
||||||
@@ -365,12 +365,14 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
VimListenerManager.INSTANCE.turnOn();
|
VimListenerManager.INSTANCE.turnOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void turnOffPlugin() {
|
private void turnOffPlugin(boolean unsubscribe) {
|
||||||
SearchGroup searchGroup = getSearchIfCreated();
|
SearchGroup searchGroup = getSearchIfCreated();
|
||||||
if (searchGroup != null) {
|
if (searchGroup != null) {
|
||||||
searchGroup.turnOff();
|
searchGroup.turnOff();
|
||||||
}
|
}
|
||||||
VimListenerManager.INSTANCE.turnOff();
|
if (unsubscribe) {
|
||||||
|
VimListenerManager.INSTANCE.turnOff();
|
||||||
|
}
|
||||||
ExEntryPanel.fullReset();
|
ExEntryPanel.fullReset();
|
||||||
|
|
||||||
// Unregister vim actions in command mode
|
// Unregister vim actions in command mode
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package com.maddyhome.idea.vim.action
|
package com.maddyhome.idea.vim.action
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
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")
|
if (VimPlugin.isEnabled()) MessageHelper.message("action.VimPluginToggle.enabled") else MessageHelper.message("action.VimPluginToggle.enable")
|
||||||
} else MessageHelper.message("action.VimPluginToggle.text")
|
} else MessageHelper.message("action.VimPluginToggle.text")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.action
|
|||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import com.intellij.codeInsight.lookup.LookupManager
|
import com.intellij.codeInsight.lookup.LookupManager
|
||||||
import com.intellij.openapi.actionSystem.ActionManager
|
import com.intellij.openapi.actionSystem.ActionManager
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.EmptyAction
|
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) {
|
override fun update(e: AnActionEvent) {
|
||||||
val start = if (traceTime) System.currentTimeMillis() else null
|
val start = if (traceTime) System.currentTimeMillis() else null
|
||||||
e.presentation.isEnabled = isEnabled(e)
|
e.presentation.isEnabled = isEnabled(e)
|
||||||
@@ -148,6 +153,10 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
|||||||
if (keyCode == KeyEvent.VK_TAB && editor.isTemplateActive()) return false
|
if (keyCode == KeyEvent.VK_TAB && editor.isTemplateActive()) return false
|
||||||
|
|
||||||
if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ENTER) && editor.appCodeTemplateCaptured()) return false
|
if ((keyCode == KeyEvent.VK_TAB || keyCode == KeyEvent.VK_ENTER) && editor.appCodeTemplateCaptured()) return false
|
||||||
|
|
||||||
|
if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT) return false
|
||||||
|
if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN) return false
|
||||||
|
if (keyCode == KeyEvent.VK_HOME || keyCode == KeyEvent.VK_END) return false
|
||||||
|
|
||||||
if (editor.inInsertMode) {
|
if (editor.inInsertMode) {
|
||||||
if (keyCode == KeyEvent.VK_TAB) {
|
if (keyCode == KeyEvent.VK_TAB) {
|
||||||
|
@@ -22,6 +22,7 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
@@ -40,7 +41,7 @@ import com.maddyhome.idea.vim.newapi.ij
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
||||||
val operatorFunction = VimPlugin.getKey().operatorFunction
|
val operatorFunction = injector.keyGroup.operatorFunction
|
||||||
if (operatorFunction == null) {
|
if (operatorFunction == null) {
|
||||||
VimPlugin.showMessage(MessageHelper.message("E774"))
|
VimPlugin.showMessage(MessageHelper.message("E774"))
|
||||||
return false
|
return false
|
||||||
@@ -49,7 +50,7 @@ private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textR
|
|||||||
val saveRepeatHandler = VimRepeater.repeatHandler
|
val saveRepeatHandler = VimRepeater.repeatHandler
|
||||||
VimPlugin.getMark().setChangeMarks(editor, textRange)
|
VimPlugin.getMark().setChangeMarks(editor, textRange)
|
||||||
KeyHandler.getInstance().reset(editor)
|
KeyHandler.getInstance().reset(editor)
|
||||||
val result = operatorFunction.apply(editor.ij, context.ij, selectionType)
|
val result = operatorFunction.apply(editor, context, selectionType)
|
||||||
VimRepeater.repeatHandler = saveRepeatHandler
|
VimRepeater.repeatHandler = saveRepeatHandler
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ object VimExtensionFacade {
|
|||||||
/** Sets the value of 'operatorfunc' to be used as the operator function in 'g@'. */
|
/** Sets the value of 'operatorfunc' to be used as the operator function in 'g@'. */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setOperatorFunction(function: OperatorFunction) {
|
fun setOperatorFunction(function: OperatorFunction) {
|
||||||
VimPlugin.getKey().setOperatorFunction(function)
|
VimPlugin.getKey().operatorFunction = function
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +186,7 @@ object VimExtensionFacade {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||||
val reg = caret.registerStorage.getRegister(register) ?: return null
|
val reg = caret.registerStorage.getRegister(caret, register) ?: return null
|
||||||
return reg.keys
|
return reg.keys
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ object VimExtensionFacade {
|
|||||||
/** Set the current contents of the given register */
|
/** Set the current contents of the given register */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setRegisterForCaret(register: Char, caret: VimCaret, keys: List<KeyStroke?>?) {
|
fun setRegisterForCaret(register: Char, caret: VimCaret, keys: List<KeyStroke?>?) {
|
||||||
caret.registerStorage.setKeys(register, keys?.filterNotNull() ?: emptyList())
|
caret.registerStorage.setKeys(caret, register, keys?.filterNotNull() ?: emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the current contents of the given register */
|
/** Set the current contents of the given register */
|
||||||
|
@@ -17,10 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.maddyhome.idea.vim.extension.commentary
|
package com.maddyhome.idea.vim.extension.commentary
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.codeInsight.actions.AsyncActionExecutionService
|
||||||
import com.intellij.openapi.actionSystem.IdeActions
|
import com.intellij.openapi.actionSystem.IdeActions
|
||||||
import com.intellij.openapi.application.runWriteAction
|
import com.intellij.openapi.application.runWriteAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.openapi.util.Ref
|
||||||
import com.intellij.psi.PsiComment
|
import com.intellij.psi.PsiComment
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiFile
|
import com.intellij.psi.PsiFile
|
||||||
@@ -56,47 +57,65 @@ import com.maddyhome.idea.vim.helper.vimStateMachine
|
|||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class CommentaryExtension : VimExtension {
|
class CommentaryExtension : VimExtension {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun doCommentary(editor: VimEditor, context: ExecutionContext, range: TextRange, selectionType: SelectionType, resetCaret: Boolean): Boolean {
|
fun doCommentary(
|
||||||
|
editor: VimEditor,
|
||||||
|
context: ExecutionContext,
|
||||||
|
range: TextRange,
|
||||||
|
selectionType: SelectionType,
|
||||||
|
resetCaret: Boolean,
|
||||||
|
): Boolean {
|
||||||
val mode = editor.vimStateMachine.mode
|
val mode = editor.vimStateMachine.mode
|
||||||
if (mode !== VimStateMachine.Mode.VISUAL) {
|
if (mode !== VimStateMachine.Mode.VISUAL) {
|
||||||
editor.ij.selectionModel.setSelection(range.startOffset, range.endOffset)
|
editor.ij.selectionModel.setSelection(range.startOffset, range.endOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
return runWriteAction {
|
return runWriteAction {
|
||||||
try {
|
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
|
||||||
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
|
// isn't available
|
||||||
// isn't available
|
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
||||||
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
||||||
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
} else {
|
||||||
} else {
|
listOf(IdeActions.ACTION_COMMENT_BLOCK, IdeActions.ACTION_COMMENT_LINE)
|
||||||
listOf(IdeActions.ACTION_COMMENT_BLOCK, IdeActions.ACTION_COMMENT_LINE)
|
|
||||||
}
|
|
||||||
|
|
||||||
injector.actionExecutor.executeAction(actions[0], context) ||
|
|
||||||
injector.actionExecutor.executeAction(actions[1], context)
|
|
||||||
} finally {
|
|
||||||
// Remove the selection, if we added it
|
|
||||||
if (mode !== VimStateMachine.Mode.VISUAL) {
|
|
||||||
editor.removeSelection()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Put the caret back at the start of the range, as though it was moved by the operator's motion argument.
|
|
||||||
// This is what Vim does. If IntelliJ is configured to add comments at the start of the line, this might put
|
|
||||||
// the caret in the "wrong" place. E.g. gc_ should put the caret on the first non-whitespace character. This
|
|
||||||
// is calculated by the motion, saved in the marks, and then we insert the comment. If it's inserted at the
|
|
||||||
// first non-whitespace character, then the caret is in the right place. If it's inserted at the first column,
|
|
||||||
// then the caret is now in a bit of a weird place. We can't detect this scenario, so we just have to accept
|
|
||||||
// the difference
|
|
||||||
if (resetCaret) {
|
|
||||||
editor.primaryCaret().moveToOffset(range.startOffset)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val res = Ref.create<Boolean>(true)
|
||||||
|
AsyncActionExecutionService.getInstance(editor.ij.project!!).withExecutionAfterAction(actions[0], {
|
||||||
|
res.set(injector.actionExecutor.executeAction(actions[0], context))
|
||||||
|
}, { afterCommenting(mode, editor, resetCaret, range) })
|
||||||
|
if (!res.get()) {
|
||||||
|
AsyncActionExecutionService.getInstance(editor.ij.project!!).withExecutionAfterAction(actions[1], {
|
||||||
|
res.set(injector.actionExecutor.executeAction(actions[1], context))
|
||||||
|
}, { afterCommenting(mode, editor, resetCaret, range) })
|
||||||
|
}
|
||||||
|
res.get()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun afterCommenting(
|
||||||
|
mode: VimStateMachine.Mode,
|
||||||
|
editor: VimEditor,
|
||||||
|
resetCaret: Boolean,
|
||||||
|
range: TextRange,
|
||||||
|
) {
|
||||||
|
// Remove the selection, if we added it
|
||||||
|
if (mode !== VimStateMachine.Mode.VISUAL) {
|
||||||
|
editor.removeSelection()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put the caret back at the start of the range, as though it was moved by the operator's motion argument.
|
||||||
|
// This is what Vim does. If IntelliJ is configured to add comments at the start of the line, this might put
|
||||||
|
// the caret in the "wrong" place. E.g. gc_ should put the caret on the first non-whitespace character. This
|
||||||
|
// is calculated by the motion, saved in the marks, and then we insert the comment. If it's inserted at the
|
||||||
|
// first non-whitespace character, then the caret is in the right place. If it's inserted at the first column,
|
||||||
|
// then the caret is now in a bit of a weird place. We can't detect this scenario, so we just have to accept
|
||||||
|
// the difference
|
||||||
|
if (resetCaret) {
|
||||||
|
editor.primaryCaret().moveToOffset(range.startOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +131,13 @@ class CommentaryExtension : VimExtension {
|
|||||||
|
|
||||||
putKeyMappingIfMissing(MappingMode.NXO, injector.parser.parseKeys("gc"), owner, plugCommentaryKeys, true)
|
putKeyMappingIfMissing(MappingMode.NXO, injector.parser.parseKeys("gc"), owner, plugCommentaryKeys, true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gcc"), owner, plugCommentaryLineKeys, true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gcc"), owner, plugCommentaryLineKeys, true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gcu"), owner, injector.parser.parseKeys("<Plug>Commentary<Plug>Commentary"), true)
|
putKeyMappingIfMissing(
|
||||||
|
MappingMode.N,
|
||||||
|
injector.parser.parseKeys("gcu"),
|
||||||
|
owner,
|
||||||
|
injector.parser.parseKeys("<Plug>Commentary<Plug>Commentary"),
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
// Previous versions of IdeaVim used different mappings to Vim's Commentary. Make sure everything works if someone
|
// Previous versions of IdeaVim used different mappings to Vim's Commentary. Make sure everything works if someone
|
||||||
// is still using the old mapping
|
// is still using the old mapping
|
||||||
@@ -132,14 +157,19 @@ class CommentaryExtension : VimExtension {
|
|||||||
private class CommentaryOperatorHandler : OperatorFunction, ExtensionHandler {
|
private class CommentaryOperatorHandler : OperatorFunction, ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
|
// In this operator we process selection by ourselves. This is necessary for rider, VIM-1758
|
||||||
|
override fun postProcessSelection(): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
setOperatorFunction(this)
|
setOperatorFunction(this)
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun apply(editor: Editor, context: DataContext, selectionType: SelectionType): Boolean {
|
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType): Boolean {
|
||||||
val range = VimPlugin.getMark().getChangeMarks(editor.vim) ?: return false
|
val range = VimPlugin.getMark().getChangeMarks(editor) ?: return false
|
||||||
return doCommentary(editor.vim, context.vim, range, selectionType, true)
|
return doCommentary(editor, context, range, selectionType, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +204,7 @@ class CommentaryExtension : VimExtension {
|
|||||||
context: ExecutionContext,
|
context: ExecutionContext,
|
||||||
count: Int,
|
count: Int,
|
||||||
rawCount: Int,
|
rawCount: Int,
|
||||||
argument: Argument?
|
argument: Argument?,
|
||||||
): TextRange? {
|
): TextRange? {
|
||||||
|
|
||||||
val nativeEditor = (editor as IjVimEditor).editor
|
val nativeEditor = (editor as IjVimEditor).editor
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.extension.exchange
|
package com.maddyhome.idea.vim.extension.exchange
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.application.runWriteAction
|
import com.intellij.openapi.application.runWriteAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.LogicalPosition
|
import com.intellij.openapi.editor.LogicalPosition
|
||||||
@@ -133,7 +132,7 @@ class VimExchangeExtension : VimExtension {
|
|||||||
val subMode = editor.subMode
|
val subMode = editor.subMode
|
||||||
// Leave visual mode to create selection marks
|
// Leave visual mode to create selection marks
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||||
Operator(true).apply(editor.ij, context.ij, SelectionType.fromSubMode(subMode))
|
Operator(true).apply(editor, context, SelectionType.fromSubMode(subMode))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,7 +146,8 @@ class VimExchangeExtension : VimExtension {
|
|||||||
else -> error("Invalid SubMode: $this")
|
else -> error("Invalid SubMode: $this")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun apply(editor: Editor, context: DataContext, selectionType: SelectionType): Boolean {
|
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType): Boolean {
|
||||||
|
val editor = vimEditor.ij
|
||||||
fun highlightExchange(ex: Exchange): RangeHighlighter {
|
fun highlightExchange(ex: Exchange): RangeHighlighter {
|
||||||
val attributes = editor.colorsScheme.getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES)
|
val attributes = editor.colorsScheme.getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES)
|
||||||
val hlArea = when (ex.type) {
|
val hlArea = when (ex.type) {
|
||||||
|
@@ -233,7 +233,7 @@ private object FileTypePatterns {
|
|||||||
} else if (fileTypeName == "CMakeLists.txt" || fileName == "CMakeLists") {
|
} else if (fileTypeName == "CMakeLists.txt" || fileName == "CMakeLists") {
|
||||||
this.cMakePatterns
|
this.cMakePatterns
|
||||||
} else {
|
} else {
|
||||||
return null
|
this.htmlPatterns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@ package com.maddyhome.idea.vim.extension.nerdtree
|
|||||||
import com.intellij.ide.projectView.ProjectView
|
import com.intellij.ide.projectView.ProjectView
|
||||||
import com.intellij.ide.projectView.impl.ProjectViewImpl
|
import com.intellij.ide.projectView.impl.ProjectViewImpl
|
||||||
import com.intellij.openapi.actionSystem.ActionManager
|
import com.intellij.openapi.actionSystem.ActionManager
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
@@ -172,7 +173,7 @@ class NerdTree : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ProjectViewListener(private val project: Project) : ToolWindowManagerListener {
|
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
|
if (ToolWindowId.PROJECT_VIEW != toolWindow.id) return
|
||||||
|
|
||||||
val dispatcher = NerdDispatcher.getInstance(project)
|
val dispatcher = NerdDispatcher.getInstance(project)
|
||||||
@@ -242,6 +243,8 @@ class NerdTree : VimExtension {
|
|||||||
e.presentation.isEnabled = !speedSearchIsHere(project)
|
e.presentation.isEnabled = !speedSearchIsHere(project)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.EDT
|
||||||
|
|
||||||
private fun speedSearchIsHere(project: Project): Boolean {
|
private fun speedSearchIsHere(project: Project): Boolean {
|
||||||
val component = ProjectView.getInstance(project).currentProjectViewPane.tree ?: return false
|
val component = ProjectView.getInstance(project).currentProjectViewPane.tree ?: return false
|
||||||
return SpeedSearchSupply.getSupply(component) != null
|
return SpeedSearchSupply.getSupply(component) != null
|
||||||
@@ -342,7 +345,7 @@ class NerdTree : VimExtension {
|
|||||||
if (file.isDirectory) return@Code
|
if (file.isDirectory) return@Code
|
||||||
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
||||||
val currentWindow = splitters.currentWindow
|
val currentWindow = splitters.currentWindow
|
||||||
currentWindow.split(SwingConstants.HORIZONTAL, true, file, true)
|
currentWindow?.split(SwingConstants.HORIZONTAL, true, file, true)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
registerCommand(
|
registerCommand(
|
||||||
@@ -351,7 +354,7 @@ class NerdTree : VimExtension {
|
|||||||
val file = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return@Code
|
val file = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return@Code
|
||||||
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
||||||
val currentWindow = splitters.currentWindow
|
val currentWindow = splitters.currentWindow
|
||||||
currentWindow.split(SwingConstants.VERTICAL, true, file, true)
|
currentWindow?.split(SwingConstants.VERTICAL, true, file, true)
|
||||||
|
|
||||||
// FIXME: 22.01.2021 This solution bouncing a bit
|
// FIXME: 22.01.2021 This solution bouncing a bit
|
||||||
callAction("ActivateProjectToolWindow", context.vim)
|
callAction("ActivateProjectToolWindow", context.vim)
|
||||||
@@ -363,7 +366,7 @@ class NerdTree : VimExtension {
|
|||||||
val file = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return@Code
|
val file = event.getData(CommonDataKeys.VIRTUAL_FILE) ?: return@Code
|
||||||
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
val splitters = FileEditorManagerEx.getInstanceEx(project).splitters
|
||||||
val currentWindow = splitters.currentWindow
|
val currentWindow = splitters.currentWindow
|
||||||
currentWindow.split(SwingConstants.HORIZONTAL, true, file, true)
|
currentWindow?.split(SwingConstants.HORIZONTAL, true, file, true)
|
||||||
|
|
||||||
callAction("ActivateProjectToolWindow", context.vim)
|
callAction("ActivateProjectToolWindow", context.vim)
|
||||||
}
|
}
|
||||||
@@ -560,7 +563,3 @@ class NerdTree : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T> Node<T>.addLeafs(keys: String, actionHolder: T) {
|
|
||||||
addLeafs(injector.parser.parseKeys(keys), actionHolder)
|
|
||||||
}
|
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.extension.replacewithregister
|
package com.maddyhome.idea.vim.extension.replacewithregister
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
@@ -115,21 +114,22 @@ class ReplaceWithRegister : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class Operator : OperatorFunction {
|
private class Operator : OperatorFunction {
|
||||||
override fun apply(editor: Editor, context: DataContext, selectionType: SelectionType): Boolean {
|
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType): Boolean {
|
||||||
|
val editor = (vimEditor as IjVimEditor).editor
|
||||||
val range = getRange(editor) ?: return false
|
val range = getRange(editor) ?: return false
|
||||||
val visualSelection = PutData.VisualSelection(
|
val visualSelection = PutData.VisualSelection(
|
||||||
mapOf(
|
mapOf(
|
||||||
editor.caretModel.primaryCaret.vim to VimSelection.create(
|
vimEditor.primaryCaret() to VimSelection.create(
|
||||||
range.startOffset,
|
range.startOffset,
|
||||||
range.endOffset - 1,
|
range.endOffset - 1,
|
||||||
selectionType,
|
selectionType,
|
||||||
IjVimEditor(editor)
|
vimEditor
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
selectionType
|
selectionType
|
||||||
)
|
)
|
||||||
// todo multicaret
|
// todo multicaret
|
||||||
doReplace(editor, editor.vim.primaryCaret(), visualSelection)
|
doReplace(editor, vimEditor.primaryCaret(), visualSelection)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class ReplaceWithRegister : VimExtension {
|
|||||||
|
|
||||||
private fun doReplace(editor: Editor, caret: VimCaret, visualSelection: PutData.VisualSelection) {
|
private fun doReplace(editor: Editor, caret: VimCaret, visualSelection: PutData.VisualSelection) {
|
||||||
val lastRegisterChar = injector.registerGroup.lastRegisterChar
|
val lastRegisterChar = injector.registerGroup.lastRegisterChar
|
||||||
val savedRegister = caret.registerStorage.getRegister(lastRegisterChar) ?: return
|
val savedRegister = caret.registerStorage.getRegister(caret, lastRegisterChar) ?: return
|
||||||
|
|
||||||
var usedType = savedRegister.type
|
var usedType = savedRegister.type
|
||||||
var usedText = savedRegister.text
|
var usedText = savedRegister.text
|
||||||
@@ -185,8 +185,8 @@ class ReplaceWithRegister : VimExtension {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
caret.registerStorage.saveRegister(savedRegister.name, savedRegister)
|
caret.registerStorage.saveRegister(caret, savedRegister.name, savedRegister)
|
||||||
caret.registerStorage.saveRegister(VimPlugin.getRegister().defaultRegister, savedRegister)
|
caret.registerStorage.saveRegister(caret, VimPlugin.getRegister().defaultRegister, savedRegister)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.maddyhome.idea.vim.extension.surround
|
package com.maddyhome.idea.vim.extension.surround
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.application.runWriteAction
|
import com.intellij.openapi.application.runWriteAction
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
|
import com.maddyhome.idea.vim.api.VimChangeGroup
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
@@ -40,6 +40,7 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissin
|
|||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
|
||||||
import com.maddyhome.idea.vim.helper.editorMode
|
import com.maddyhome.idea.vim.helper.editorMode
|
||||||
|
import com.maddyhome.idea.vim.helper.runWithEveryCaretAndRestore
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||||
@@ -85,22 +86,20 @@ class VimSurroundExtension : VimExtension {
|
|||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
setOperatorFunction(Operator())
|
setOperatorFunction(Operator(supportsMultipleCursors = false)) // TODO
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VSurroundHandler : ExtensionHandler {
|
private class VSurroundHandler : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
val selectionStart = editor.ij.caretModel.primaryCaret.selectionStart
|
|
||||||
// NB: Operator ignores SelectionType anyway
|
// NB: Operator ignores SelectionType anyway
|
||||||
if (!Operator().apply(editor.ij, context.ij, SelectionType.CHARACTER_WISE)) {
|
if (!Operator(supportsMultipleCursors = true).apply(editor, context, SelectionType.CHARACTER_WISE)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
// Leave visual mode
|
// Leave visual mode
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||||
editor.ij.caretModel.moveToOffset(selectionStart)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,6 +120,10 @@ class VimSurroundExtension : VimExtension {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun change(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
fun change(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
||||||
|
editor.ij.runWithEveryCaretAndRestore { changeAtCaret(editor, context, charFrom, newSurround) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun changeAtCaret(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
||||||
// Save old register values for carets
|
// Save old register values for carets
|
||||||
val surroundings = editor.sortedCarets()
|
val surroundings = editor.sortedCarets()
|
||||||
.map {
|
.map {
|
||||||
@@ -219,25 +222,44 @@ class VimSurroundExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Operator : OperatorFunction {
|
private class Operator(private val supportsMultipleCursors: Boolean) : OperatorFunction {
|
||||||
override fun apply(editor: Editor, context: DataContext, selectionType: SelectionType): Boolean {
|
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType): Boolean {
|
||||||
|
val editor = vimEditor.ij
|
||||||
val c = getChar(editor)
|
val c = getChar(editor)
|
||||||
if (c.code == 0) return true
|
if (c.code == 0) return true
|
||||||
|
|
||||||
val pair = getOrInputPair(c, editor) ?: return false
|
val pair = getOrInputPair(c, editor) ?: return false
|
||||||
// XXX: Will it work with line-wise or block-wise selections?
|
|
||||||
val range = getSurroundRange(editor) ?: return false
|
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
val change = VimPlugin.getChange()
|
val change = VimPlugin.getChange()
|
||||||
val leftSurround = pair.first
|
if (supportsMultipleCursors) {
|
||||||
val primaryCaret = editor.caretModel.primaryCaret
|
editor.runWithEveryCaretAndRestore {
|
||||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, leftSurround)
|
applyOnce(editor, change, pair)
|
||||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.endOffset + leftSurround.length, pair.second)
|
}
|
||||||
// Jump back to start
|
}
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
|
else {
|
||||||
|
applyOnce(editor, change, pair)
|
||||||
|
// Jump back to start
|
||||||
|
executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun applyOnce(editor: Editor, change: VimChangeGroup, pair: Pair<String, String>) {
|
||||||
|
// XXX: Will it work with line-wise or block-wise selections?
|
||||||
|
val range = getSurroundRange(editor)
|
||||||
|
if (range != null) {
|
||||||
|
val primaryCaret = editor.caretModel.primaryCaret
|
||||||
|
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, pair.first)
|
||||||
|
change.insertText(
|
||||||
|
IjVimEditor(editor),
|
||||||
|
IjVimCaret(primaryCaret),
|
||||||
|
range.endOffset + pair.first.length,
|
||||||
|
pair.second
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getSurroundRange(editor: Editor): TextRange? = when (editor.editorMode) {
|
private fun getSurroundRange(editor: Editor): TextRange? = when (editor.editorMode) {
|
||||||
VimStateMachine.Mode.COMMAND -> VimPlugin.getMark().getChangeMarks(editor.vim)
|
VimStateMachine.Mode.COMMAND -> VimPlugin.getMark().getChangeMarks(editor.vim)
|
||||||
|
@@ -20,7 +20,10 @@ package com.maddyhome.idea.vim.group;
|
|||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.intellij.codeInsight.actions.AsyncActionExecutionService;
|
||||||
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
|
import com.intellij.openapi.actionSystem.IdeActions;
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.command.CommandProcessor;
|
import com.intellij.openapi.command.CommandProcessor;
|
||||||
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
import com.intellij.openapi.command.UndoConfirmationPolicy;
|
||||||
@@ -33,6 +36,9 @@ import com.intellij.openapi.editor.event.EditorMouseEvent;
|
|||||||
import com.intellij.openapi.editor.event.EditorMouseListener;
|
import com.intellij.openapi.editor.event.EditorMouseListener;
|
||||||
import com.intellij.openapi.editor.impl.TextRangeInterval;
|
import com.intellij.openapi.editor.impl.TextRangeInterval;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.openapi.ui.MessageType;
|
||||||
|
import com.intellij.openapi.ui.popup.Balloon;
|
||||||
|
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||||
import com.intellij.openapi.util.text.StringUtil;
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||||
@@ -48,13 +54,19 @@ import com.maddyhome.idea.vim.ex.ranges.LineRange;
|
|||||||
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
import com.maddyhome.idea.vim.group.visual.VimSelection;
|
||||||
import com.maddyhome.idea.vim.group.visual.VisualModeHelperKt;
|
import com.maddyhome.idea.vim.group.visual.VisualModeHelperKt;
|
||||||
import com.maddyhome.idea.vim.helper.*;
|
import com.maddyhome.idea.vim.helper.*;
|
||||||
|
import com.maddyhome.idea.vim.icons.VimIcons;
|
||||||
import com.maddyhome.idea.vim.key.KeyHandlerKeeper;
|
import com.maddyhome.idea.vim.key.KeyHandlerKeeper;
|
||||||
import com.maddyhome.idea.vim.listener.VimInsertListener;
|
import com.maddyhome.idea.vim.listener.VimInsertListener;
|
||||||
import com.maddyhome.idea.vim.newapi.*;
|
import com.maddyhome.idea.vim.newapi.IjExecutionContext;
|
||||||
|
import com.maddyhome.idea.vim.newapi.IjExecutionContextKt;
|
||||||
|
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
||||||
|
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants;
|
import com.maddyhome.idea.vim.options.OptionConstants;
|
||||||
import com.maddyhome.idea.vim.options.OptionScope;
|
import com.maddyhome.idea.vim.options.OptionScope;
|
||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
|
||||||
import kotlin.Pair;
|
import kotlin.Pair;
|
||||||
|
import kotlin.Unit;
|
||||||
|
import kotlin.jvm.functions.Function0;
|
||||||
import kotlin.text.StringsKt;
|
import kotlin.text.StringsKt;
|
||||||
import org.jetbrains.annotations.NonNls;
|
import org.jetbrains.annotations.NonNls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -85,6 +97,8 @@ public class ChangeGroup extends VimChangeGroupBase {
|
|||||||
|
|
||||||
private final List<VimInsertListener> insertListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
private final List<VimInsertListener> insertListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||||
|
|
||||||
|
private long lastShownTime = 0L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts a new line above the caret position
|
* Inserts a new line above the caret position
|
||||||
*
|
*
|
||||||
@@ -142,14 +156,12 @@ public class ChangeGroup extends VimChangeGroupBase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
public void editorCreated(Editor editor, @NotNull Disposable disposable) {
|
||||||
public void editorCreated(VimEditor editor) {
|
EventFacade.getInstance().addEditorMouseListener(editor, listener, disposable);
|
||||||
EventFacade.getInstance().addEditorMouseListener(((IjVimEditor) editor).getEditor(), listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void editorReleased(Editor editor) {
|
||||||
public void editorReleased(VimEditor editor) {
|
EventFacade.getInstance().removeEditorMouseListener(editor, listener);
|
||||||
EventFacade.getInstance().removeEditorMouseListener(((IjVimEditor) editor).getEditor(), listener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -571,17 +583,31 @@ public class ChangeGroup extends VimChangeGroupBase {
|
|||||||
final int startOffset = injector.getEngineEditorHelper().getLineStartForOffset(editor, range.getStartOffset());
|
final int startOffset = injector.getEngineEditorHelper().getLineStartForOffset(editor, range.getStartOffset());
|
||||||
final int endOffset = injector.getEngineEditorHelper().getLineEndForOffset(editor, range.getEndOffset());
|
final int endOffset = injector.getEngineEditorHelper().getLineEndForOffset(editor, range.getEndOffset());
|
||||||
|
|
||||||
VisualModeHelperKt.vimSetSystemSelectionSilently(((IjVimEditor) editor).getEditor().getSelectionModel(), startOffset, endOffset);
|
Editor ijEditor = ((IjVimEditor)editor).getEditor();
|
||||||
|
VisualModeHelperKt.vimSetSystemSelectionSilently(ijEditor.getSelectionModel(), startOffset, endOffset);
|
||||||
|
|
||||||
NativeAction joinLinesAction = VimInjectorKt.getInjector().getNativeActionManager().getIndentLines();
|
Project project = ijEditor.getProject();
|
||||||
if (joinLinesAction != null) {
|
Function0<Unit> actionExecution = () -> {
|
||||||
VimInjectorKt.getInjector().getActionExecutor().executeAction(joinLinesAction, context);
|
NativeAction joinLinesAction = VimInjectorKt.getInjector().getNativeActionManager().getIndentLines();
|
||||||
|
if (joinLinesAction != null) {
|
||||||
|
VimInjectorKt.getInjector().getActionExecutor().executeAction(joinLinesAction, context);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
Function0<Unit> afterAction = () -> {
|
||||||
|
final int firstLine = editor.offsetToLogicalPosition(Math.min(startOffset, endOffset)).getLine();
|
||||||
|
final int newOffset = VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, firstLine);
|
||||||
|
injector.getMotion().moveCaret(editor, caret, newOffset);
|
||||||
|
restoreCursor(editor, caret, ((IjVimCaret)caret).getCaret().getLogicalPosition().line);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
if (project != null) {
|
||||||
|
AsyncActionExecutionService.Companion.getInstance(project)
|
||||||
|
.withExecutionAfterAction(IdeActions.ACTION_EDITOR_AUTO_INDENT_LINES, actionExecution, afterAction);
|
||||||
|
} else {
|
||||||
|
actionExecution.invoke();
|
||||||
|
afterAction.invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
final int firstLine = editor.offsetToLogicalPosition(Math.min(startOffset, endOffset)).getLine();
|
|
||||||
final int newOffset = VimPlugin.getMotion().moveCaretToLineStartSkipLeading(editor, firstLine);
|
|
||||||
injector.getMotion().moveCaret(editor, caret, newOffset);
|
|
||||||
restoreCursor(editor, caret, ((IjVimCaret) caret).getCaret().getLogicalPosition().line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -773,6 +799,23 @@ public class ChangeGroup extends VimChangeGroupBase {
|
|||||||
@NotNull TextRange selectedRange,
|
@NotNull TextRange selectedRange,
|
||||||
final int count,
|
final int count,
|
||||||
boolean avalanche) {
|
boolean avalanche) {
|
||||||
|
|
||||||
|
// Just an easter egg
|
||||||
|
if (avalanche) {
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
if (currentTime - lastShownTime > 60_000) {
|
||||||
|
lastShownTime = currentTime;
|
||||||
|
ApplicationManager.getApplication().invokeLater(() -> {
|
||||||
|
final Balloon balloon = JBPopupFactory.getInstance()
|
||||||
|
.createHtmlTextBalloonBuilder("Wow, nice vim skills!", VimIcons.IDEAVIM,
|
||||||
|
MessageType.INFO.getTitleForeground(), MessageType.INFO.getPopupBackground(),
|
||||||
|
null).createBalloon();
|
||||||
|
balloon.show(JBPopupFactory.getInstance().guessBestPopupLocation(((IjVimEditor)editor).getEditor()),
|
||||||
|
Balloon.Position.below);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String nf = ((VimString) VimPlugin.getOptionService().getOptionValue(new OptionScope.LOCAL(editor), OptionConstants.nrformatsName, OptionConstants.nrformatsName)).getValue();
|
String nf = ((VimString) VimPlugin.getOptionService().getOptionValue(new OptionScope.LOCAL(editor), OptionConstants.nrformatsName, OptionConstants.nrformatsName)).getValue();
|
||||||
boolean alpha = nf.contains("alpha");
|
boolean alpha = nf.contains("alpha");
|
||||||
boolean hex = nf.contains("hex");
|
boolean hex = nf.contains("hex");
|
||||||
|
@@ -232,7 +232,7 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
|
|||||||
KeyHandler.getInstance().reset(new IjVimEditor(editor));
|
KeyHandler.getInstance().reset(new IjVimEditor(editor));
|
||||||
}
|
}
|
||||||
updateCaretsVisualAttributes(editor);
|
updateCaretsVisualAttributes(editor);
|
||||||
editor.getSettings().setRefrainFromScrolling(REFRAIN_FROM_SCROLLING_VIM_VALUE);
|
//editor.getSettings().setRefrainFromScrolling(REFRAIN_FROM_SCROLLING_VIM_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void editorDeinit(@NotNull Editor editor, boolean isReleased) {
|
public void editorDeinit(@NotNull Editor editor, boolean isReleased) {
|
||||||
|
@@ -20,6 +20,7 @@ package com.maddyhome.idea.vim.group;
|
|||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
import com.intellij.openapi.actionSystem.DataContext;
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.editor.Document;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.editor.Editor;
|
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.*;
|
||||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||||
import com.intellij.openapi.fileEditor.impl.EditorWindow;
|
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.FileType;
|
||||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
@@ -159,6 +161,10 @@ public class FileGroup extends VimFileBase {
|
|||||||
if (virtualFile != null && window != null) {
|
if (virtualFile != null && window != null) {
|
||||||
window.closeFile(virtualFile);
|
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) {
|
if (number >= 0 && number < editors.length) {
|
||||||
fileEditorManager.closeFile(editors[number], window);
|
fileEditorManager.closeFile(editors[number], window);
|
||||||
}
|
}
|
||||||
|
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||||
|
// This thing doesn't have an implementation in test mode
|
||||||
|
EditorsSplitters.focusDefaultComponentInSplittersIfPresent(project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -73,8 +73,6 @@ public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponen
|
|||||||
|
|
||||||
private static final Logger logger = Logger.getInstance(KeyGroup.class);
|
private static final Logger logger = Logger.getInstance(KeyGroup.class);
|
||||||
|
|
||||||
private @Nullable OperatorFunction operatorFunction = null;
|
|
||||||
|
|
||||||
public void registerRequiredShortcutKeys(@NotNull VimEditor editor) {
|
public void registerRequiredShortcutKeys(@NotNull VimEditor editor) {
|
||||||
EventFacade.getInstance()
|
EventFacade.getInstance()
|
||||||
.registerCustomShortcutSet(VimShortcutKeyAction.getInstance(), toShortcutSet(getRequiredShortcutKeys()),
|
.registerCustomShortcutSet(VimShortcutKeyAction.getInstance(), toShortcutSet(getRequiredShortcutKeys()),
|
||||||
@@ -119,14 +117,6 @@ public class KeyGroup extends VimKeyGroupBase implements PersistentStateComponen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable OperatorFunction getOperatorFunction() {
|
|
||||||
return operatorFunction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOperatorFunction(@NotNull OperatorFunction function) {
|
|
||||||
operatorFunction = function;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveData(@NotNull Element element) {
|
public void saveData(@NotNull Element element) {
|
||||||
final Element conflictsElement = new Element(SHORTCUT_CONFLICTS_ELEMENT);
|
final Element conflictsElement = new Element(SHORTCUT_CONFLICTS_ELEMENT);
|
||||||
for (Map.Entry<KeyStroke, ShortcutOwnerInfo> entry : myShortcutConflicts.entrySet()) {
|
for (Map.Entry<KeyStroke, ShortcutOwnerInfo> entry : myShortcutConflicts.entrySet()) {
|
||||||
|
@@ -23,8 +23,10 @@ import com.intellij.openapi.editor.ex.util.EditorUtil;
|
|||||||
import com.intellij.openapi.fileEditor.FileEditor;
|
import com.intellij.openapi.fileEditor.FileEditor;
|
||||||
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
|
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
|
||||||
import com.intellij.openapi.fileEditor.TextEditor;
|
import com.intellij.openapi.fileEditor.TextEditor;
|
||||||
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||||
import com.intellij.openapi.fileEditor.impl.EditorTabbedContainer;
|
import com.intellij.openapi.fileEditor.impl.EditorTabbedContainer;
|
||||||
import com.intellij.openapi.fileEditor.impl.EditorWindow;
|
import com.intellij.openapi.fileEditor.impl.EditorWindow;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||||
@@ -1168,15 +1170,25 @@ public class MotionGroup extends VimMotionGroupBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int moveCaretGotoPreviousTab(@NotNull VimEditor editor, @NotNull ExecutionContext context, int rawCount) {
|
public int moveCaretGotoPreviousTab(@NotNull VimEditor editor, @NotNull ExecutionContext context, int rawCount) {
|
||||||
switchEditorTab(EditorWindow.DATA_KEY.getData((DataContext)context.getContext()), rawCount >= 1 ? -rawCount : -1, false);
|
Project project = ((IjVimEditor)editor).getEditor().getProject();
|
||||||
|
if (project == null) {
|
||||||
|
return editor.currentCaret().getOffset().getPoint();
|
||||||
|
}
|
||||||
|
EditorWindow currentWindow = FileEditorManagerEx.getInstanceEx(project).getSplitters().getCurrentWindow();
|
||||||
|
switchEditorTab(currentWindow, rawCount >= 1 ? -rawCount : -1, false);
|
||||||
return editor.currentCaret().getOffset().getPoint();
|
return editor.currentCaret().getOffset().getPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int moveCaretGotoNextTab(@NotNull VimEditor editor, @NotNull ExecutionContext context, int rawCount) {
|
public int moveCaretGotoNextTab(@NotNull VimEditor editor, @NotNull ExecutionContext context, int rawCount) {
|
||||||
final boolean absolute = rawCount >= 1;
|
final boolean absolute = rawCount >= 1;
|
||||||
switchEditorTab(EditorWindow.DATA_KEY.getData((DataContext)context.getContext()), absolute ? rawCount - 1 : 1,
|
|
||||||
absolute);
|
Project project = ((IjVimEditor)editor).getEditor().getProject();
|
||||||
|
if (project == null) {
|
||||||
|
return editor.currentCaret().getOffset().getPoint();
|
||||||
|
}
|
||||||
|
EditorWindow currentWindow = FileEditorManagerEx.getInstanceEx(project).getSplitters().getCurrentWindow();
|
||||||
|
switchEditorTab(currentWindow, absolute ? rawCount - 1 : 1, absolute);
|
||||||
return editor.currentCaret().getOffset().getPoint();
|
return editor.currentCaret().getOffset().getPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ import com.intellij.notification.Notification
|
|||||||
import com.intellij.notification.NotificationGroup
|
import com.intellij.notification.NotificationGroup
|
||||||
import com.intellij.notification.NotificationGroupManager
|
import com.intellij.notification.NotificationGroupManager
|
||||||
import com.intellij.notification.NotificationType
|
import com.intellij.notification.NotificationType
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
@@ -221,6 +222,8 @@ class NotificationService(private val project: Project?) {
|
|||||||
override fun update(e: AnActionEvent) {
|
override fun update(e: AnActionEvent) {
|
||||||
e.presentation.isEnabled = id != null
|
e.presentation.isEnabled = id != null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
|
||||||
class StopTracking : DumbAwareAction("Stop Tracking") {
|
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"
|
val actionText = if (VimRcService.findIdeaVimRc() != null) "Open ~/.ideavimrc" else "Create ~/.ideavimrc"
|
||||||
e.presentation.text = actionText
|
e.presentation.text = actionText
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DialogTitleCapitalization")
|
@Suppress("DialogTitleCapitalization")
|
||||||
|
@@ -92,7 +92,7 @@ public class ProcessGroup extends VimProcessGroupBase {
|
|||||||
String initText = getRange(((IjVimEditor) editor).getEditor(), cmd);
|
String initText = getRange(((IjVimEditor) editor).getEditor(), cmd);
|
||||||
VimStateMachine.getInstance(editor).pushModes(VimStateMachine.Mode.CMD_LINE, VimStateMachine.SubMode.NONE);
|
VimStateMachine.getInstance(editor).pushModes(VimStateMachine.Mode.CMD_LINE, VimStateMachine.SubMode.NONE);
|
||||||
ExEntryPanel panel = ExEntryPanel.getInstance();
|
ExEntryPanel panel = ExEntryPanel.getInstance();
|
||||||
panel.activate(((IjVimEditor) editor).getEditor(), ((IjExecutionContext) context).getContext(), ":", initText, 1);
|
panel.activate(((IjVimEditor) editor).getEditor(), ((IjExecutionContext) context).getContext(), ":", initText, cmd.getCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,7 +123,7 @@ public class ProcessGroup extends VimProcessGroupBase {
|
|||||||
|
|
||||||
logger.debug("processing command");
|
logger.debug("processing command");
|
||||||
|
|
||||||
final String text = panel.getText();
|
String text = panel.getText();
|
||||||
|
|
||||||
if (!panel.getLabel().equals(":")) {
|
if (!panel.getLabel().equals(":")) {
|
||||||
// Search is handled via Argument.Type.EX_STRING. Although ProcessExEntryAction is registered as the handler for
|
// Search is handled via Argument.Type.EX_STRING. Although ProcessExEntryAction is registered as the handler for
|
||||||
@@ -134,7 +134,15 @@ public class ProcessGroup extends VimProcessGroupBase {
|
|||||||
|
|
||||||
if (logger.isDebugEnabled()) logger.debug("swing=" + SwingUtilities.isEventDispatchThread());
|
if (logger.isDebugEnabled()) logger.debug("swing=" + SwingUtilities.isEventDispatchThread());
|
||||||
|
|
||||||
VimInjectorKt.getInjector().getVimscriptExecutor().execute(text, editor, context, skipHistory(editor), true, CommandLineVimLContext.INSTANCE);
|
int repeat = 1;
|
||||||
|
if (text.contains("raction ")) {
|
||||||
|
text = text.replace("raction ", "action ");
|
||||||
|
repeat = panel.getCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < repeat; i++) {
|
||||||
|
VimInjectorKt.getInjector().getVimscriptExecutor().execute(text, editor, context, skipHistory(editor), true, CommandLineVimLContext.INSTANCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (ExException e) {
|
catch (ExException e) {
|
||||||
VimPlugin.showMessage(e.getMessage());
|
VimPlugin.showMessage(e.getMessage());
|
||||||
|
@@ -61,7 +61,10 @@ internal fun Project.createLineBookmark(editor: Editor, line: Int, mnemonic: Cha
|
|||||||
val type = BookmarkType.get(mnemonic)
|
val type = BookmarkType.get(mnemonic)
|
||||||
if (type == BookmarkType.DEFAULT) return null
|
if (type == BookmarkType.DEFAULT) return null
|
||||||
|
|
||||||
val group = bookmarksManager.defaultGroup ?: bookmarksManager.addGroup("IdeaVim", true) ?: return null
|
val group = bookmarksManager.defaultGroup
|
||||||
|
?: bookmarksManager.getGroup("IdeaVim")
|
||||||
|
?: bookmarksManager.addGroup("IdeaVim", true)
|
||||||
|
?: return null
|
||||||
if (group.canAdd(bookmark)) {
|
if (group.canAdd(bookmark)) {
|
||||||
group.add(bookmark, type)
|
group.add(bookmark, type)
|
||||||
return bookmark
|
return bookmark
|
||||||
|
@@ -190,7 +190,12 @@ class PutGroup : VimPutBase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
visualSelection.typeInEditor.isLine -> {
|
visualSelection.typeInEditor.isLine -> {
|
||||||
if (caret.offset == editor.fileSize && editor.fileSize != 0) {
|
val lastChar = if (editor.fileSize > 0) {
|
||||||
|
editor.document.getText(com.intellij.openapi.util.TextRange(editor.fileSize - 1, editor.fileSize))[0]
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
if (caret.offset == editor.fileSize && editor.fileSize != 0 && lastChar != '\n') {
|
||||||
application.runWriteAction { editor.document.insertString(caret.offset, "\n") }
|
application.runWriteAction { editor.document.insertString(caret.offset, "\n") }
|
||||||
listOf(caret.offset + 1)
|
listOf(caret.offset + 1)
|
||||||
} else listOf(caret.offset)
|
} else listOf(caret.offset)
|
||||||
|
@@ -211,7 +211,7 @@ class YankGroup : YankGroupBase() {
|
|||||||
|
|
||||||
var result = true
|
var result = true
|
||||||
for ((caret, myRange) in caretToRange) {
|
for ((caret, myRange) in caretToRange) {
|
||||||
result = caret.registerStorage.storeText(editor, myRange, type, false) && result
|
result = caret.registerStorage.storeText(caret, editor, myRange, type, false) && result
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@ package com.maddyhome.idea.vim.helper
|
|||||||
|
|
||||||
import com.intellij.codeWithMe.ClientId
|
import com.intellij.codeWithMe.ClientId
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
|
import com.intellij.openapi.editor.CaretState
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.ex.util.EditorUtil
|
import com.intellij.openapi.editor.ex.util.EditorUtil
|
||||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||||
@@ -106,3 +107,41 @@ val Caret.vimLine: Int
|
|||||||
*/
|
*/
|
||||||
val Editor.vimLine: Int
|
val Editor.vimLine: Int
|
||||||
get() = this.caretModel.currentCaret.vimLine
|
get() = this.caretModel.currentCaret.vimLine
|
||||||
|
|
||||||
|
inline fun Editor.runWithEveryCaretAndRestore(action: () -> Unit) {
|
||||||
|
val caretModel = this.caretModel
|
||||||
|
val carets = if (this.inBlockSubMode) null else caretModel.allCarets
|
||||||
|
if (carets == null || carets.size == 1) {
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var initialDocumentSize = this.document.textLength
|
||||||
|
var documentSizeDifference = 0
|
||||||
|
|
||||||
|
val caretOffsets = carets.map { it.selectionStart to it.selectionEnd }
|
||||||
|
val restoredCarets = mutableListOf<CaretState>()
|
||||||
|
|
||||||
|
caretModel.removeSecondaryCarets()
|
||||||
|
|
||||||
|
for ((selectionStart, selectionEnd) in caretOffsets) {
|
||||||
|
if (selectionStart == selectionEnd) {
|
||||||
|
caretModel.primaryCaret.moveToOffset(selectionStart + documentSizeDifference)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
caretModel.primaryCaret.setSelection(
|
||||||
|
selectionStart + documentSizeDifference,
|
||||||
|
selectionEnd + documentSizeDifference
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
action()
|
||||||
|
restoredCarets.add(caretModel.caretsAndSelections.single())
|
||||||
|
|
||||||
|
val documentLength = this.document.textLength
|
||||||
|
documentSizeDifference += documentLength - initialDocumentSize
|
||||||
|
initialDocumentSize = documentLength
|
||||||
|
}
|
||||||
|
|
||||||
|
caretModel.caretsAndSelections = restoredCarets
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -31,6 +31,7 @@ import com.intellij.psi.PsiElement;
|
|||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
|
import com.maddyhome.idea.vim.api.VimSearchHelperBase;
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine;
|
import com.maddyhome.idea.vim.command.VimStateMachine;
|
||||||
import com.maddyhome.idea.vim.common.CharacterPosition;
|
import com.maddyhome.idea.vim.common.CharacterPosition;
|
||||||
import com.maddyhome.idea.vim.common.Direction;
|
import com.maddyhome.idea.vim.common.Direction;
|
||||||
@@ -1201,7 +1202,7 @@ public class SearchHelper {
|
|||||||
int last = -1;
|
int last = -1;
|
||||||
int res = start;
|
int res = start;
|
||||||
while (true) {
|
while (true) {
|
||||||
res = findNextWordOne(chars, res, end, 1, true, false);
|
res = (int)VimSearchHelperBase.Companion.findNextWordOne(chars, res, end, 1, true, false);
|
||||||
if (res == start || res == 0 || res > end || res == last) {
|
if (res == start || res == 0 || res > end || res == last) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1230,105 +1231,6 @@ public class SearchHelper {
|
|||||||
return new CountPosition(count, position);
|
return new CountPosition(count, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int findNextWord(@NotNull Editor editor, int searchFrom, int count, boolean bigWord) {
|
|
||||||
CharSequence chars = editor.getDocument().getCharsSequence();
|
|
||||||
final int size = EditorHelperRt.getFileSize(editor);
|
|
||||||
|
|
||||||
return findNextWord(chars, searchFrom, size, count, bigWord, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int findNextWord(@NotNull CharSequence chars,
|
|
||||||
int pos,
|
|
||||||
int size,
|
|
||||||
int count,
|
|
||||||
boolean bigWord,
|
|
||||||
boolean spaceWords) {
|
|
||||||
int step = count >= 0 ? 1 : -1;
|
|
||||||
count = Math.abs(count);
|
|
||||||
|
|
||||||
int res = pos;
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
res = findNextWordOne(chars, res, size, step, bigWord, spaceWords);
|
|
||||||
if (res == pos || res == 0 || res == size - 1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int findNextWordOne(@NotNull CharSequence chars,
|
|
||||||
int pos,
|
|
||||||
int size,
|
|
||||||
int step,
|
|
||||||
boolean bigWord,
|
|
||||||
boolean spaceWords) {
|
|
||||||
boolean found = false;
|
|
||||||
pos = pos < size ? pos : Math.min(size, chars.length() - 1);
|
|
||||||
// For back searches, skip any current whitespace so we start at the end of a word
|
|
||||||
if (step < 0 && pos > 0) {
|
|
||||||
if (CharacterHelper.charType(chars.charAt(pos - 1), bigWord) == CharacterHelper.CharacterType.WHITESPACE &&
|
|
||||||
!spaceWords) {
|
|
||||||
pos = skipSpace(chars, pos - 1, step, size) + 1;
|
|
||||||
}
|
|
||||||
if (pos > 0 &&
|
|
||||||
CharacterHelper.charType(chars.charAt(pos), bigWord) !=
|
|
||||||
CharacterHelper.charType(chars.charAt(pos - 1), bigWord)) {
|
|
||||||
pos += step;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int res = pos;
|
|
||||||
if (pos < 0 || pos >= size) {
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterHelper.CharacterType type = CharacterHelper.charType(chars.charAt(pos), bigWord);
|
|
||||||
if (type == CharacterHelper.CharacterType.WHITESPACE && step < 0 && pos > 0 && !spaceWords) {
|
|
||||||
type = CharacterHelper.charType(chars.charAt(pos - 1), bigWord);
|
|
||||||
}
|
|
||||||
|
|
||||||
pos += step;
|
|
||||||
while (pos >= 0 && pos < size && !found) {
|
|
||||||
CharacterHelper.CharacterType newType = CharacterHelper.charType(chars.charAt(pos), bigWord);
|
|
||||||
if (newType != type) {
|
|
||||||
if (newType == CharacterHelper.CharacterType.WHITESPACE && step >= 0 && !spaceWords) {
|
|
||||||
pos = skipSpace(chars, pos, step, size);
|
|
||||||
res = pos;
|
|
||||||
}
|
|
||||||
else if (step < 0) {
|
|
||||||
res = pos + 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
res = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
type = CharacterHelper.charType(chars.charAt(res), bigWord);
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos += step;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found) {
|
|
||||||
if (res < 0) //(pos <= 0)
|
|
||||||
{
|
|
||||||
res = 0;
|
|
||||||
}
|
|
||||||
else if (res >= size) //(pos >= size)
|
|
||||||
{
|
|
||||||
res = size - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (pos <= 0) {
|
|
||||||
res = 0;
|
|
||||||
}
|
|
||||||
else if (pos >= size) {
|
|
||||||
res = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @NotNull List<Pair<TextRange, NumberType>> findNumbersInRange(final @NotNull Editor editor,
|
public static @NotNull List<Pair<TextRange, NumberType>> findNumbersInRange(final @NotNull Editor editor,
|
||||||
@NotNull TextRange textRange,
|
@NotNull TextRange textRange,
|
||||||
final boolean alpha,
|
final boolean alpha,
|
||||||
@@ -1654,10 +1556,10 @@ public class SearchHelper {
|
|||||||
|
|
||||||
if ((!onWordStart && !(startSpace && isOuter)) || hasSelection || (count > 1 && dir == -1)) {
|
if ((!onWordStart && !(startSpace && isOuter)) || hasSelection || (count > 1 && dir == -1)) {
|
||||||
if (dir == 1) {
|
if (dir == 1) {
|
||||||
start = findNextWord(chars, pos, max, -1, isBig, !isOuter);
|
start = (int)VimSearchHelperBase.Companion.findNextWord(chars, pos, max, -1, isBig, !isOuter);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
start = findNextWord(chars, pos, max, -(count - (onWordStart && !hasSelection ? 1 : 0)), isBig, !isOuter);
|
start = (int)VimSearchHelperBase.Companion.findNextWord(chars, pos, max, -(count - (onWordStart && !hasSelection ? 1 : 0)), isBig, !isOuter);
|
||||||
}
|
}
|
||||||
|
|
||||||
start = EditorHelper.normalizeOffset(editor, start, false);
|
start = EditorHelper.normalizeOffset(editor, start, false);
|
||||||
@@ -1805,7 +1707,7 @@ public class SearchHelper {
|
|||||||
if (step > 0 && pos < size - 1) {
|
if (step > 0 && pos < size - 1) {
|
||||||
if (CharacterHelper.charType(chars.charAt(pos + 1), bigWord) == CharacterHelper.CharacterType.WHITESPACE &&
|
if (CharacterHelper.charType(chars.charAt(pos + 1), bigWord) == CharacterHelper.CharacterType.WHITESPACE &&
|
||||||
!spaceWords) {
|
!spaceWords) {
|
||||||
pos = skipSpace(chars, pos + 1, step, size) - 1;
|
pos = (int)(VimSearchHelperBase.Companion.skipSpace(chars, pos + 1, step, size) - 1);
|
||||||
}
|
}
|
||||||
if (pos < size - 1 &&
|
if (pos < size - 1 &&
|
||||||
CharacterHelper.charType(chars.charAt(pos), bigWord) !=
|
CharacterHelper.charType(chars.charAt(pos), bigWord) !=
|
||||||
@@ -1830,7 +1732,7 @@ public class SearchHelper {
|
|||||||
res = pos - 1;
|
res = pos - 1;
|
||||||
}
|
}
|
||||||
else if (newType == CharacterHelper.CharacterType.WHITESPACE && step < 0 && !spaceWords) {
|
else if (newType == CharacterHelper.CharacterType.WHITESPACE && step < 0 && !spaceWords) {
|
||||||
pos = skipSpace(chars, pos, step, size);
|
pos = (int)VimSearchHelperBase.Companion.skipSpace(chars, pos, step, size);
|
||||||
res = pos;
|
res = pos;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1858,34 +1760,6 @@ public class SearchHelper {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Skip whitespace starting with the supplied position.
|
|
||||||
* <p>
|
|
||||||
* An empty line is considered a whitespace break.
|
|
||||||
*
|
|
||||||
* @param chars The text as a character array
|
|
||||||
* @param offset The starting position
|
|
||||||
* @param step The direction to move
|
|
||||||
* @param size The size of the document
|
|
||||||
* @return The new position. This will be the first non-whitespace character found or an empty line
|
|
||||||
*/
|
|
||||||
private static int skipSpace(@NotNull CharSequence chars, int offset, int step, int size) {
|
|
||||||
char prev = 0;
|
|
||||||
while (offset >= 0 && offset < size) {
|
|
||||||
final char c = chars.charAt(offset);
|
|
||||||
if (c == '\n' && c == prev) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (CharacterHelper.charType(c, false) != CharacterHelper.CharacterType.WHITESPACE) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prev = c;
|
|
||||||
offset += step;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offset < size ? offset : size - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This locates the position with the document of the count-th occurrence of ch on the current line
|
* This locates the position with the document of the count-th occurrence of ch on the current line
|
||||||
*
|
*
|
||||||
|
@@ -25,6 +25,7 @@ import com.intellij.openapi.command.CommandProcessor
|
|||||||
import com.intellij.openapi.command.impl.UndoManagerImpl
|
import com.intellij.openapi.command.impl.UndoManagerImpl
|
||||||
import com.intellij.openapi.command.undo.UndoManager
|
import com.intellij.openapi.command.undo.UndoManager
|
||||||
import com.intellij.openapi.components.Service
|
import com.intellij.openapi.components.Service
|
||||||
|
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.ChangesListener
|
import com.maddyhome.idea.vim.common.ChangesListener
|
||||||
@@ -48,27 +49,29 @@ class UndoRedoHelper : UndoRedoBase() {
|
|||||||
override fun undo(context: ExecutionContext): Boolean {
|
override fun undo(context: ExecutionContext): Boolean {
|
||||||
val ijContext = context.context as DataContext
|
val ijContext = context.context as DataContext
|
||||||
val project = PlatformDataKeys.PROJECT.getData(ijContext) ?: return false
|
val project = PlatformDataKeys.PROJECT.getData(ijContext) ?: return false
|
||||||
val fileEditor = PlatformDataKeys.FILE_EDITOR.getData(ijContext)
|
val editor = CommonDataKeys.EDITOR.getData(context.ij) ?: return false
|
||||||
|
val vimEditor = editor.vim
|
||||||
|
val fileEditor = TextEditorProvider.getInstance().getTextEditor(editor)
|
||||||
val undoManager = UndoManager.getInstance(project)
|
val undoManager = UndoManager.getInstance(project)
|
||||||
if (fileEditor != null && undoManager.isUndoAvailable(fileEditor)) {
|
if (undoManager.isUndoAvailable(fileEditor)) {
|
||||||
val editor = CommonDataKeys.EDITOR.getData(context.ij)?.vim
|
|
||||||
if (injector.optionService.isSet(OptionScope.GLOBAL, IjVimOptionService.oldUndo)) {
|
if (injector.optionService.isSet(OptionScope.GLOBAL, IjVimOptionService.oldUndo)) {
|
||||||
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
|
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
|
||||||
} else {
|
} else {
|
||||||
performUntilFileChanges(editor, { undoManager.isUndoAvailable(fileEditor) }, { undoManager.undo(fileEditor) })
|
performUntilFileChanges(vimEditor, { undoManager.isUndoAvailable(fileEditor) }, { undoManager.undo(fileEditor) })
|
||||||
}
|
|
||||||
|
|
||||||
editor?.carets()?.forEach {
|
vimEditor.carets().forEach {
|
||||||
val ijCaret = it.ij
|
val ijCaret = it.ij
|
||||||
val hasSelection = ijCaret.hasSelection()
|
val hasSelection = ijCaret.hasSelection()
|
||||||
if (hasSelection) {
|
if (hasSelection) {
|
||||||
val selectionStart = ijCaret.selectionStart
|
val selectionStart = ijCaret.selectionStart
|
||||||
CommandProcessor.getInstance().runUndoTransparentAction {
|
CommandProcessor.getInstance().runUndoTransparentAction {
|
||||||
it.ij.removeSelection()
|
it.ij.removeSelection()
|
||||||
it.ij.moveToOffset(selectionStart)
|
it.ij.moveToOffset(selectionStart)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -77,17 +80,18 @@ class UndoRedoHelper : UndoRedoBase() {
|
|||||||
override fun redo(context: ExecutionContext): Boolean {
|
override fun redo(context: ExecutionContext): Boolean {
|
||||||
val ijContext = context.context as DataContext
|
val ijContext = context.context as DataContext
|
||||||
val project = PlatformDataKeys.PROJECT.getData(ijContext) ?: return false
|
val project = PlatformDataKeys.PROJECT.getData(ijContext) ?: return false
|
||||||
val fileEditor = PlatformDataKeys.FILE_EDITOR.getData(ijContext)
|
val editor = CommonDataKeys.EDITOR.getData(context.ij) ?: return false
|
||||||
|
val vimEditor = editor.vim
|
||||||
|
val fileEditor = TextEditorProvider.getInstance().getTextEditor(editor)
|
||||||
val undoManager = UndoManager.getInstance(project)
|
val undoManager = UndoManager.getInstance(project)
|
||||||
val editor = CommonDataKeys.EDITOR.getData(context.ij)?.vim
|
if (undoManager.isRedoAvailable(fileEditor)) {
|
||||||
if (fileEditor != null && undoManager.isRedoAvailable(fileEditor)) {
|
|
||||||
if (injector.optionService.isSet(OptionScope.GLOBAL, IjVimOptionService.oldUndo)) {
|
if (injector.optionService.isSet(OptionScope.GLOBAL, IjVimOptionService.oldUndo)) {
|
||||||
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
|
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
|
||||||
} else {
|
} else {
|
||||||
performUntilFileChanges(editor, { undoManager.isRedoAvailable(fileEditor) }, { undoManager.redo(fileEditor) })
|
performUntilFileChanges(vimEditor, { undoManager.isRedoAvailable(fileEditor) }, { undoManager.redo(fileEditor) })
|
||||||
}
|
CommandProcessor.getInstance().runUndoTransparentAction {
|
||||||
CommandProcessor.getInstance().runUndoTransparentAction {
|
vimEditor.carets().forEach { it.ij.removeSelection() }
|
||||||
editor?.carets()?.forEach { it.ij.removeSelection() }
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,10 @@
|
|||||||
package com.maddyhome.idea.vim.listener
|
package com.maddyhome.idea.vim.listener
|
||||||
|
|
||||||
import com.intellij.codeInsight.lookup.Lookup
|
import com.intellij.codeInsight.lookup.Lookup
|
||||||
|
import com.intellij.codeInsight.lookup.LookupManager
|
||||||
import com.intellij.codeInsight.lookup.LookupManagerListener
|
import com.intellij.codeInsight.lookup.LookupManagerListener
|
||||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
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.Template
|
||||||
import com.intellij.codeInsight.template.TemplateEditingAdapter
|
import com.intellij.codeInsight.template.TemplateEditingAdapter
|
||||||
import com.intellij.codeInsight.template.TemplateManagerListener
|
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.actionSystem.impl.ProxyShortcutSet
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||||
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
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.EditorDataContext
|
||||||
import com.maddyhome.idea.vim.helper.inNormalMode
|
import com.maddyhome.idea.vim.helper.inNormalMode
|
||||||
import com.maddyhome.idea.vim.helper.isIdeaVimDisabledHere
|
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.datatypes.VimInt
|
||||||
import com.maddyhome.idea.vim.vimscript.model.options.helpers.IdeaRefactorModeHelper
|
import com.maddyhome.idea.vim.vimscript.model.options.helpers.IdeaRefactorModeHelper
|
||||||
import org.jetbrains.annotations.NonNls
|
import org.jetbrains.annotations.NonNls
|
||||||
|
import java.awt.event.KeyEvent
|
||||||
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Alex Plate
|
* @author Alex Plate
|
||||||
@@ -60,6 +64,8 @@ object IdeaSpecifics {
|
|||||||
private val surrounderAction =
|
private val surrounderAction =
|
||||||
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
||||||
private var editor: Editor? = null
|
private var editor: Editor? = null
|
||||||
|
private var completionPrevDocumentLength: Int? = null
|
||||||
|
private var completionPrevDocumentOffset: Int? = null
|
||||||
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
||||||
if (!VimPlugin.isEnabled()) return
|
if (!VimPlugin.isEnabled()) return
|
||||||
|
|
||||||
@@ -68,19 +74,52 @@ object IdeaSpecifics {
|
|||||||
editor = hostEditor
|
editor = hostEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
//region Track action id
|
|
||||||
if (VimPlugin.getOptionService().isSet(OptionScope.GLOBAL, OptionConstants.trackactionidsName)) {
|
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
|
||||||
val id: String? = ActionManager.getInstance().getId(action) ?: (action.shortcutSet as? ProxyShortcutSet)?.actionId
|
VimPlugin.getNotifications(event.dataContext.getData(CommonDataKeys.PROJECT)).notifyActionId(id)
|
||||||
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) {
|
override fun afterActionPerformed(action: AnAction, event: AnActionEvent, result: AnActionResult) {
|
||||||
if (!VimPlugin.isEnabled()) return
|
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
|
//region Enter insert mode after surround with if
|
||||||
if (surrounderAction == action.javaClass.name && surrounderItems.any {
|
if (surrounderAction == action.javaClass.name && surrounderItems.any {
|
||||||
action.templatePresentation.text.endsWith(
|
action.templatePresentation.text.endsWith(
|
||||||
@@ -99,7 +138,7 @@ object IdeaSpecifics {
|
|||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
editor = null
|
this.editor = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,9 +36,14 @@ import com.intellij.openapi.editor.event.SelectionEvent
|
|||||||
import com.intellij.openapi.editor.event.SelectionListener
|
import com.intellij.openapi.editor.event.SelectionListener
|
||||||
import com.intellij.openapi.editor.ex.DocumentEx
|
import com.intellij.openapi.editor.ex.DocumentEx
|
||||||
import com.intellij.openapi.editor.impl.EditorComponentImpl
|
import com.intellij.openapi.editor.impl.EditorComponentImpl
|
||||||
|
import com.intellij.openapi.editor.impl.EditorImpl
|
||||||
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
|
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
|
||||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener
|
import com.intellij.openapi.fileEditor.FileEditorManagerListener
|
||||||
|
import com.intellij.openapi.rd.createLifetime
|
||||||
|
import com.intellij.openapi.rd.createNestedDisposable
|
||||||
|
import com.intellij.openapi.util.Disposer
|
||||||
import com.intellij.util.ExceptionUtil
|
import com.intellij.util.ExceptionUtil
|
||||||
|
import com.jetbrains.rd.util.lifetime.intersect
|
||||||
import com.maddyhome.idea.vim.EventFacade
|
import com.maddyhome.idea.vim.EventFacade
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimKeyListener
|
import com.maddyhome.idea.vim.VimKeyListener
|
||||||
@@ -73,8 +78,6 @@ import com.maddyhome.idea.vim.helper.vimLastColumn
|
|||||||
import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipEvents
|
import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipEvents
|
||||||
import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipNDragEvents
|
import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipNDragEvents
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
|
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.remove
|
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.OptionScope
|
||||||
@@ -153,17 +156,26 @@ object VimListenerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun add(editor: Editor) {
|
fun add(editor: Editor) {
|
||||||
|
val pluginLifetime = VimPlugin.getInstance().createLifetime()
|
||||||
|
val editorLifetime = (editor as EditorImpl).disposable.createLifetime()
|
||||||
|
val disposable = editorLifetime.intersect(pluginLifetime).createNestedDisposable("MyLifetimedDisposable")
|
||||||
|
|
||||||
editor.contentComponent.addKeyListener(VimKeyListener)
|
editor.contentComponent.addKeyListener(VimKeyListener)
|
||||||
|
Disposer.register(disposable) { editor.contentComponent.removeKeyListener(VimKeyListener) }
|
||||||
|
|
||||||
val eventFacade = EventFacade.getInstance()
|
val eventFacade = EventFacade.getInstance()
|
||||||
eventFacade.addEditorMouseListener(editor, EditorMouseHandler)
|
eventFacade.addEditorMouseListener(editor, EditorMouseHandler, disposable)
|
||||||
eventFacade.addEditorMouseMotionListener(editor, EditorMouseHandler)
|
eventFacade.addEditorMouseMotionListener(editor, EditorMouseHandler, disposable)
|
||||||
eventFacade.addEditorSelectionListener(editor, EditorSelectionHandler)
|
eventFacade.addEditorSelectionListener(editor, EditorSelectionHandler, disposable)
|
||||||
eventFacade.addComponentMouseListener(editor.contentComponent, ComponentMouseListener)
|
eventFacade.addComponentMouseListener(editor.contentComponent, ComponentMouseListener, disposable)
|
||||||
|
|
||||||
VimPlugin.getEditor().editorCreated(editor)
|
VimPlugin.getEditor().editorCreated(editor)
|
||||||
|
|
||||||
VimPlugin.getChange().editorCreated(IjVimEditor(editor))
|
VimPlugin.getChange().editorCreated(editor, disposable)
|
||||||
|
|
||||||
|
Disposer.register(disposable) {
|
||||||
|
VimPlugin.getEditorIfCreated()?.editorDeinit(editor, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun remove(editor: Editor, isReleased: Boolean) {
|
fun remove(editor: Editor, isReleased: Boolean) {
|
||||||
@@ -177,7 +189,7 @@ object VimListenerManager {
|
|||||||
|
|
||||||
VimPlugin.getEditorIfCreated()?.editorDeinit(editor, isReleased)
|
VimPlugin.getEditorIfCreated()?.editorDeinit(editor, isReleased)
|
||||||
|
|
||||||
VimPlugin.getChange().editorReleased(IjVimEditor(editor))
|
VimPlugin.getChange().editorReleased(editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +221,6 @@ object VimListenerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun editorReleased(event: EditorFactoryEvent) {
|
override fun editorReleased(event: EditorFactoryEvent) {
|
||||||
remove(event.editor, true)
|
|
||||||
VimPlugin.getMark().editorReleased(event)
|
VimPlugin.getMark().editorReleased(event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ class IjVimCaret(val caret: Caret) : VimCaretBase() {
|
|||||||
get() {
|
get() {
|
||||||
var storage = this.caret.registerStorage
|
var storage = this.caret.registerStorage
|
||||||
if (storage == null) {
|
if (storage == null) {
|
||||||
storage = CaretRegisterStorageBase(editor.primaryCaret().ij == caret)
|
storage = CaretRegisterStorageBase()
|
||||||
this.caret.registerStorage = storage
|
this.caret.registerStorage = storage
|
||||||
}
|
}
|
||||||
return storage
|
return storage
|
||||||
@@ -87,6 +87,8 @@ class IjVimCaret(val caret: Caret) : VimCaretBase() {
|
|||||||
}
|
}
|
||||||
override val vimLine: Int
|
override val vimLine: Int
|
||||||
get() = this.caret.vimLine
|
get() = this.caret.vimLine
|
||||||
|
override val isPrimary: Boolean
|
||||||
|
get() = editor.primaryCaret().ij == this.caret
|
||||||
|
|
||||||
override fun moveToOffset(offset: Int) {
|
override fun moveToOffset(offset: Int) {
|
||||||
// TODO: 17.12.2021 Unpack internal actions
|
// TODO: 17.12.2021 Unpack internal actions
|
||||||
|
@@ -3,14 +3,14 @@ package com.maddyhome.idea.vim.newapi
|
|||||||
import com.intellij.openapi.components.Service
|
import com.intellij.openapi.components.Service
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.VimSearchHelper
|
import com.maddyhome.idea.vim.api.VimSearchHelperBase
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.helper.SearchHelper
|
import com.maddyhome.idea.vim.helper.SearchHelper
|
||||||
import com.maddyhome.idea.vim.helper.SearchOptions
|
import com.maddyhome.idea.vim.helper.SearchOptions
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class IjVimSearchHelper : VimSearchHelper {
|
class IjVimSearchHelper : VimSearchHelperBase() {
|
||||||
override fun findNextParagraph(editor: VimEditor, caret: VimCaret, count: Int, allowBlanks: Boolean): Int {
|
override fun findNextParagraph(editor: VimEditor, caret: VimCaret, count: Int, allowBlanks: Boolean): Int {
|
||||||
return SearchHelper.findNextParagraph(
|
return SearchHelper.findNextParagraph(
|
||||||
(editor as IjVimEditor).editor,
|
(editor as IjVimEditor).editor,
|
||||||
@@ -121,15 +121,6 @@ class IjVimSearchHelper : VimSearchHelper {
|
|||||||
return SearchHelper.findNextWordEnd(chars, pos, size, count, bigWord, spaceWords)
|
return SearchHelper.findNextWordEnd(chars, pos, size, count, bigWord, spaceWords)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findNextWord(editor: VimEditor, searchFrom: Int, count: Int, bigWord: Boolean): Int {
|
|
||||||
return SearchHelper.findNextWord(
|
|
||||||
(editor as IjVimEditor).editor,
|
|
||||||
searchFrom,
|
|
||||||
count,
|
|
||||||
bigWord
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun findPattern(
|
override fun findPattern(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
pattern: String?,
|
pattern: String?,
|
||||||
|
@@ -21,15 +21,14 @@ package com.maddyhome.idea.vim.statistic
|
|||||||
import com.intellij.internal.statistic.beans.MetricEvent
|
import com.intellij.internal.statistic.beans.MetricEvent
|
||||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
|
||||||
import com.intellij.internal.statistic.eventLog.events.StringListEventField
|
|
||||||
import com.intellij.internal.statistic.eventLog.events.VarargEventId
|
|
||||||
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
|
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.key.ShortcutOwner
|
import com.maddyhome.idea.vim.key.ShortcutOwner
|
||||||
import com.maddyhome.idea.vim.key.ShortcutOwnerInfo
|
import com.maddyhome.idea.vim.key.ShortcutOwnerInfo
|
||||||
|
import java.awt.event.InputEvent
|
||||||
import java.awt.event.InputEvent.CTRL_DOWN_MASK
|
import java.awt.event.InputEvent.CTRL_DOWN_MASK
|
||||||
import java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
import java.awt.event.InputEvent.SHIFT_DOWN_MASK
|
||||||
|
import java.awt.event.KeyEvent
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
||||||
@@ -37,93 +36,15 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
|||||||
override fun getGroup(): EventLogGroup = GROUP
|
override fun getGroup(): EventLogGroup = GROUP
|
||||||
|
|
||||||
override fun getMetrics(): Set<MetricEvent> {
|
override fun getMetrics(): Set<MetricEvent> {
|
||||||
return setOf(
|
val metrics = mutableSetOf<MetricEvent>()
|
||||||
HANDLERS.metric(
|
keyStrokes.forEach { keystroke ->
|
||||||
CTRL_1 withKeyStroke KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK),
|
getHandlersForShortcut(keystroke)
|
||||||
CTRL_2 withKeyStroke KeyStroke.getKeyStroke('2'.code, CTRL_DOWN_MASK),
|
.filter { !setOf(HandledModes.INSERT_UNDEFINED, HandledModes.NORMAL_UNDEFINED, HandledModes.VISUAL_AND_SELECT_UNDEFINED).contains(it) }
|
||||||
CTRL_3 withKeyStroke KeyStroke.getKeyStroke('3'.code, CTRL_DOWN_MASK),
|
.forEach { mode ->
|
||||||
CTRL_4 withKeyStroke KeyStroke.getKeyStroke('4'.code, CTRL_DOWN_MASK),
|
metrics += HANDLER.metric(keystroke.toReadableString(), mode)
|
||||||
CTRL_5 withKeyStroke KeyStroke.getKeyStroke('5'.code, CTRL_DOWN_MASK),
|
}
|
||||||
CTRL_6 withKeyStroke KeyStroke.getKeyStroke('6'.code, CTRL_DOWN_MASK),
|
}
|
||||||
CTRL_7 withKeyStroke KeyStroke.getKeyStroke('7'.code, CTRL_DOWN_MASK),
|
return metrics
|
||||||
CTRL_8 withKeyStroke KeyStroke.getKeyStroke('8'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_9 withKeyStroke KeyStroke.getKeyStroke('9'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_0 withKeyStroke KeyStroke.getKeyStroke('0'.code, CTRL_DOWN_MASK),
|
|
||||||
|
|
||||||
CTRL_SHIFT_1 withKeyStroke KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_2 withKeyStroke KeyStroke.getKeyStroke('2'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_3 withKeyStroke KeyStroke.getKeyStroke('3'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_4 withKeyStroke KeyStroke.getKeyStroke('4'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_5 withKeyStroke KeyStroke.getKeyStroke('5'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_6 withKeyStroke KeyStroke.getKeyStroke('6'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_7 withKeyStroke KeyStroke.getKeyStroke('7'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_8 withKeyStroke KeyStroke.getKeyStroke('8'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_9 withKeyStroke KeyStroke.getKeyStroke('9'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_0 withKeyStroke KeyStroke.getKeyStroke('0'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
|
|
||||||
CTRL_A withKeyStroke KeyStroke.getKeyStroke('A'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_B withKeyStroke KeyStroke.getKeyStroke('B'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_C withKeyStroke KeyStroke.getKeyStroke('C'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_D withKeyStroke KeyStroke.getKeyStroke('D'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_E withKeyStroke KeyStroke.getKeyStroke('E'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_F withKeyStroke KeyStroke.getKeyStroke('F'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_G withKeyStroke KeyStroke.getKeyStroke('G'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_H withKeyStroke KeyStroke.getKeyStroke('H'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_I withKeyStroke KeyStroke.getKeyStroke('I'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_J withKeyStroke KeyStroke.getKeyStroke('J'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_K withKeyStroke KeyStroke.getKeyStroke('K'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_L withKeyStroke KeyStroke.getKeyStroke('L'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_M withKeyStroke KeyStroke.getKeyStroke('M'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_N withKeyStroke KeyStroke.getKeyStroke('N'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_O withKeyStroke KeyStroke.getKeyStroke('O'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_P withKeyStroke KeyStroke.getKeyStroke('P'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_Q withKeyStroke KeyStroke.getKeyStroke('Q'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_R withKeyStroke KeyStroke.getKeyStroke('R'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_S withKeyStroke KeyStroke.getKeyStroke('S'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_T withKeyStroke KeyStroke.getKeyStroke('T'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_U withKeyStroke KeyStroke.getKeyStroke('U'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_V withKeyStroke KeyStroke.getKeyStroke('V'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_W withKeyStroke KeyStroke.getKeyStroke('W'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_X withKeyStroke KeyStroke.getKeyStroke('X'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_Y withKeyStroke KeyStroke.getKeyStroke('Y'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_Z withKeyStroke KeyStroke.getKeyStroke('Z'.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_BR1 withKeyStroke KeyStroke.getKeyStroke('['.code, CTRL_DOWN_MASK),
|
|
||||||
CTRL_BR2 withKeyStroke KeyStroke.getKeyStroke(']'.code, CTRL_DOWN_MASK),
|
|
||||||
|
|
||||||
CTRL_SHIFT_A withKeyStroke KeyStroke.getKeyStroke('A'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_B withKeyStroke KeyStroke.getKeyStroke('B'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_C withKeyStroke KeyStroke.getKeyStroke('C'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_D withKeyStroke KeyStroke.getKeyStroke('D'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_E withKeyStroke KeyStroke.getKeyStroke('E'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_F withKeyStroke KeyStroke.getKeyStroke('F'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_G withKeyStroke KeyStroke.getKeyStroke('G'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_H withKeyStroke KeyStroke.getKeyStroke('H'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_I withKeyStroke KeyStroke.getKeyStroke('I'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_J withKeyStroke KeyStroke.getKeyStroke('J'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_K withKeyStroke KeyStroke.getKeyStroke('K'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_L withKeyStroke KeyStroke.getKeyStroke('L'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_M withKeyStroke KeyStroke.getKeyStroke('M'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_N withKeyStroke KeyStroke.getKeyStroke('N'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_O withKeyStroke KeyStroke.getKeyStroke('O'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_P withKeyStroke KeyStroke.getKeyStroke('P'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_Q withKeyStroke KeyStroke.getKeyStroke('Q'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_R withKeyStroke KeyStroke.getKeyStroke('R'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_S withKeyStroke KeyStroke.getKeyStroke('S'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_T withKeyStroke KeyStroke.getKeyStroke('T'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_U withKeyStroke KeyStroke.getKeyStroke('U'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_V withKeyStroke KeyStroke.getKeyStroke('V'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_W withKeyStroke KeyStroke.getKeyStroke('W'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_X withKeyStroke KeyStroke.getKeyStroke('X'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_Y withKeyStroke KeyStroke.getKeyStroke('Y'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_Z withKeyStroke KeyStroke.getKeyStroke('Z'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_BR1 withKeyStroke KeyStroke.getKeyStroke('['.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
CTRL_SHIFT_BR2 withKeyStroke KeyStroke.getKeyStroke(']'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private infix fun StringListEventField.withKeyStroke(ks: KeyStroke): EventPair<List<String>> {
|
|
||||||
return this.with(getHandlersForShortcut(ks).map { it.name })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getHandlersForShortcut(shortcut: KeyStroke): List<HandledModes> {
|
private fun getHandlersForShortcut(shortcut: KeyStroke): List<HandledModes> {
|
||||||
@@ -162,173 +83,105 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.handlers", 1)
|
private val GROUP = EventLogGroup("vim.handlers", 1)
|
||||||
private val values = HandledModes.values().map { it.name }
|
|
||||||
|
|
||||||
private val CTRL_1 = EventFields.StringList("Ctrl-1", values)
|
private val keyStrokes = listOf(
|
||||||
private val CTRL_2 = EventFields.StringList("Ctrl-2", values)
|
KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_3 = EventFields.StringList("Ctrl-3", values)
|
KeyStroke.getKeyStroke('2'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_4 = EventFields.StringList("Ctrl-4", values)
|
KeyStroke.getKeyStroke('3'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_5 = EventFields.StringList("Ctrl-5", values)
|
KeyStroke.getKeyStroke('4'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_6 = EventFields.StringList("Ctrl-6", values)
|
KeyStroke.getKeyStroke('5'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_7 = EventFields.StringList("Ctrl-7", values)
|
KeyStroke.getKeyStroke('6'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_8 = EventFields.StringList("Ctrl-8", values)
|
KeyStroke.getKeyStroke('7'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_9 = EventFields.StringList("Ctrl-9", values)
|
KeyStroke.getKeyStroke('8'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_0 = EventFields.StringList("Ctrl-0", values)
|
KeyStroke.getKeyStroke('9'.code, CTRL_DOWN_MASK),
|
||||||
|
KeyStroke.getKeyStroke('0'.code, CTRL_DOWN_MASK),
|
||||||
|
|
||||||
private val CTRL_SHIFT_1 = EventFields.StringList("Ctrl-Shift-1", values)
|
KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_2 = EventFields.StringList("Ctrl-Shift-2", values)
|
KeyStroke.getKeyStroke('2'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_3 = EventFields.StringList("Ctrl-Shift-3", values)
|
KeyStroke.getKeyStroke('3'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_4 = EventFields.StringList("Ctrl-Shift-4", values)
|
KeyStroke.getKeyStroke('4'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_5 = EventFields.StringList("Ctrl-Shift-5", values)
|
KeyStroke.getKeyStroke('5'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_6 = EventFields.StringList("Ctrl-Shift-6", values)
|
KeyStroke.getKeyStroke('6'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_7 = EventFields.StringList("Ctrl-Shift-7", values)
|
KeyStroke.getKeyStroke('7'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_8 = EventFields.StringList("Ctrl-Shift-8", values)
|
KeyStroke.getKeyStroke('8'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_9 = EventFields.StringList("Ctrl-Shift-9", values)
|
KeyStroke.getKeyStroke('9'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_0 = EventFields.StringList("Ctrl-Shift-0", values)
|
KeyStroke.getKeyStroke('0'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
|
|
||||||
private val CTRL_A = EventFields.StringList("Ctrl-A", values)
|
KeyStroke.getKeyStroke('A'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_B = EventFields.StringList("Ctrl-B", values)
|
KeyStroke.getKeyStroke('B'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_C = EventFields.StringList("Ctrl-C", values)
|
KeyStroke.getKeyStroke('C'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_D = EventFields.StringList("Ctrl-D", values)
|
KeyStroke.getKeyStroke('D'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_E = EventFields.StringList("Ctrl-E", values)
|
KeyStroke.getKeyStroke('E'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_F = EventFields.StringList("Ctrl-F", values)
|
KeyStroke.getKeyStroke('F'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_G = EventFields.StringList("Ctrl-G", values)
|
KeyStroke.getKeyStroke('G'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_H = EventFields.StringList("Ctrl-H", values)
|
KeyStroke.getKeyStroke('H'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_I = EventFields.StringList("Ctrl-I", values)
|
KeyStroke.getKeyStroke('I'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_J = EventFields.StringList("Ctrl-J", values)
|
KeyStroke.getKeyStroke('J'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_K = EventFields.StringList("Ctrl-K", values)
|
KeyStroke.getKeyStroke('K'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_L = EventFields.StringList("Ctrl-L", values)
|
KeyStroke.getKeyStroke('L'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_M = EventFields.StringList("Ctrl-M", values)
|
KeyStroke.getKeyStroke('M'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_N = EventFields.StringList("Ctrl-N", values)
|
KeyStroke.getKeyStroke('N'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_O = EventFields.StringList("Ctrl-O", values)
|
KeyStroke.getKeyStroke('O'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_P = EventFields.StringList("Ctrl-P", values)
|
KeyStroke.getKeyStroke('P'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_Q = EventFields.StringList("Ctrl-Q", values)
|
KeyStroke.getKeyStroke('Q'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_R = EventFields.StringList("Ctrl-R", values)
|
KeyStroke.getKeyStroke('R'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_S = EventFields.StringList("Ctrl-S", values)
|
KeyStroke.getKeyStroke('S'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_T = EventFields.StringList("Ctrl-T", values)
|
KeyStroke.getKeyStroke('T'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_U = EventFields.StringList("Ctrl-U", values)
|
KeyStroke.getKeyStroke('U'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_V = EventFields.StringList("Ctrl-V", values)
|
KeyStroke.getKeyStroke('V'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_W = EventFields.StringList("Ctrl-W", values)
|
KeyStroke.getKeyStroke('W'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_X = EventFields.StringList("Ctrl-X", values)
|
KeyStroke.getKeyStroke('X'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_Y = EventFields.StringList("Ctrl-Y", values)
|
KeyStroke.getKeyStroke('Y'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_Z = EventFields.StringList("Ctrl-Z", values)
|
KeyStroke.getKeyStroke('Z'.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_BR1 = EventFields.StringList("Ctrl-[", values)
|
KeyStroke.getKeyStroke('['.code, CTRL_DOWN_MASK),
|
||||||
private val CTRL_BR2 = EventFields.StringList("Ctrl-]", values)
|
KeyStroke.getKeyStroke(']'.code, CTRL_DOWN_MASK),
|
||||||
|
|
||||||
private val CTRL_SHIFT_A = EventFields.StringList("Ctrl-Shift-A", values)
|
KeyStroke.getKeyStroke('A'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_B = EventFields.StringList("Ctrl-Shift-B", values)
|
KeyStroke.getKeyStroke('B'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_C = EventFields.StringList("Ctrl-Shift-C", values)
|
KeyStroke.getKeyStroke('C'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_D = EventFields.StringList("Ctrl-Shift-D", values)
|
KeyStroke.getKeyStroke('D'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_E = EventFields.StringList("Ctrl-Shift-E", values)
|
KeyStroke.getKeyStroke('E'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_F = EventFields.StringList("Ctrl-Shift-F", values)
|
KeyStroke.getKeyStroke('F'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_G = EventFields.StringList("Ctrl-Shift-G", values)
|
KeyStroke.getKeyStroke('G'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_H = EventFields.StringList("Ctrl-Shift-H", values)
|
KeyStroke.getKeyStroke('H'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_I = EventFields.StringList("Ctrl-Shift-I", values)
|
KeyStroke.getKeyStroke('I'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_J = EventFields.StringList("Ctrl-Shift-J", values)
|
KeyStroke.getKeyStroke('J'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_K = EventFields.StringList("Ctrl-Shift-K", values)
|
KeyStroke.getKeyStroke('K'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_L = EventFields.StringList("Ctrl-Shift-L", values)
|
KeyStroke.getKeyStroke('L'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_M = EventFields.StringList("Ctrl-Shift-M", values)
|
KeyStroke.getKeyStroke('M'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_N = EventFields.StringList("Ctrl-Shift-N", values)
|
KeyStroke.getKeyStroke('N'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_O = EventFields.StringList("Ctrl-Shift-O", values)
|
KeyStroke.getKeyStroke('O'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_P = EventFields.StringList("Ctrl-Shift-P", values)
|
KeyStroke.getKeyStroke('P'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_Q = EventFields.StringList("Ctrl-Shift-Q", values)
|
KeyStroke.getKeyStroke('Q'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_R = EventFields.StringList("Ctrl-Shift-R", values)
|
KeyStroke.getKeyStroke('R'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_S = EventFields.StringList("Ctrl-Shift-S", values)
|
KeyStroke.getKeyStroke('S'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_T = EventFields.StringList("Ctrl-Shift-T", values)
|
KeyStroke.getKeyStroke('T'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_U = EventFields.StringList("Ctrl-Shift-U", values)
|
KeyStroke.getKeyStroke('U'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_V = EventFields.StringList("Ctrl-Shift-V", values)
|
KeyStroke.getKeyStroke('V'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_W = EventFields.StringList("Ctrl-Shift-W", values)
|
KeyStroke.getKeyStroke('W'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_X = EventFields.StringList("Ctrl-Shift-X", values)
|
KeyStroke.getKeyStroke('X'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_Y = EventFields.StringList("Ctrl-Shift-Y", values)
|
KeyStroke.getKeyStroke('Y'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_Z = EventFields.StringList("Ctrl-Shift-Z", values)
|
KeyStroke.getKeyStroke('Z'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_BR1 = EventFields.StringList("Ctrl-Shift-[", values)
|
KeyStroke.getKeyStroke('['.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
private val CTRL_SHIFT_BR2 = EventFields.StringList("Ctrl-Shift-]", values)
|
KeyStroke.getKeyStroke(']'.code, CTRL_DOWN_MASK + SHIFT_DOWN_MASK),
|
||||||
|
|
||||||
private val HANDLERS: VarargEventId = GROUP.registerVarargEvent(
|
|
||||||
"vim.handlers",
|
|
||||||
CTRL_1,
|
|
||||||
CTRL_2,
|
|
||||||
CTRL_3,
|
|
||||||
CTRL_4,
|
|
||||||
CTRL_5,
|
|
||||||
CTRL_6,
|
|
||||||
CTRL_7,
|
|
||||||
CTRL_8,
|
|
||||||
CTRL_9,
|
|
||||||
CTRL_0,
|
|
||||||
|
|
||||||
CTRL_SHIFT_1,
|
|
||||||
CTRL_SHIFT_2,
|
|
||||||
CTRL_SHIFT_3,
|
|
||||||
CTRL_SHIFT_4,
|
|
||||||
CTRL_SHIFT_5,
|
|
||||||
CTRL_SHIFT_6,
|
|
||||||
CTRL_SHIFT_7,
|
|
||||||
CTRL_SHIFT_8,
|
|
||||||
CTRL_SHIFT_9,
|
|
||||||
CTRL_SHIFT_0,
|
|
||||||
|
|
||||||
CTRL_A,
|
|
||||||
CTRL_B,
|
|
||||||
CTRL_C,
|
|
||||||
CTRL_D,
|
|
||||||
CTRL_E,
|
|
||||||
CTRL_F,
|
|
||||||
CTRL_G,
|
|
||||||
CTRL_H,
|
|
||||||
CTRL_I,
|
|
||||||
CTRL_J,
|
|
||||||
CTRL_K,
|
|
||||||
CTRL_L,
|
|
||||||
CTRL_M,
|
|
||||||
CTRL_N,
|
|
||||||
CTRL_O,
|
|
||||||
CTRL_P,
|
|
||||||
CTRL_Q,
|
|
||||||
CTRL_R,
|
|
||||||
CTRL_S,
|
|
||||||
CTRL_T,
|
|
||||||
CTRL_U,
|
|
||||||
CTRL_V,
|
|
||||||
CTRL_W,
|
|
||||||
CTRL_X,
|
|
||||||
CTRL_Y,
|
|
||||||
CTRL_Z,
|
|
||||||
CTRL_BR1,
|
|
||||||
CTRL_BR2,
|
|
||||||
|
|
||||||
CTRL_SHIFT_A,
|
|
||||||
CTRL_SHIFT_B,
|
|
||||||
CTRL_SHIFT_C,
|
|
||||||
CTRL_SHIFT_D,
|
|
||||||
CTRL_SHIFT_E,
|
|
||||||
CTRL_SHIFT_F,
|
|
||||||
CTRL_SHIFT_G,
|
|
||||||
CTRL_SHIFT_H,
|
|
||||||
CTRL_SHIFT_I,
|
|
||||||
CTRL_SHIFT_J,
|
|
||||||
CTRL_SHIFT_K,
|
|
||||||
CTRL_SHIFT_L,
|
|
||||||
CTRL_SHIFT_M,
|
|
||||||
CTRL_SHIFT_N,
|
|
||||||
CTRL_SHIFT_O,
|
|
||||||
CTRL_SHIFT_P,
|
|
||||||
CTRL_SHIFT_Q,
|
|
||||||
CTRL_SHIFT_R,
|
|
||||||
CTRL_SHIFT_S,
|
|
||||||
CTRL_SHIFT_T,
|
|
||||||
CTRL_SHIFT_U,
|
|
||||||
CTRL_SHIFT_V,
|
|
||||||
CTRL_SHIFT_W,
|
|
||||||
CTRL_SHIFT_X,
|
|
||||||
CTRL_SHIFT_Y,
|
|
||||||
CTRL_SHIFT_Z,
|
|
||||||
CTRL_SHIFT_BR1,
|
|
||||||
CTRL_SHIFT_BR2,
|
|
||||||
)
|
)
|
||||||
|
private val KEY_STROKE = EventFields.String("key_stroke", keyStrokes.map { it.toReadableString() })
|
||||||
|
private val HANDLER_MODE = EventFields.Enum<HandledModes>("handler")
|
||||||
|
private val HANDLER = GROUP.registerEvent("vim.handler", KEY_STROKE, HANDLER_MODE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun KeyStroke.toReadableString(): String {
|
||||||
|
val result = StringBuilder()
|
||||||
|
val modifiers = this.modifiers
|
||||||
|
if (modifiers > 0) {
|
||||||
|
result.append(InputEvent.getModifiersExText(modifiers))
|
||||||
|
.append("+")
|
||||||
|
}
|
||||||
|
result.append(KeyEvent.getKeyText(this.keyCode))
|
||||||
|
return result.toString()
|
||||||
|
}
|
||||||
|
|
||||||
private enum class HandledModes {
|
private enum class HandledModes {
|
||||||
NORMAL_UNDEFINED,
|
NORMAL_UNDEFINED,
|
||||||
NORMAL_IDE,
|
NORMAL_IDE,
|
||||||
|
@@ -59,8 +59,8 @@ internal class VimscriptState : ApplicationUsagesCollector() {
|
|||||||
var isFunctionDeclarationUsed = false
|
var isFunctionDeclarationUsed = false
|
||||||
var isFunctionCallUsed = false
|
var isFunctionCallUsed = false
|
||||||
|
|
||||||
private val SOURCED_FILES = EventFields.Int("number_of_sourced_files")
|
private val SOURCED_FILES = EventFields.RoundedInt("number_of_sourced_files")
|
||||||
private val IDEAVIMRC_SIZE = EventFields.Int("ideavimrc_size")
|
private val IDEAVIMRC_SIZE = EventFields.RoundedInt("ideavimrc_size")
|
||||||
private val EXTENSIONS_ENABLED_BY_SET = EventFields.StringList("extensions_enabled_by_set", PluginState.extensionNames)
|
private val EXTENSIONS_ENABLED_BY_SET = EventFields.StringList("extensions_enabled_by_set", PluginState.extensionNames)
|
||||||
private val EXTENSIONS_ENABLED_BY_PLUG = EventFields.StringList("extensions_enabled_by_plug", PluginState.extensionNames)
|
private val EXTENSIONS_ENABLED_BY_PLUG = EventFields.StringList("extensions_enabled_by_plug", PluginState.extensionNames)
|
||||||
private val IS_IDE_SPECIFIC_CONFIGURATION_USED = EventFields.Boolean("is_IDE-specific_configuration_used")
|
private val IS_IDE_SPECIFIC_CONFIGURATION_USED = EventFields.Boolean("is_IDE-specific_configuration_used")
|
||||||
|
@@ -20,10 +20,10 @@ package com.maddyhome.idea.vim.ui
|
|||||||
|
|
||||||
import com.intellij.icons.AllIcons
|
import com.intellij.icons.AllIcons
|
||||||
import com.intellij.openapi.Disposable
|
import com.intellij.openapi.Disposable
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
import com.intellij.openapi.components.service
|
|
||||||
import com.intellij.openapi.editor.Document
|
import com.intellij.openapi.editor.Document
|
||||||
import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
|
import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
|
||||||
import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
|
import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
|
||||||
@@ -144,11 +144,13 @@ class ReloadVimRc : DumbAwareAction() {
|
|||||||
e.presentation.isEnabledAndVisible = true
|
e.presentation.isEnabledAndVisible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
|
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
|
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
|
||||||
FileDocumentManager.getInstance().saveDocumentAsIs(editor.document)
|
FileDocumentManager.getInstance().saveDocumentAsIs(editor.document)
|
||||||
injector.keyGroup.removeKeyMapping(MappingOwner.IdeaVim.InitScript)
|
injector.keyGroup.removeKeyMapping(MappingOwner.IdeaVim.InitScript)
|
||||||
service<Troubleshooter>().removeByType("old-action-notation-in-mappings")
|
Troubleshooter.instance.removeByType("old-action-notation-in-mappings")
|
||||||
executeIdeaVimRc()
|
executeIdeaVimRc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ import com.intellij.ide.BrowserUtil
|
|||||||
import com.intellij.ide.DataManager
|
import com.intellij.ide.DataManager
|
||||||
import com.intellij.openapi.actionSystem.ActionManager
|
import com.intellij.openapi.actionSystem.ActionManager
|
||||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||||
@@ -158,6 +159,8 @@ class VimActions : DumbAwareAction() {
|
|||||||
val project = e.project
|
val project = e.project
|
||||||
e.presentation.isEnabledAndVisible = project != null && !project.isDisposed
|
e.presentation.isEnabledAndVisible = project != null && !project.isDisposed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
|
||||||
private object VimActionsPopup {
|
private object VimActionsPopup {
|
||||||
@@ -264,4 +267,6 @@ internal object JoinEap : DumbAwareAction()/*, LightEditCompatible*/ {
|
|||||||
e.presentation.text = MessageHelper.message("action.subscribe.to.eap.text")
|
e.presentation.text = MessageHelper.message("action.subscribe.to.eap.text")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@ package com.maddyhome.idea.vim.ui.ex
|
|||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.helper.SearchHelper
|
import com.maddyhome.idea.vim.api.VimSearchHelperBase
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import java.awt.event.ActionEvent
|
import java.awt.event.ActionEvent
|
||||||
import java.awt.event.KeyEvent
|
import java.awt.event.KeyEvent
|
||||||
@@ -238,14 +238,14 @@ class DeletePreviousWordAction : TextAction(DefaultEditorKit.deletePrevWordActio
|
|||||||
target.saveLastEntry()
|
target.saveLastEntry()
|
||||||
val doc = target.document
|
val doc = target.document
|
||||||
val caret = target.caret
|
val caret = target.caret
|
||||||
val offset = SearchHelper.findNextWord(
|
val offset = VimSearchHelperBase.Companion.findNextWord(
|
||||||
target.actualText, caret.dot, target.actualText.length,
|
target.actualText, caret.dot.toLong(), target.actualText.length.toLong(),
|
||||||
-1, false, false
|
-1, false, false
|
||||||
)
|
)
|
||||||
if (logger.isDebugEnabled) logger.debug("offset=$offset")
|
if (logger.isDebugEnabled) logger.debug("offset=$offset")
|
||||||
try {
|
try {
|
||||||
val pos = caret.dot
|
val pos = caret.dot
|
||||||
doc.remove(offset, pos - offset)
|
doc.remove(offset.toInt(), (pos - offset).toInt())
|
||||||
} catch (ex: BadLocationException) {
|
} catch (ex: BadLocationException) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.ui.ex
|
package com.maddyhome.idea.vim.ui.ex
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
import com.intellij.openapi.project.DumbAwareAction
|
import com.intellij.openapi.project.DumbAwareAction
|
||||||
@@ -69,4 +70,7 @@ class ExShortcutKeyAction(private val exEntryPanel: ExEntryPanel) : DumbAwareAct
|
|||||||
|
|
||||||
registerCustomShortcutSet({ shortcuts }, exEntryPanel)
|
registerCustomShortcutSet({ shortcuts }, exEntryPanel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// / Or EDT? We access ExEntryPanel actually. But seems to work with BGT
|
||||||
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
||||||
|
* Copyright (C) 2003-2021 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 com.maddyhome.idea.vim.vimscript.model.functions.handlers
|
||||||
|
|
||||||
|
import com.intellij.refactoring.rename.inplace.InplaceRefactoring
|
||||||
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.VimLContext
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimInt
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
|
||||||
|
import com.maddyhome.idea.vim.vimscript.model.functions.FunctionHandler
|
||||||
|
|
||||||
|
object RenamingFunctionHandler : FunctionHandler() {
|
||||||
|
|
||||||
|
override val name = "renaming"
|
||||||
|
override val minimumNumberOfArguments = 0
|
||||||
|
override val maximumNumberOfArguments = 0
|
||||||
|
|
||||||
|
override fun doFunction(
|
||||||
|
argumentValues: List<Expression>,
|
||||||
|
editor: VimEditor,
|
||||||
|
context: ExecutionContext,
|
||||||
|
vimContext: VimLContext,
|
||||||
|
): VimDataType {
|
||||||
|
return if (InplaceRefactoring.getActiveInplaceRenamer(editor.ij) == null)
|
||||||
|
VimInt.ZERO
|
||||||
|
else
|
||||||
|
VimInt.ONE
|
||||||
|
}
|
||||||
|
}
|
@@ -14,5 +14,6 @@
|
|||||||
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.TolowerFunctionHandler" name="tolower"/>
|
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.TolowerFunctionHandler" name="tolower"/>
|
||||||
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.ToupperFunctionHandler" name="toupper"/>
|
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.ToupperFunctionHandler" name="toupper"/>
|
||||||
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.JoinFunctionHandler" name="join"/>
|
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.JoinFunctionHandler" name="join"/>
|
||||||
|
<vimLibraryFunction implementation="com.maddyhome.idea.vim.vimscript.model.functions.handlers.RenamingFunctionHandler" name="renaming"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -1,12 +1,115 @@
|
|||||||
<idea-plugin url="https://plugins.jetbrains.com/plugin/164" xmlns:xi="http://www.w3.org/2001/XInclude">
|
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<name>IdeaVim</name>
|
<name>IdeaVim</name>
|
||||||
<id>IdeaVIM</id>
|
<id>IdeaVIM</id>
|
||||||
<change-notes><![CDATA[
|
<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><Plug>Commentary</code> instead of <code><Plug>(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>& 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>
|
</change-notes>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p>Vim emulation plugin for IntelliJ Platform-based IDEs.</p>
|
<p>Vim engine for JetBrains IDEs</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing,
|
<p>IdeaVim supports many Vim features including normal/insert/visual modes, motion keys, deletion/changing,
|
||||||
marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, Vim plugins, etc.</p>
|
marks, registers, some Ex commands, Vim regexps, configuration via ~/.ideavimrc, macros, Vim plugins, etc.</p>
|
||||||
@@ -17,7 +120,7 @@
|
|||||||
<li><a href="https://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
<li><a href="https://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
||||||
</ul>
|
</ul>
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>SNAPSHOT</version>
|
<version>chylex</version>
|
||||||
<vendor>JetBrains</vendor>
|
<vendor>JetBrains</vendor>
|
||||||
|
|
||||||
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
||||||
@@ -36,6 +139,11 @@
|
|||||||
<depends optional="true" config-file="ides/ideavim-withAppCode.xml">com.intellij.modules.appcode</depends>
|
<depends optional="true" config-file="ides/ideavim-withAppCode.xml">com.intellij.modules.appcode</depends>
|
||||||
<depends optional="true" config-file="ideavim-withAceJump.xml">AceJump</depends>
|
<depends optional="true" config-file="ideavim-withAceJump.xml">AceJump</depends>
|
||||||
|
|
||||||
|
<applicationListeners>
|
||||||
|
<listener class="com.maddyhome.idea.vim.PyNotebooksCloseWorkaround"
|
||||||
|
topic="com.intellij.openapi.project.ProjectManagerListener"/>
|
||||||
|
</applicationListeners>
|
||||||
|
|
||||||
<application-components>
|
<application-components>
|
||||||
<component>
|
<component>
|
||||||
<implementation-class>com.maddyhome.idea.vim.DynamicLoaderStopper</implementation-class>
|
<implementation-class>com.maddyhome.idea.vim.DynamicLoaderStopper</implementation-class>
|
||||||
|
@@ -63,7 +63,7 @@ E548=E548: Digit expected: {0}
|
|||||||
E549=E549: Illegal percentage: {0}
|
E549=E549: Illegal percentage: {0}
|
||||||
E774=E774: 'operatorfunc' is empty
|
E774=E774: 'operatorfunc' is empty
|
||||||
|
|
||||||
action.VimPluginToggle.text=Vim Emulator
|
action.VimPluginToggle.text=Vim
|
||||||
action.VimPluginToggle.description=Toggle the vim plugin On/Off
|
action.VimPluginToggle.description=Toggle the vim plugin On/Off
|
||||||
action.VimPluginToggle.enabled=Enabled
|
action.VimPluginToggle.enabled=Enabled
|
||||||
action.VimPluginToggle.enable=Enable
|
action.VimPluginToggle.enable=Enable
|
||||||
|
@@ -53,6 +53,8 @@ internal object NeovimTesting {
|
|||||||
private lateinit var escapeCommand: String
|
private lateinit var escapeCommand: String
|
||||||
private lateinit var ctrlcCommand: String
|
private lateinit var ctrlcCommand: String
|
||||||
|
|
||||||
|
private var singleCaret = true
|
||||||
|
|
||||||
fun setUp(test: VimTestCase) {
|
fun setUp(test: VimTestCase) {
|
||||||
if (!neovimEnabled(test)) return
|
if (!neovimEnabled(test)) return
|
||||||
val nvimPath = System.getenv("ideavim.nvim.path") ?: "nvim"
|
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 method = test.javaClass.getMethod(test.name)
|
||||||
val noBehaviourDiffers = !method.isAnnotationPresent(VimBehaviorDiffers::class.java)
|
val noBehaviourDiffers = !method.isAnnotationPresent(VimBehaviorDiffers::class.java)
|
||||||
val noTestingWithoutNeovim = !method.isAnnotationPresent(TestWithoutNeovim::class.java)
|
val noTestingWithoutNeovim = !method.isAnnotationPresent(TestWithoutNeovim::class.java)
|
||||||
val neovimTestingEnabled = System.getProperty("ideavim.nvim.test", "false")!!.toBoolean()
|
val neovimTestingEnabled = System.getProperty("ideavim.nvim.test", "false")!!.toBoolean()
|
||||||
val notParserTest = "org.jetbrains.plugins.ideavim.ex.parser" !in test.javaClass.packageName
|
val notParserTest = "org.jetbrains.plugins.ideavim.ex.parser" !in test.javaClass.packageName
|
||||||
val notScriptImplementation = "org.jetbrains.plugins.ideavim.ex.implementation" !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) {
|
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()
|
neovimApi.currentBuffer.get().setLines(0, -1, false, editor.document.text.split("\n")).get()
|
||||||
val charPosition = CharacterPosition.fromOffset(editor, editor.caretModel.offset)
|
val charPosition = CharacterPosition.fromOffset(editor, editor.caretModel.offset)
|
||||||
neovimApi.currentWindow.get().setCursor(VimCoords(charPosition.line + 1, charPosition.column)).get()
|
neovimApi.currentWindow.get().setCursor(VimCoords(charPosition.line + 1, charPosition.column)).get()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun typeCommand(keys: String, test: VimTestCase) {
|
fun typeCommand(keys: String, test: VimTestCase, editor: Editor) {
|
||||||
if (!neovimEnabled(test)) return
|
if (!neovimEnabled(test, editor)) return
|
||||||
when {
|
when {
|
||||||
keys.equals("<esc>", ignoreCase = true) -> neovimApi.input(escapeCommand).get()
|
keys.equals("<esc>", ignoreCase = true) -> neovimApi.input(escapeCommand).get()
|
||||||
keys.equals("<C-C>", ignoreCase = true) -> neovimApi.input(ctrlcCommand).get()
|
keys.equals("<C-C>", ignoreCase = true) -> neovimApi.input(ctrlcCommand).get()
|
||||||
@@ -120,7 +132,7 @@ internal object NeovimTesting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun assertState(editor: Editor, test: VimTestCase) {
|
fun assertState(editor: Editor, test: VimTestCase) {
|
||||||
if (!neovimEnabled(test)) return
|
if (!neovimEnabled(test, editor)) return
|
||||||
if (currentTestName != "") {
|
if (currentTestName != "") {
|
||||||
currentTestName = ""
|
currentTestName = ""
|
||||||
neovimTestsCounter++
|
neovimTestsCounter++
|
||||||
@@ -140,7 +152,7 @@ internal object NeovimTesting {
|
|||||||
private fun getText(): String = neovimApi.currentBuffer.get().getLines(0, -1, false).get().joinToString("\n")
|
private fun getText(): String = neovimApi.currentBuffer.get().getLines(0, -1, false).get().joinToString("\n")
|
||||||
|
|
||||||
fun assertCaret(editor: Editor, test: VimTestCase) {
|
fun assertCaret(editor: Editor, test: VimTestCase) {
|
||||||
if (!neovimEnabled(test)) return
|
if (!neovimEnabled(test, editor)) return
|
||||||
if (currentTestName != "") {
|
if (currentTestName != "") {
|
||||||
currentTestName = ""
|
currentTestName = ""
|
||||||
neovimTestsCounter++
|
neovimTestsCounter++
|
||||||
@@ -200,7 +212,6 @@ annotation class TestWithoutNeovim(val reason: SkipNeovimReason, val description
|
|||||||
|
|
||||||
enum class SkipNeovimReason {
|
enum class SkipNeovimReason {
|
||||||
PLUGIN,
|
PLUGIN,
|
||||||
MULTICARET,
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
INLAYS,
|
INLAYS,
|
||||||
@@ -221,7 +232,6 @@ enum class SkipNeovimReason {
|
|||||||
EDITOR_MODIFICATION,
|
EDITOR_MODIFICATION,
|
||||||
|
|
||||||
CMD,
|
CMD,
|
||||||
IDEAVIMRC,
|
|
||||||
ACTION_COMMAND,
|
ACTION_COMMAND,
|
||||||
PLUG,
|
PLUG,
|
||||||
FOLDING,
|
FOLDING,
|
||||||
|
@@ -20,7 +20,6 @@ package org.jetbrains.plugins.ideavim
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.RegisterActions.VIM_ACTIONS_EP
|
import com.maddyhome.idea.vim.RegisterActions.VIM_ACTIONS_EP
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
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.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.handler.ActionBeanClass
|
import com.maddyhome.idea.vim.handler.ActionBeanClass
|
||||||
@@ -42,10 +41,9 @@ class RegisterActionsTest : VimTestCase() {
|
|||||||
setupChecks {
|
setupChecks {
|
||||||
caretShape = false
|
caretShape = false
|
||||||
}
|
}
|
||||||
val keys = injector.parser.parseKeys("jklwB") // just random keys
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = "I jklwB${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)
|
VimPlugin.setEnabled(false)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -55,10 +53,9 @@ class RegisterActionsTest : VimTestCase() {
|
|||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test turn plugin off and on`() {
|
fun `test turn plugin off and on`() {
|
||||||
val keys = injector.parser.parseKeys("l")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = "I f${c}ound 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(false)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
}
|
}
|
||||||
@@ -66,10 +63,9 @@ class RegisterActionsTest : VimTestCase() {
|
|||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test enable twice`() {
|
fun `test enable twice`() {
|
||||||
val keys = injector.parser.parseKeys("l")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = "I f${c}ound 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(false)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
@@ -78,11 +74,10 @@ class RegisterActionsTest : VimTestCase() {
|
|||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test unregister extension`() {
|
fun `test unregister extension`() {
|
||||||
val keys = injector.parser.parseKeys("l")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = "I f${c}ound it in a legendary land"
|
val after = "I f${c}ound it in a legendary land"
|
||||||
var motionRightAction: ActionBeanClass? = null
|
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()
|
motionRightAction = VIM_ACTIONS_EP.extensions().filter { it.actionId == "VimPreviousTabAction" }.findFirst().get()
|
||||||
|
|
||||||
assertNotNull(getCommandNode())
|
assertNotNull(getCommandNode())
|
||||||
|
@@ -94,7 +94,7 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
super.setUp()
|
super.setUp()
|
||||||
val factory = IdeaTestFixtureFactory.getFixtureFactory()
|
val factory = IdeaTestFixtureFactory.getFixtureFactory()
|
||||||
val projectDescriptor = LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR
|
val projectDescriptor = LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR
|
||||||
val fixtureBuilder = factory.createLightFixtureBuilder(projectDescriptor)
|
val fixtureBuilder = factory.createLightFixtureBuilder(projectDescriptor, "IdeaVim")
|
||||||
val fixture = fixtureBuilder.fixture
|
val fixture = fixtureBuilder.fixture
|
||||||
myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(
|
myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(
|
||||||
fixture,
|
fixture,
|
||||||
@@ -229,6 +229,7 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
private fun configureByText(fileName: String, content: String): Editor {
|
private fun configureByText(fileName: String, content: String): Editor {
|
||||||
@Suppress("IdeaVimAssertState")
|
@Suppress("IdeaVimAssertState")
|
||||||
myFixture.configureByText(fileName, content)
|
myFixture.configureByText(fileName, content)
|
||||||
|
NeovimTesting.setupEditor(myFixture.editor, this)
|
||||||
setEditorVisibleSize(screenWidth, screenHeight)
|
setEditorVisibleSize(screenWidth, screenHeight)
|
||||||
return myFixture.editor
|
return myFixture.editor
|
||||||
}
|
}
|
||||||
@@ -236,6 +237,7 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
protected fun configureByFileName(fileName: String): Editor {
|
protected fun configureByFileName(fileName: String): Editor {
|
||||||
@Suppress("IdeaVimAssertState")
|
@Suppress("IdeaVimAssertState")
|
||||||
myFixture.configureByText(fileName, "\n")
|
myFixture.configureByText(fileName, "\n")
|
||||||
|
NeovimTesting.setupEditor(myFixture.editor, this)
|
||||||
setEditorVisibleSize(screenWidth, screenHeight)
|
setEditorVisibleSize(screenWidth, screenHeight)
|
||||||
return myFixture.editor
|
return myFixture.editor
|
||||||
}
|
}
|
||||||
@@ -298,8 +300,12 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected fun typeText(keys: List<KeyStroke?>): Editor {
|
protected fun typeText(keys: List<KeyStroke?>): Editor {
|
||||||
NeovimTesting.typeCommand(keys.filterNotNull().joinToString(separator = "") { injector.parser.toKeyNotation(it) }, this)
|
|
||||||
val editor = myFixture.editor
|
val editor = myFixture.editor
|
||||||
|
NeovimTesting.typeCommand(
|
||||||
|
keys.filterNotNull().joinToString(separator = "") { injector.parser.toKeyNotation(it) },
|
||||||
|
this,
|
||||||
|
editor
|
||||||
|
)
|
||||||
val project = myFixture.project
|
val project = myFixture.project
|
||||||
when (Checks.keyHandler) {
|
when (Checks.keyHandler) {
|
||||||
Checks.KeyHandlerMethod.DIRECT_TO_VIM -> typeText(keys, editor, project)
|
Checks.KeyHandlerMethod.DIRECT_TO_VIM -> typeText(keys, editor, project)
|
||||||
@@ -328,6 +334,12 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
NeovimTesting.assertState(myFixture.editor, this)
|
NeovimTesting.assertState(myFixture.editor, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun assertState(modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
|
||||||
|
assertMode(modeAfter)
|
||||||
|
assertSubMode(subModeAfter)
|
||||||
|
assertCaretsVisualAttributes()
|
||||||
|
}
|
||||||
|
|
||||||
fun assertPosition(line: Int, column: Int) {
|
fun assertPosition(line: Int, column: Int) {
|
||||||
val carets = myFixture.editor.caretModel.allCarets
|
val carets = myFixture.editor.caretModel.allCarets
|
||||||
Assert.assertEquals("Wrong amount of carets", 1, carets.size)
|
Assert.assertEquals("Wrong amount of carets", 1, carets.size)
|
||||||
@@ -459,7 +471,7 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
val actual = getInstance(myFixture.editor).text
|
val actual = getInstance(myFixture.editor).text
|
||||||
Assert.assertNotNull("No Ex output", actual)
|
Assert.assertNotNull("No Ex output", actual)
|
||||||
Assert.assertEquals(expected, actual)
|
Assert.assertEquals(expected, actual)
|
||||||
NeovimTesting.typeCommand("<esc>", this)
|
NeovimTesting.typeCommand("<esc>", this, myFixture.editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun assertNoExOutput() {
|
fun assertNoExOutput() {
|
||||||
@@ -501,95 +513,46 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
fun doTest(
|
fun doTest(
|
||||||
keys: List<String>,
|
keys: List<String>,
|
||||||
before: String,
|
before: String,
|
||||||
after: 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)
|
doTest(keys.joinToString(separator = ""), before, after, modeAfter, subModeAfter, fileType, fileName, afterEditorInitialized)
|
||||||
}
|
|
||||||
|
|
||||||
fun doTest(
|
|
||||||
keys: List<String>,
|
|
||||||
before: String,
|
|
||||||
after: String,
|
|
||||||
modeAfter: VimStateMachine.Mode,
|
|
||||||
subModeAfter: SubMode,
|
|
||||||
) {
|
|
||||||
doTest(keys.joinToString(separator = ""), before, after, modeAfter, subModeAfter)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
fun doTest(
|
fun doTest(
|
||||||
keys: String,
|
keys: String,
|
||||||
before: String,
|
before: String,
|
||||||
after: String,
|
after: String,
|
||||||
modeAfter: VimStateMachine.Mode,
|
modeAfter: VimStateMachine.Mode = VimStateMachine.Mode.COMMAND,
|
||||||
subModeAfter: SubMode,
|
subModeAfter: SubMode = SubMode.NONE,
|
||||||
|
fileType: FileType? = null,
|
||||||
|
fileName: String? = null,
|
||||||
|
afterEditorInitialized: ((Editor) -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
configureByText(before)
|
if (fileName != null) {
|
||||||
|
configureByText(fileName, before)
|
||||||
|
} else if (fileType != null) {
|
||||||
|
configureByText(fileType, before)
|
||||||
|
} else {
|
||||||
|
configureByText(before)
|
||||||
|
}
|
||||||
|
afterEditorInitialized?.invoke(myFixture.editor)
|
||||||
performTest(keys, after, modeAfter, subModeAfter)
|
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,
|
|
||||||
) {
|
|
||||||
configureByText(fileName, before)
|
|
||||||
|
|
||||||
NeovimTesting.setupEditor(myFixture.editor, this)
|
|
||||||
NeovimTesting.typeCommand(keys, this)
|
|
||||||
|
|
||||||
performTest(keys, after, modeAfter, subModeAfter)
|
|
||||||
|
|
||||||
NeovimTesting.assertState(myFixture.editor, this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun performTest(keys: String, after: String, modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
|
protected fun performTest(keys: String, after: String, modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
|
||||||
typeText(injector.parser.parseKeys(keys))
|
typeText(injector.parser.parseKeys(keys))
|
||||||
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
|
PlatformTestUtil.dispatchAllInvocationEventsInIdeEventQueue()
|
||||||
@Suppress("IdeaVimAssertState")
|
assertState(after)
|
||||||
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(modeAfter, subModeAfter)
|
assertState(modeAfter, subModeAfter)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,12 +561,6 @@ abstract class VimTestCase : UsefulTestCase() {
|
|||||||
NeovimTesting.setRegister(register, keys, this)
|
NeovimTesting.setRegister(register, keys, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun assertState(modeAfter: VimStateMachine.Mode, subModeAfter: SubMode) {
|
|
||||||
assertMode(modeAfter)
|
|
||||||
assertSubMode(subModeAfter)
|
|
||||||
assertCaretsVisualAttributes()
|
|
||||||
}
|
|
||||||
|
|
||||||
protected val fileManager: FileEditorManagerEx
|
protected val fileManager: FileEditorManagerEx
|
||||||
get() = FileEditorManagerEx.getInstanceEx(myFixture.project)
|
get() = FileEditorManagerEx.getInstanceEx(myFixture.project)
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
|
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
@@ -1039,4 +1040,16 @@ two
|
|||||||
)
|
)
|
||||||
assertOffset(4)
|
assertOffset(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun `test gv after backwards selection`() {
|
||||||
|
configureByText("${c}Oh, hi Mark\n")
|
||||||
|
typeText(parseKeys("yw" + "$" + "vb" + "p" + "gv"))
|
||||||
|
assertSelection("Oh")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun `test gv after linewise selection`() {
|
||||||
|
configureByText("${c}Oh, hi Mark\nOh, hi Markus\n")
|
||||||
|
typeText(parseKeys("V" + "y" + "j" + "V" + "p" + "gv"))
|
||||||
|
assertSelection("Oh, hi Mark")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -131,7 +131,6 @@ class RepeatChangeActionTest : VimTestCase() {
|
|||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test multicaret`() {
|
fun `test multicaret`() {
|
||||||
val keys = listOf("v2erXj^", ".")
|
val keys = listOf("v2erXj^", ".")
|
||||||
val before = """
|
val before = """
|
||||||
|
@@ -41,7 +41,8 @@ class UndoActionTest : VimTestCase() {
|
|||||||
assertFalse(editor.caretModel.primaryCaret.hasSelection())
|
assertFalse(editor.caretModel.primaryCaret.hasSelection())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test undo after selection`() {
|
// Not yet supported
|
||||||
|
fun `undo after selection`() {
|
||||||
val keys = listOf("v3eld", "u")
|
val keys = listOf("v3eld", "u")
|
||||||
val before = """
|
val before = """
|
||||||
A Discovery
|
A Discovery
|
||||||
|
@@ -23,8 +23,6 @@ package org.jetbrains.plugins.ideavim.action.change.change
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
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.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class ChangeVisualActionTest : VimTestCase() {
|
class ChangeVisualActionTest : VimTestCase() {
|
||||||
@@ -155,7 +153,6 @@ class ChangeVisualActionTest : VimTestCase() {
|
|||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test change visual action`() {
|
fun `test change visual action`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("v2lc" + "aaa" + "<ESC>"),
|
injector.parser.parseKeys("v2lc" + "aaa" + "<ESC>"),
|
||||||
|
@@ -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)
|
||||||
|
// }
|
||||||
|
// }
|
@@ -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.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +112,6 @@ class ChangeVisualNumberDecActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test change number dec visual action`() {
|
fun `test change number dec visual action`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("Vj<C-X>"),
|
injector.parser.parseKeys("Vj<C-X>"),
|
||||||
|
@@ -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.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +112,6 @@ class ChangeVisualNumberIncActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test change number inc visual multiple cursor`() {
|
fun `test change number inc visual multiple cursor`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("Vj<C-A>"),
|
injector.parser.parseKeys("Vj<C-A>"),
|
||||||
|
@@ -49,6 +49,23 @@ class DeleteMotionActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun `test on line in middle`() {
|
||||||
|
typeTextInFile(
|
||||||
|
injector.parser.parseKeys("dd"),
|
||||||
|
"""
|
||||||
|
def xxx():
|
||||||
|
expression${c} one
|
||||||
|
expression two
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
assertState(
|
||||||
|
"""
|
||||||
|
def xxx():
|
||||||
|
${c}expression two
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun `test delete single line`() {
|
fun `test delete single line`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("dd"),
|
injector.parser.parseKeys("dd"),
|
||||||
@@ -92,7 +109,6 @@ class DeleteMotionActionTest : VimTestCase() {
|
|||||||
assertEquals(" expression two\n", savedText)
|
assertEquals(" expression two\n", savedText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test delete line action multicaret`() {
|
fun `test delete line action multicaret`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("d3d"),
|
injector.parser.parseKeys("d3d"),
|
||||||
@@ -110,7 +126,6 @@ class DeleteMotionActionTest : VimTestCase() {
|
|||||||
assertState("${c}abcde\n${c}")
|
assertState("${c}abcde\n${c}")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test delete motion action multicaret`() {
|
fun `test delete motion action multicaret`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("dt)"),
|
injector.parser.parseKeys("dt)"),
|
||||||
|
@@ -20,12 +20,9 @@ package org.jetbrains.plugins.ideavim.action.change.insert
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class InsertAfterLineEndActionTest : VimTestCase() {
|
class InsertAfterLineEndActionTest : VimTestCase() {
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert after line end action`() {
|
fun `test insert after line end action`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("A" + " four" + "<ESC>"),
|
injector.parser.parseKeys("A" + " four" + "<ESC>"),
|
||||||
@@ -44,7 +41,6 @@ class InsertAfterLineEndActionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test multiple carets`() {
|
fun `test multiple carets`() {
|
||||||
doTest(
|
doTest(
|
||||||
"AHello<esc>",
|
"AHello<esc>",
|
||||||
|
@@ -19,12 +19,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.change.insert
|
package org.jetbrains.plugins.ideavim.action.change.insert
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class InsertBeforeFirstNonBlankActionTest : VimTestCase() {
|
class InsertBeforeFirstNonBlankActionTest : VimTestCase() {
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert multiple carets`() {
|
fun `test insert multiple carets`() {
|
||||||
doTest(
|
doTest(
|
||||||
"IHello<esc>",
|
"IHello<esc>",
|
||||||
|
@@ -23,8 +23,6 @@ package org.jetbrains.plugins.ideavim.action.change.insert
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
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.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class InsertDeletePreviousWordActionTest : VimTestCase() {
|
class InsertDeletePreviousWordActionTest : VimTestCase() {
|
||||||
@@ -146,7 +144,6 @@ class InsertDeletePreviousWordActionTest : VimTestCase() {
|
|||||||
assertState("hello\n" + "one two \n")
|
assertState("hello\n" + "one two \n")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert delete previous word action`() {
|
fun `test insert delete previous word action`() {
|
||||||
typeTextInFile(
|
typeTextInFile(
|
||||||
injector.parser.parseKeys("i" + "<C-W>" + "<ESC>"),
|
injector.parser.parseKeys("i" + "<C-W>" + "<ESC>"),
|
||||||
|
@@ -99,7 +99,6 @@ class InsertNewLineAboveActionTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert new line above with multiple carets`() {
|
fun `test insert new line above with multiple carets`() {
|
||||||
val before = """ I fou${c}nd it in a legendary land
|
val before = """ I fou${c}nd it in a legendary land
|
||||||
| all rocks and laven${c}der and tufted grass,
|
| all rocks and laven${c}der and tufted grass,
|
||||||
|
@@ -117,7 +117,6 @@ class InsertNewLineBelowActionTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert new line below with multiple carets`() {
|
fun `test insert new line below with multiple carets`() {
|
||||||
val before = """ I fou${c}nd it in a legendary land
|
val before = """ I fou${c}nd it in a legendary land
|
||||||
| all rocks and laven${c}der and tufted grass,
|
| 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)
|
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`() {
|
fun `test insert new line below with folds 2`() {
|
||||||
val before = """I found it in a legendary land
|
val before = """I found it in a legendary land
|
||||||
|${c}all rocks [and lavender and tufted grass,
|
|${c}all rocks [and lavender and tufted grass,
|
||||||
|
@@ -28,7 +28,6 @@ import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
|||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class InsertTabActionTest : VimTestCase() {
|
class InsertTabActionTest : VimTestCase() {
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test insert tab`() {
|
fun `test insert tab`() {
|
||||||
setupChecks {
|
setupChecks {
|
||||||
keyHandler = Checks.KeyHandlerMethod.DIRECT_TO_VIM
|
keyHandler = Checks.KeyHandlerMethod.DIRECT_TO_VIM
|
||||||
|
@@ -57,7 +57,6 @@ class VisualBlockAppendActionTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test append in non block mode`() {
|
fun `test append in non block mode`() {
|
||||||
doTest(
|
doTest(
|
||||||
"vwAHello<esc>",
|
"vwAHello<esc>",
|
||||||
|
@@ -73,9 +73,7 @@ Xbar
|
|||||||
|
|
||||||
ba_quux_r
|
ba_quux_r
|
||||||
|
|
||||||
""".trimIndent(),
|
""".trimIndent()
|
||||||
VimStateMachine.Mode.COMMAND,
|
|
||||||
VimStateMachine.SubMode.NONE
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +95,7 @@ Xbar
|
|||||||
quux spam eggs
|
quux spam eggs
|
||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
),
|
)
|
||||||
VimStateMachine.Mode.COMMAND,
|
|
||||||
VimStateMachine.SubMode.NONE
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,9 +132,7 @@ Xbar
|
|||||||
ba_quux_r
|
ba_quux_r
|
||||||
|
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
),
|
)
|
||||||
VimStateMachine.Mode.COMMAND,
|
|
||||||
VimStateMachine.SubMode.NONE
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,10 +156,7 @@ Xbar
|
|||||||
where it was settled on some sodden sand
|
where it was settled on some sodden sand
|
||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND,
|
|
||||||
VimStateMachine.SubMode.NONE
|
|
||||||
)
|
)
|
||||||
assertMode(VimStateMachine.Mode.COMMAND)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)
|
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)
|
||||||
@@ -179,7 +170,7 @@ Xbar
|
|||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
"""
|
"""
|
||||||
doTest(
|
doTest(
|
||||||
injector.parser.parseKeys("<C-V>" + "jjI" + " Hello " + "<ESC>"),
|
listOf("<C-V>" + "jjI" + " Hello " + "<ESC>"),
|
||||||
before.trimIndent(),
|
before.trimIndent(),
|
||||||
"""
|
"""
|
||||||
A Discovery
|
A Discovery
|
||||||
@@ -189,14 +180,11 @@ Xbar
|
|||||||
where it was s Hello ettled on some sodden sand
|
where it was s Hello ettled on some sodden sand
|
||||||
hard by the torrent of a mountain pass.
|
hard by the torrent of a mountain pass.
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND,
|
|
||||||
VimStateMachine.SubMode.NONE
|
|
||||||
) {
|
) {
|
||||||
it.inlayModel.addInlineElement(before.indexOf("found"), HintRenderer("Hello"))
|
it.inlayModel.addInlineElement(before.indexOf("found"), HintRenderer("Hello"))
|
||||||
it.inlayModel.addInlineElement(before.indexOf("l rocks"), HintRenderer("Hello"))
|
it.inlayModel.addInlineElement(before.indexOf("l rocks"), HintRenderer("Hello"))
|
||||||
it.inlayModel.addInlineElement(before.indexOf("ere it"), HintRenderer("Hello"))
|
it.inlayModel.addInlineElement(before.indexOf("ere it"), HintRenderer("Hello"))
|
||||||
}
|
}
|
||||||
assertMode(VimStateMachine.Mode.COMMAND)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)
|
@TestWithoutNeovim(SkipNeovimReason.VISUAL_BLOCK_MODE)
|
||||||
|
@@ -18,19 +18,48 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.editorActions.CopyPastePostProcessor
|
||||||
|
import com.intellij.codeInsight.editorActions.CopyPastePreProcessor
|
||||||
|
import com.intellij.codeInsight.editorActions.TextBlockTransferableData
|
||||||
|
import com.intellij.openapi.editor.CaretStateTransferableData
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.intellij.psi.PsiFile
|
||||||
|
import com.intellij.testFramework.ExtensionTestUtil
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.SelectionType
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
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.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.awt.datatransfer.Transferable
|
||||||
|
|
||||||
class PutTestAfterCursorActionTest : VimTestCase() {
|
class PutTestAfterCursorActionTest : VimTestCase() {
|
||||||
|
fun `test platform handlers are called`() {
|
||||||
|
val extension = TestExtension()
|
||||||
|
ExtensionTestUtil.maskExtensions(
|
||||||
|
CopyPastePostProcessor.EP_NAME,
|
||||||
|
listOf(extension),
|
||||||
|
myFixture.testRootDisposable
|
||||||
|
)
|
||||||
|
ExtensionTestUtil.maskExtensions(
|
||||||
|
CopyPastePreProcessor.EP_NAME,
|
||||||
|
listOf(),
|
||||||
|
myFixture.testRootDisposable
|
||||||
|
)
|
||||||
|
setRegister('4', "XXX ")
|
||||||
|
doTest(
|
||||||
|
"\"4p",
|
||||||
|
"This is my$c text",
|
||||||
|
"This is my XXX$c text",
|
||||||
|
VimStateMachine.Mode.COMMAND,
|
||||||
|
VimStateMachine.SubMode.NONE
|
||||||
|
)
|
||||||
|
assertEquals(1, extension.calledExtractTransferableData)
|
||||||
|
}
|
||||||
|
|
||||||
fun `test put from number register`() {
|
fun `test put from number register`() {
|
||||||
setRegister('4', "XXX ")
|
setRegister('4', "XXX ")
|
||||||
doTest(
|
doTest(
|
||||||
@@ -78,7 +107,6 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
@Test
|
@Test
|
||||||
fun `test inserting same content to multiple carets`() {
|
fun `test inserting same content to multiple carets`() {
|
||||||
val before = """
|
val before = """
|
||||||
@@ -102,4 +130,24 @@ class PutTestAfterCursorActionTest : VimTestCase() {
|
|||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestExtension : CopyPastePostProcessor<TextBlockTransferableData>() {
|
||||||
|
var calledExtractTransferableData = 0
|
||||||
|
override fun collectTransferableData(
|
||||||
|
file: PsiFile,
|
||||||
|
editor: Editor,
|
||||||
|
startOffsets: IntArray?,
|
||||||
|
endOffsets: IntArray?,
|
||||||
|
): List<TextBlockTransferableData> {
|
||||||
|
return emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun extractTransferableData(content: Transferable): List<TextBlockTransferableData> {
|
||||||
|
calledExtractTransferableData += 1
|
||||||
|
return listOf(
|
||||||
|
// Just some random data
|
||||||
|
CaretStateTransferableData(intArrayOf(), intArrayOf())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -91,7 +91,7 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
typeText(injector.parser.parseKeys("viw" + "y"))
|
typeText(injector.parser.parseKeys("viw" + "y"))
|
||||||
val editor = myFixture.editor.vim
|
val editor = myFixture.editor.vim
|
||||||
val lastRegister = injector.registerGroup.lastRegisterChar
|
val lastRegister = injector.registerGroup.lastRegisterChar
|
||||||
val registers = editor.carets().map { it.registerStorage.getRegister(lastRegister)?.rawText }
|
val registers = editor.carets().map { it.registerStorage.getRegister(it, lastRegister)?.rawText }
|
||||||
assertEquals(listOf("found", "was"), registers)
|
assertEquals(listOf("found", "was"), registers)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ class YankVisualActionTest : VimTestCase() {
|
|||||||
typeText(injector.parser.parseKeys("V" + "y"))
|
typeText(injector.parser.parseKeys("V" + "y"))
|
||||||
val editor = myFixture.editor.vim
|
val editor = myFixture.editor.vim
|
||||||
val lastRegister = injector.registerGroup.lastRegisterChar
|
val lastRegister = injector.registerGroup.lastRegisterChar
|
||||||
val registers = editor.carets().map { it.registerStorage.getRegister(lastRegister)?.rawText }
|
val registers = editor.carets().map { it.registerStorage.getRegister(it, lastRegister)?.rawText }
|
||||||
assertEquals(
|
assertEquals(
|
||||||
listOf("all rocks and lavender and tufted grass,\n", "hard by the torrent of a mountain pass.\n"),
|
listOf("all rocks and lavender and tufted grass,\n", "hard by the torrent of a mountain pass.\n"),
|
||||||
registers
|
registers
|
||||||
|
@@ -19,13 +19,10 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.search
|
package org.jetbrains.plugins.ideavim.action.motion.search
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
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 com.maddyhome.idea.vim.common.Direction
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import javax.swing.KeyStroke
|
|
||||||
|
|
||||||
class SearchAgainPreviousActionTest : VimTestCase() {
|
class SearchAgainPreviousActionTest : VimTestCase() {
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
@@ -36,14 +33,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
|||||||
...${c}all it was settled on some sodden sand
|
...${c}all it was settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
val keys = injector.parser.parseKeys("N")
|
|
||||||
val after = """
|
val after = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
...${c}all rocks and lavender and tufted grass,
|
...${c}all rocks and lavender and tufted grass,
|
||||||
...all it was settled on some sodden sand
|
...all it was settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
doTestWithSearch(keys, before, after)
|
doTestWithSearch("N", before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
@@ -54,14 +50,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
|||||||
...all it was .${c}all settled on some sodden sand
|
...all it was .${c}all settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
val keys = injector.parser.parseKeys("N")
|
|
||||||
val after = """
|
val after = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
...all rocks and lavender and tufted grass,
|
...all rocks and lavender and tufted grass,
|
||||||
...${c}all it was .all settled on some sodden sand
|
...${c}all it was .all settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
doTestWithSearch(keys, before, after)
|
doTestWithSearch("N", before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
@@ -72,14 +67,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
|||||||
...all it was .all.${c}all settled on some sodden sand
|
...all it was .all.${c}all settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
val keys = injector.parser.parseKeys("N")
|
|
||||||
val after = """
|
val after = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
...all rocks and lavender and tufted grass,
|
...all rocks and lavender and tufted grass,
|
||||||
...all it was .${c}all.all settled on some sodden sand
|
...all it was .${c}all.all settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
doTestWithSearch(keys, before, after)
|
doTestWithSearch("N", before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
@@ -90,14 +84,13 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
|||||||
...all it was settled on some sodden sand
|
...all it was settled on some sodden sand
|
||||||
...all by the torrent of a mountain pass
|
...all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
val keys = injector.parser.parseKeys("N")
|
|
||||||
val after = """
|
val after = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
...all rocks and lavender and tufted grass,
|
...all rocks and lavender and tufted grass,
|
||||||
...all it was settled on some sodden sand
|
...all it was settled on some sodden sand
|
||||||
...${c}all by the torrent of a mountain pass
|
...${c}all by the torrent of a mountain pass
|
||||||
""".trimIndent().dotToTab()
|
""".trimIndent().dotToTab()
|
||||||
doTestWithSearch(keys, before, after)
|
doTestWithSearch("N", before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun `test search previous after search command with offset`() {
|
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)
|
doTest(listOf(searchCommand("/land/1"), exCommand("s/and/or"), "G", "N"), before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
private fun doTestWithSearch(keys: String, before: String, after: String) {
|
||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
|
doTest(keys, before, after) {
|
||||||
VimPlugin.getSearch().setLastSearchState(it, "all", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(it, "all", "", Direction.FORWARDS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.updown
|
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 com.maddyhome.idea.vim.helper.vimLastColumn
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
@@ -36,12 +34,11 @@ class MotionUpActionTest : VimTestCase() {
|
|||||||
I found it in a le${c}gendary land
|
I found it in a le${c}gendary land
|
||||||
all rocks and lavender and tufted grass,
|
all rocks and lavender and tufted grass,
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest(keys, before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test last column is incorrect`() {
|
fun `test last column is incorrect`() {
|
||||||
val keys = injector.parser.parseKeys("k")
|
|
||||||
val before = """
|
val before = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
all rocks and lave${c}nder and tufted grass,
|
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
|
I found it in a le${c}gendary land
|
||||||
all rocks and lavender and tufted grass,
|
all rocks and lavender and tufted grass,
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
|
doTest("k", before, after) {
|
||||||
it.caretModel.primaryCaret.vimLastColumn = 5
|
it.caretModel.primaryCaret.vimLastColumn = 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,12 +66,11 @@ class MotionUpActionTest : VimTestCase() {
|
|||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
all rocks and lavender and tufted ${c}grass,
|
all rocks and lavender and tufted ${c}grass,
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest(keys, before, after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test last column wrong lastColumn`() {
|
fun `test last column wrong lastColumn`() {
|
||||||
val keys = injector.parser.parseKeys("k")
|
|
||||||
val before = """
|
val before = """
|
||||||
I found it in a legendary land
|
I found it in a legendary land
|
||||||
all rocks and lavender and tufted ${c}grass,
|
all rocks and lavender and tufted ${c}grass,
|
||||||
@@ -83,7 +79,7 @@ class MotionUpActionTest : VimTestCase() {
|
|||||||
I found it in a legendary lan${c}d
|
I found it in a legendary lan${c}d
|
||||||
all rocks and lavender and tufted grass,
|
all rocks and lavender and tufted grass,
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
doTest(keys, before, after, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE) {
|
doTest("k", before, after) {
|
||||||
it.caretModel.primaryCaret.vimLastColumn = 0
|
it.caretModel.primaryCaret.vimLastColumn = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,8 +28,6 @@ import com.maddyhome.idea.vim.helper.vimSelectionStart
|
|||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.OptionScope
|
||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
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.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
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`() {
|
fun `test enter visual with count after visual operation multicaret`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("vedx", "1v"),
|
listOf("vedx", "1v"),
|
||||||
|
@@ -54,20 +54,18 @@ class CommandParserTest : VimTestCase() {
|
|||||||
setupChecks {
|
setupChecks {
|
||||||
caretShape = false
|
caretShape = false
|
||||||
}
|
}
|
||||||
val keys = commandToKeys(">>")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = "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)
|
VimPlugin.setEnabled(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test turn off and on`() {
|
fun `test turn off and on`() {
|
||||||
val keys = commandToKeys(">>")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = " ${c}I 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(false)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
}
|
}
|
||||||
@@ -75,10 +73,9 @@ class CommandParserTest : VimTestCase() {
|
|||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
@TestWithoutNeovim(reason = SkipNeovimReason.EDITOR_MODIFICATION)
|
||||||
fun `test turn off and on twice`() {
|
fun `test turn off and on twice`() {
|
||||||
val keys = commandToKeys(">>")
|
|
||||||
val before = "I ${c}found it in a legendary land"
|
val before = "I ${c}found it in a legendary land"
|
||||||
val after = " ${c}I 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(false)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
VimPlugin.setEnabled(true)
|
VimPlugin.setEnabled(true)
|
||||||
|
@@ -68,7 +68,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testJoinLines() {
|
fun testJoinLines() {
|
||||||
val before = "qwe\n" + "r${c}ty\n" + "asd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
|
val before = "qwe\n" + "r${c}ty\n" + "asd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
@@ -86,7 +85,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
// myFixture.checkResult(after)
|
// myFixture.checkResult(after)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testCopyText() {
|
fun testCopyText() {
|
||||||
val before = "qwe\n" + "rty\n" + "a${c}sd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
|
val before = "qwe\n" + "rty\n" + "a${c}sd\n" + "fg${c}h\n" + "zxc\n" + "vbn\n"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
@@ -104,7 +102,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
// myFixture.checkResult(after)
|
// myFixture.checkResult(after)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testPutText() {
|
fun testPutText() {
|
||||||
// This test produces double ${c}zxc on 3rd line if non-idea paste is used
|
// This test produces double ${c}zxc on 3rd line if non-idea paste is used
|
||||||
val before = """
|
val before = """
|
||||||
@@ -173,7 +170,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
// myFixture.checkResult(after)
|
// myFixture.checkResult(after)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testMoveTextBeforeCarets() {
|
fun testMoveTextBeforeCarets() {
|
||||||
val before = "qwe\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "z${c}xc\n" + "vbn\n"
|
val before = "qwe\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "z${c}xc\n" + "vbn\n"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
@@ -182,7 +178,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testMoveTextAfterCarets() {
|
fun testMoveTextAfterCarets() {
|
||||||
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
@@ -191,7 +186,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testMoveTextBetweenCarets() {
|
fun testMoveTextBetweenCarets() {
|
||||||
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
val before = "q${c}we\n" + "rty\n" + "${c}asd\n" + "fgh\n" + "zxc\n" + "vbn\n"
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
@@ -200,7 +194,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testYankLines() {
|
fun testYankLines() {
|
||||||
val before = """qwe
|
val before = """qwe
|
||||||
|rt${c}y
|
|rt${c}y
|
||||||
@@ -230,7 +223,6 @@ class MultipleCaretsTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun testDeleteLines() {
|
fun testDeleteLines() {
|
||||||
val before = """qwe
|
val before = """qwe
|
||||||
|r${c}ty
|
|r${c}ty
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,6 +131,22 @@ class CmdCommandTest : VimTestCase() {
|
|||||||
assertPluginError(false)
|
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`() {
|
fun `test add command with arguments short`() {
|
||||||
VimPlugin.getCommand().resetAliases()
|
VimPlugin.getCommand().resetAliases()
|
||||||
configureByText("\n")
|
configureByText("\n")
|
||||||
|
@@ -21,8 +21,6 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
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.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class JoinLinesCommandTest : VimTestCase() {
|
class JoinLinesCommandTest : VimTestCase() {
|
||||||
@@ -97,7 +95,6 @@ class JoinLinesCommandTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test join multicaret`() {
|
fun `test join multicaret`() {
|
||||||
configureByText(
|
configureByText(
|
||||||
"""
|
"""
|
||||||
|
@@ -121,6 +121,22 @@ n ,f <Plug>Foo
|
|||||||
assertState("quux\n")
|
assertState("quux\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testddWithMapping() {
|
||||||
|
configureByText(
|
||||||
|
"""
|
||||||
|
Hello$c 1
|
||||||
|
Hello 2
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
typeText(commandToKeys("nmap dc k"))
|
||||||
|
typeText(injector.parser.parseKeys("dd"))
|
||||||
|
assertState(
|
||||||
|
"""
|
||||||
|
Hello 2
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun testNonRecursiveMapping() {
|
fun testNonRecursiveMapping() {
|
||||||
configureByText("\n")
|
configureByText("\n")
|
||||||
typeText(commandToKeys("inoremap a b"))
|
typeText(commandToKeys("inoremap a b"))
|
||||||
|
@@ -38,8 +38,8 @@ class MarksCommandTest : VimTestCase() {
|
|||||||
assertState(
|
assertState(
|
||||||
"""I found it in a legendary land
|
"""I found it in a legendary land
|
||||||
|all rocks and lavender and tufted grass,
|
|all rocks and lavender and tufted grass,
|
||||||
|${s}all rocks and lavender and tufted grass,
|
|${s}all rocks and lavender and tufted grass,$se
|
||||||
|${se}hard by the torrent of a mountain pass.
|
|hard by the torrent of a mountain pass.
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,6 @@ class ShiftLeftCommandTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test multiple carets`() {
|
fun `test multiple carets`() {
|
||||||
val before = """ I found it in a legendary land
|
val before = """ I found it in a legendary land
|
||||||
|${c}all rocks and lavender and tufted grass,
|
|${c}all rocks and lavender and tufted grass,
|
||||||
|
@@ -83,7 +83,6 @@ class ShiftRightCommandTest : VimTestCase() {
|
|||||||
assertState(after)
|
assertState(after)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.MULTICARET)
|
|
||||||
fun `test multiple carets`() {
|
fun `test multiple carets`() {
|
||||||
val before = """ I found it in a legendary land
|
val before = """ I found it in a legendary land
|
||||||
|${c}all rocks and lavender and tufted grass,
|
|${c}all rocks and lavender and tufted grass,
|
||||||
|
@@ -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())
|
||||||
|
}
|
||||||
|
}
|
@@ -41,8 +41,6 @@ import com.maddyhome.idea.vim.newapi.ij
|
|||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.OptionScope
|
||||||
import junit.framework.TestCase
|
import junit.framework.TestCase
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class OpMappingTest : VimTestCase() {
|
class OpMappingTest : VimTestCase() {
|
||||||
@@ -68,7 +66,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test simple delete`() {
|
fun `test simple delete`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dI",
|
"dI",
|
||||||
@@ -79,7 +76,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test simple delete backwards`() {
|
fun `test simple delete backwards`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dP",
|
"dP",
|
||||||
@@ -90,7 +86,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete emulate inclusive`() {
|
fun `test delete emulate inclusive`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dU",
|
"dU",
|
||||||
@@ -101,7 +96,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test linewise delete`() {
|
fun `test linewise delete`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dO",
|
"dO",
|
||||||
@@ -124,7 +118,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test disable extension via set`() {
|
fun `test disable extension via set`() {
|
||||||
configureByText("${c}I found it in a legendary land")
|
configureByText("${c}I found it in a legendary land")
|
||||||
typeText(injector.parser.parseKeys("Q"))
|
typeText(injector.parser.parseKeys("Q"))
|
||||||
@@ -139,7 +132,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
assertState("I ${c}found it in a legendary land")
|
assertState("I ${c}found it in a legendary land")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test disable extension as extension point`() {
|
fun `test disable extension as extension point`() {
|
||||||
configureByText("${c}I found it in a legendary land")
|
configureByText("${c}I found it in a legendary land")
|
||||||
typeText(injector.parser.parseKeys("Q"))
|
typeText(injector.parser.parseKeys("Q"))
|
||||||
@@ -158,7 +150,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
assertState("I ${c}found it in a legendary land")
|
assertState("I ${c}found it in a legendary land")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test disable disposed extension`() {
|
fun `test disable disposed extension`() {
|
||||||
configureByText("${c}I found it in a legendary land")
|
configureByText("${c}I found it in a legendary land")
|
||||||
typeText(injector.parser.parseKeys("Q"))
|
typeText(injector.parser.parseKeys("Q"))
|
||||||
@@ -176,7 +167,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
assertState("I ${c}found it in a legendary land")
|
assertState("I ${c}found it in a legendary land")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delayed action`() {
|
fun `test delayed action`() {
|
||||||
configureByText("${c}I found it in a legendary land")
|
configureByText("${c}I found it in a legendary land")
|
||||||
typeText(injector.parser.parseKeys("R"))
|
typeText(injector.parser.parseKeys("R"))
|
||||||
@@ -191,7 +181,6 @@ class OpMappingTest : VimTestCase() {
|
|||||||
/**
|
/**
|
||||||
* This test tests an intentionally incorrectly implemented action
|
* This test tests an intentionally incorrectly implemented action
|
||||||
*/
|
*/
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delayed incorrect action`() {
|
fun `test delayed incorrect action`() {
|
||||||
configureByText("${c}I found it in a legendary land")
|
configureByText("${c}I found it in a legendary land")
|
||||||
typeText(injector.parser.parseKeys("E"))
|
typeText(injector.parser.parseKeys("E"))
|
||||||
@@ -221,21 +210,18 @@ class PlugExtensionsTest : VimTestCase() {
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test enable via plug`() {
|
fun `test enable via plug`() {
|
||||||
injector.vimscriptExecutor.execute("Plug 'MyTest'", false)
|
injector.vimscriptExecutor.execute("Plug 'MyTest'", false)
|
||||||
|
|
||||||
assertTrue(extension.ext.initialized)
|
assertTrue(extension.ext.initialized)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test enable via plugin`() {
|
fun `test enable via plugin`() {
|
||||||
injector.vimscriptExecutor.execute("Plugin 'MyTest'", false)
|
injector.vimscriptExecutor.execute("Plugin 'MyTest'", false)
|
||||||
|
|
||||||
assertTrue(extension.ext.initialized)
|
assertTrue(extension.ext.initialized)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test enable via plug and disable via set`() {
|
fun `test enable via plug and disable via set`() {
|
||||||
injector.vimscriptExecutor.execute("Plug 'MyTest'")
|
injector.vimscriptExecutor.execute("Plug 'MyTest'")
|
||||||
injector.vimscriptExecutor.execute("set noTestExtension")
|
injector.vimscriptExecutor.execute("set noTestExtension")
|
||||||
@@ -261,7 +247,6 @@ class PlugMissingKeysTest : VimTestCase() {
|
|||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test missing keys`() {
|
fun `test missing keys`() {
|
||||||
executeLikeVimrc(
|
executeLikeVimrc(
|
||||||
"map myKey <Plug>TestMissing",
|
"map myKey <Plug>TestMissing",
|
||||||
@@ -277,7 +262,6 @@ class PlugMissingKeysTest : VimTestCase() {
|
|||||||
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
|
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test missing keys enable plugin first`() {
|
fun `test missing keys enable plugin first`() {
|
||||||
executeLikeVimrc(
|
executeLikeVimrc(
|
||||||
"Plug 'MyTest'",
|
"Plug 'MyTest'",
|
||||||
@@ -293,7 +277,6 @@ class PlugMissingKeysTest : VimTestCase() {
|
|||||||
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
|
TestCase.assertEquals(injector.parser.parseKeys("L"), iKeyMappings.first().first)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test packadd`() {
|
fun `test packadd`() {
|
||||||
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
||||||
executeLikeVimrc(
|
executeLikeVimrc(
|
||||||
@@ -303,7 +286,6 @@ class PlugMissingKeysTest : VimTestCase() {
|
|||||||
assertTrue(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
assertTrue(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test packadd ex`() {
|
fun `test packadd ex`() {
|
||||||
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
assertFalse(injector.optionService.isSet(OptionScope.GLOBAL, "matchit"))
|
||||||
executeLikeVimrc(
|
executeLikeVimrc(
|
||||||
|
@@ -22,8 +22,6 @@ import com.google.common.collect.Lists;
|
|||||||
import com.maddyhome.idea.vim.api.VimInjectorKt;
|
import com.maddyhome.idea.vim.api.VimInjectorKt;
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine;
|
import com.maddyhome.idea.vim.command.VimStateMachine;
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers;
|
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.plugins.ideavim.VimTestCase;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -41,7 +39,7 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
VimInjectorKt.getInjector().getVimscriptExecutor().execute("let argtextobj_pairs='" + value + "'", true);
|
VimInjectorKt.getInjector().getVimscriptExecutor().execute("let argtextobj_pairs='" + value + "'", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testDeleteAnArgument() {
|
public void testDeleteAnArgument() {
|
||||||
doTest(Lists.newArrayList("daa"), "function(int arg1, char<caret>* arg2=\"a,b,c(d,e)\")",
|
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);
|
"function(int arg1<caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
@@ -49,13 +47,11 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
VimStateMachine.SubMode.NONE);
|
VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testChangeInnerArgument() {
|
public void testChangeInnerArgument() {
|
||||||
doTest(Lists.newArrayList("cia"), "function(int arg1, char<caret>* arg2=\"a,b,c(d,e)\")",
|
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);
|
"function(int arg1, <caret>)", VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testSmartArgumentRecognition() {
|
public void testSmartArgumentRecognition() {
|
||||||
doTest(Lists.newArrayList("dia"), "function(1, (20<caret>*30)+40, somefunc2(3, 4))",
|
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);
|
"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);
|
"function(1, (20*30)+40, somefunc2(<caret>4))", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testIgnoreQuotedArguments() {
|
public void testIgnoreQuotedArguments() {
|
||||||
doTest(Lists.newArrayList("daa"), "function(int arg1, char* arg2=a,b,c(<caret>arg,e))",
|
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);
|
"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);
|
"function(int arg1<caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testDeleteTwoArguments() {
|
public void testDeleteTwoArguments() {
|
||||||
doTest(Lists.newArrayList("d2aa"), "function(int <caret>arg1, char* arg2=\"a,b,c(d,e)\")", "function(<caret>)",
|
doTest(Lists.newArrayList("d2aa"), "function(int <caret>arg1, char* arg2=\"a,b,c(d,e)\")", "function(<caret>)",
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
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);
|
"function(int arg1, <caret>)", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testSelectTwoArguments() {
|
public void testSelectTwoArguments() {
|
||||||
doTest(Lists.newArrayList("v2aa"), "function(int <caret>arg1, char* arg2=\"a,b,c(d,e)\", bool arg3)",
|
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)",
|
"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);
|
VimStateMachine.Mode.VISUAL, VimStateMachine.SubMode.VISUAL_CHARACTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testArgumentsInsideAngleBrackets() {
|
public void testArgumentsInsideAngleBrackets() {
|
||||||
setArgTextObjPairsVariable("(:),<:>");
|
setArgTextObjPairsVariable("(:),<:>");
|
||||||
doTest(Lists.newArrayList("dia"), "std::vector<int, std::unique_p<caret>tr<bool>> v{};",
|
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);
|
"std::vector<int, <caret>> v{};", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testWhenUnbalancedHigherPriorityPairIsUsed() {
|
public void testWhenUnbalancedHigherPriorityPairIsUsed() {
|
||||||
setArgTextObjPairsVariable("{:},(:)");
|
setArgTextObjPairsVariable("{:},(:)");
|
||||||
doTest(Lists.newArrayList("dia"), "namespace foo { void foo(int arg1, bool arg2<caret> { body }\n}",
|
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);
|
"namespace foo { <caret>, bool arg2 { body }\n}", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testBracketPriorityToHangleShiftOperators() {
|
public void testBracketPriorityToHangleShiftOperators() {
|
||||||
doTest(Lists.newArrayList("dia"), "foo(30 << 10, 20 << <caret>3) >> 17", "foo(30 << 10, <caret>) >> 17",
|
doTest(Lists.newArrayList("dia"), "foo(30 << 10, 20 << <caret>3) >> 17", "foo(30 << 10, <caret>) >> 17",
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
@@ -127,7 +117,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testEmptyFile() {
|
public void testEmptyFile() {
|
||||||
assertPluginError(false);
|
assertPluginError(false);
|
||||||
doTest(Lists.newArrayList("daa"), "<caret>", "<caret>", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
doTest(Lists.newArrayList("daa"), "<caret>", "<caret>", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
@@ -136,7 +125,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
assertPluginError(true);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testEmptyLine() {
|
public void testEmptyLine() {
|
||||||
assertPluginError(false);
|
assertPluginError(false);
|
||||||
doTest(Lists.newArrayList("daa"), "<caret>\n", "<caret>\n", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
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);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testEmptyArg() {
|
public void testEmptyArg() {
|
||||||
assertPluginError(false);
|
assertPluginError(false);
|
||||||
doTest(Lists.newArrayList("daa"), "foo(<caret>)", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
|
doTest(Lists.newArrayList("daa"), "foo(<caret>)", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
|
||||||
@@ -156,7 +143,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
assertPluginError(true);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testSkipCommasInsideNestedPairs() {
|
public void testSkipCommasInsideNestedPairs() {
|
||||||
final String before =
|
final String before =
|
||||||
"void foo(int arg1)\n{" + " methodCall(arg1, \"{ arg1 , 2\");\n" + " otherMeth<caret>odcall(arg, 3);\n" + "}";
|
"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);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testHandleNestedPairs() {
|
public void testHandleNestedPairs() {
|
||||||
doTest(Lists.newArrayList("dia"), "foo(arg1, arr<caret>ay[someexpr(Class{arg1 << 3, arg2})] + 3)\n{",
|
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);
|
"foo(arg1, <caret>)\n{", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testHandleNestedParenthesisForASingleArgument() {
|
public void testHandleNestedParenthesisForASingleArgument() {
|
||||||
doTest(Lists.newArrayList("dia"), "foo((20*<caret>30))", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
|
doTest(Lists.newArrayList("dia"), "foo((20*<caret>30))", "foo(<caret>)", VimStateMachine.Mode.COMMAND,
|
||||||
VimStateMachine.SubMode.NONE);
|
VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testHandleImbalancedPairs() {
|
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",
|
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);
|
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
@@ -192,14 +175,12 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
assertPluginError(true);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testArgumentBoundsSearchIsLimitedByLineCount() {
|
public void testArgumentBoundsSearchIsLimitedByLineCount() {
|
||||||
final String before = "foo(\n" + String.join("", Collections.nCopies(10, " arg,\n")) + " last<caret>Arg" + ")";
|
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);
|
doTest(Lists.newArrayList("dia"), before, before, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
assertPluginError(true);
|
assertPluginError(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testExtendVisualSelection() {
|
public void testExtendVisualSelection() {
|
||||||
doTest(Lists.newArrayList("vllia"), "function(int arg1, ch<caret>ar* arg2=\"a,b,c(d,e)\")",
|
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,
|
"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);
|
VimStateMachine.SubMode.VISUAL_CHARACTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testExtendVisualSelectionUsesCaretPos() {
|
public void testExtendVisualSelectionUsesCaretPos() {
|
||||||
doTest(Lists.newArrayList("vllia"), "fu<caret>n(arg)", "fun(<selection>arg</selection>)", VimStateMachine.Mode.VISUAL,
|
doTest(Lists.newArrayList("vllia"), "fu<caret>n(arg)", "fun(<selection>arg</selection>)", VimStateMachine.Mode.VISUAL,
|
||||||
VimStateMachine.SubMode.VISUAL_CHARACTER);
|
VimStateMachine.SubMode.VISUAL_CHARACTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testDeleteArrayArgument() {
|
public void testDeleteArrayArgument() {
|
||||||
setArgTextObjPairsVariable("[:],(:)");
|
setArgTextObjPairsVariable("[:],(:)");
|
||||||
doTest(Lists.newArrayList("dia"), "function(int a, String[<caret>] b)", "function(int a, <caret>)",
|
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);
|
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testDeleteInClass() {
|
public void testDeleteInClass() {
|
||||||
doTest(Lists.newArrayList("dia"), "class MyClass{ public int myFun() { some<caret>Call(); } }",
|
doTest(Lists.newArrayList("dia"), "class MyClass{ public int myFun() { some<caret>Call(); } }",
|
||||||
"class MyClass{ public int myFun() { some<caret>Call(); } }", VimStateMachine.Mode.COMMAND,
|
"class MyClass{ public int myFun() { some<caret>Call(); } }", VimStateMachine.Mode.COMMAND,
|
||||||
@@ -234,7 +212,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
VimStateMachine.SubMode.NONE);
|
VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testFunctionWithSpaceAfterName() {
|
public void testFunctionWithSpaceAfterName() {
|
||||||
doTest(Lists.newArrayList("dia"), "function (int <caret>a)", "function (int <caret>a)", VimStateMachine.Mode.COMMAND,
|
doTest(Lists.newArrayList("dia"), "function (int <caret>a)", "function (int <caret>a)", VimStateMachine.Mode.COMMAND,
|
||||||
VimStateMachine.SubMode.NONE);
|
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")
|
@VimBehaviorDiffers(originalVimAfter = "function (int <caret>a, int b)", description = "Should work the same as testFunctionWithSpaceAfterName")
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testFunctionWithSpaceAfterNameWithTwoArgs() {
|
public void testFunctionWithSpaceAfterNameWithTwoArgs() {
|
||||||
doTest(Lists.newArrayList("dia"), "function (int <caret>a, int b)", "function (, int b)", VimStateMachine.Mode.COMMAND,
|
doTest(Lists.newArrayList("dia"), "function (int <caret>a, int b)", "function (, int b)", VimStateMachine.Mode.COMMAND,
|
||||||
VimStateMachine.SubMode.NONE);
|
VimStateMachine.SubMode.NONE);
|
||||||
@@ -251,7 +227,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
VimStateMachine.SubMode.NONE);
|
VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testDeleteInIf() {
|
public void testDeleteInIf() {
|
||||||
doTest(Lists.newArrayList("dia"), "class MyClass{ public int myFun() { if (tr<caret>ue) { somFunction(); } } }",
|
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,
|
"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);
|
VimStateMachine.SubMode.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testParseVariablePairs() {
|
public void testParseVariablePairs() {
|
||||||
assertPluginError(false);
|
assertPluginError(false);
|
||||||
setArgTextObjPairsVariable("[:], (:)");
|
setArgTextObjPairsVariable("[:], (:)");
|
||||||
@@ -306,7 +280,6 @@ public class VimArgTextObjExtensionTest extends VimTestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
public void testCppLambaArguments() {
|
public void testCppLambaArguments() {
|
||||||
setArgTextObjPairsVariable("[:],(:),{:},<:>");
|
setArgTextObjPairsVariable("[:],(:),{:},<:>");
|
||||||
doTest(Lists.newArrayList("daa"),
|
doTest(Lists.newArrayList("daa"),
|
||||||
|
@@ -22,21 +22,17 @@ import com.intellij.ide.highlighter.HtmlFileType
|
|||||||
import com.intellij.ide.highlighter.JavaFileType
|
import com.intellij.ide.highlighter.JavaFileType
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
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.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.yaml.YAMLFileType
|
import org.jetbrains.yaml.YAMLFileType
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
class CommentaryExtensionTest : VimTestCase() {
|
class CommentaryExtensionTest : VimTestCase() {
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
enableExtensions("commentary")
|
enableExtensions("commentary")
|
||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |l| + move caret
|
// |gc| |l| + move caret
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testBlockCommentSingle() {
|
fun testBlockCommentSingle() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcll",
|
"gcll",
|
||||||
@@ -48,7 +44,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |iw|
|
// |gc| |iw|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testBlockCommentInnerWord() {
|
fun testBlockCommentInnerWord() {
|
||||||
doTest(
|
doTest(
|
||||||
"gciw",
|
"gciw",
|
||||||
@@ -60,7 +55,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |iw|
|
// |gc| |iw|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testBlockCommentTillForward() {
|
fun testBlockCommentTillForward() {
|
||||||
doTest(
|
doTest(
|
||||||
"gct{",
|
"gct{",
|
||||||
@@ -71,7 +65,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |ab|
|
// |gc| |ab|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testBlockCommentOuterParens() {
|
fun testBlockCommentOuterParens() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcab",
|
"gcab",
|
||||||
@@ -86,7 +79,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
* otherwise, they are incredibly difficult to undo
|
* otherwise, they are incredibly difficult to undo
|
||||||
*/
|
*/
|
||||||
// |gc| |j|
|
// |gc| |j|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentDown() {
|
fun testLineCommentDown() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcj",
|
"gcj",
|
||||||
@@ -97,7 +89,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentDownPreservesAbsoluteCaretLocation() {
|
fun testLineCommentDownPreservesAbsoluteCaretLocation() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcj",
|
"gcj",
|
||||||
@@ -109,7 +100,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |ip|
|
// |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentInnerParagraph() {
|
fun testLineCommentInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcip",
|
"gcip",
|
||||||
@@ -121,7 +111,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |ip|
|
// |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentSingleLineInnerParagraph() {
|
fun testLineCommentSingleLineInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcip",
|
"gcip",
|
||||||
@@ -132,7 +121,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure uncommenting works as well */ // |gc| |ip|
|
/* Ensure uncommenting works as well */ // |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineUncommentInnerParagraph() {
|
fun testLineUncommentInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcip",
|
"gcip",
|
||||||
@@ -145,7 +133,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |ip|
|
// |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineUncommentSingleLineInnerParagraph() {
|
fun testLineUncommentSingleLineInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcip",
|
"gcip",
|
||||||
@@ -156,7 +143,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Visual mode */ // |gc| |ip|
|
/* Visual mode */ // |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentVisualInnerParagraph() {
|
fun testLineCommentVisualInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"vipgc",
|
"vipgc",
|
||||||
@@ -168,7 +154,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gc| |ip|
|
// |gc| |ip|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineUncommentVisualInnerParagraph() {
|
fun testLineUncommentVisualInnerParagraph() {
|
||||||
doTest(
|
doTest(
|
||||||
"vipgc",
|
"vipgc",
|
||||||
@@ -180,7 +165,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Special shortcut gcc is always linewise */ // |gcc|
|
/* Special shortcut gcc is always linewise */ // |gcc|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentShortcut() {
|
fun testLineCommentShortcut() {
|
||||||
doTest(
|
doTest(
|
||||||
"gccj",
|
"gccj",
|
||||||
@@ -193,7 +177,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gcc|
|
// |gcc|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineCommentShortcutSetsCaretToMotionLocation() {
|
fun testLineCommentShortcutSetsCaretToMotionLocation() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcc",
|
"gcc",
|
||||||
@@ -205,7 +188,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gcc|
|
// |gcc|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testLineUncommentShortcut() {
|
fun testLineUncommentShortcut() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcc",
|
"gcc",
|
||||||
@@ -218,7 +200,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |gcc|
|
// |gcc|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun testHTMLCommentShortcut() {
|
fun testHTMLCommentShortcut() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcc",
|
"gcc",
|
||||||
@@ -231,7 +212,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
assertSelection(null)
|
assertSelection(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test comment motion repeat`() {
|
fun `test comment motion repeat`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcj" + "jj.",
|
"gcj" + "jj.",
|
||||||
@@ -251,7 +231,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test comment motion right repeat`() {
|
fun `test comment motion right repeat`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gciw" + "jj.",
|
"gciw" + "jj.",
|
||||||
@@ -271,7 +250,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test comment line repeat`() {
|
fun `test comment line repeat`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcc" + "j.",
|
"gcc" + "j.",
|
||||||
@@ -288,7 +266,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
|
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test uncomment with gcgc`() {
|
fun `test uncomment with gcgc`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcgc",
|
"gcgc",
|
||||||
@@ -309,7 +286,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
|
@VimBehaviorDiffers(description = "IntelliJ's uncomment leaves the leading whitespace")
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test uncomment with gcu`() {
|
fun `test uncomment with gcu`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcu",
|
"gcu",
|
||||||
@@ -329,7 +305,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test comment line with count`() {
|
fun `test comment line with count`() {
|
||||||
// Caret position is kept as the position *before* the commenting. This is how Vim works
|
// Caret position is kept as the position *before* the commenting. This is how Vim works
|
||||||
doTest(
|
doTest(
|
||||||
@@ -354,7 +329,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment`() {
|
fun `test text object deletes single line comment`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -369,7 +343,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes multiple line comments`() {
|
fun `test text object deletes multiple line comments`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -388,7 +361,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes multiple line comments 2`() {
|
fun `test text object deletes multiple line comments 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -407,7 +379,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from leading whitespace`() {
|
fun `test text object deletes single line comment from leading whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -422,7 +393,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from leading whitespace 2`() {
|
fun `test text object deletes single line comment from leading whitespace 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -439,7 +409,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from leading whitespace 3`() {
|
fun `test text object deletes single line comment from leading whitespace 3`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -458,7 +427,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from trailing whitespace`() {
|
fun `test text object deletes single line comment from trailing whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -476,7 +444,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comments separated by whitespace`() {
|
fun `test text object deletes single line comments separated by whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -493,7 +460,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes disjointed single line comments from whitespace`() {
|
fun `test text object deletes disjointed single line comments from whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -515,7 +481,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
final Int value = 42;
|
final Int value = 42;
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from current line`() {
|
fun `test text object deletes single line comment from current line`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -531,7 +496,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes single line comment from current line 2`() {
|
fun `test text object deletes single line comment from current line 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -548,7 +512,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object does not delete line with comment and text`() {
|
fun `test text object does not delete line with comment and text`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -562,7 +525,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes block comment`() {
|
fun `test text object deletes block comment`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -577,7 +539,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes multi-line block comment`() {
|
fun `test text object deletes multi-line block comment`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -594,7 +555,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes adjoining multi-line block comments`() {
|
fun `test text object deletes adjoining multi-line block comments`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -614,7 +574,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes adjoining multi-line block comments 2`() {
|
fun `test text object deletes adjoining multi-line block comments 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -635,7 +594,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object does not delete line with text and block comment`() {
|
fun `test text object does not delete line with text and block comment`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -649,7 +607,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes JavaDoc comment`() {
|
fun `test text object deletes JavaDoc comment`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -670,7 +627,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes JavaDoc comment from leading whitespace`() {
|
fun `test text object deletes JavaDoc comment from leading whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -692,7 +648,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes JavaDoc comment and adjoining comments`() {
|
fun `test text object deletes JavaDoc comment and adjoining comments`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -714,7 +669,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test text object deletes JavaDoc comment and adjoining comments separated by whitespace`() {
|
fun `test text object deletes JavaDoc comment and adjoining comments separated by whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dgc",
|
"dgc",
|
||||||
@@ -739,7 +693,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test Commentary command comments current line`() {
|
fun `test Commentary command comments current line`() {
|
||||||
doTest(
|
doTest(
|
||||||
":Commentary<CR>",
|
":Commentary<CR>",
|
||||||
@@ -757,7 +710,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test Commentary command comments simple line range`() {
|
fun `test Commentary command comments simple line range`() {
|
||||||
doTest(
|
doTest(
|
||||||
":2Commentary<CR>",
|
":2Commentary<CR>",
|
||||||
@@ -775,7 +727,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test Commentary command comments line range`() {
|
fun `test Commentary command comments line range`() {
|
||||||
doTest(
|
doTest(
|
||||||
":1,3Commentary<CR>",
|
":1,3Commentary<CR>",
|
||||||
@@ -804,7 +755,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
"Note that Escape exits Visual mode, but leaves the caret where it is",
|
"Note that Escape exits Visual mode, but leaves the caret where it is",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test Commentary command comments visual range`() {
|
fun `test Commentary command comments visual range`() {
|
||||||
doTest(
|
doTest(
|
||||||
"Vjj" + ":Commentary<CR>",
|
"Vjj" + ":Commentary<CR>",
|
||||||
@@ -822,7 +772,6 @@ class CommentaryExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test Commentary command comments search range`() {
|
fun `test Commentary command comments search range`() {
|
||||||
doTest(
|
doTest(
|
||||||
":g/value2/Commentary<CR>",
|
":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`() {
|
fun `test block comment falls back to line comment when not available`() {
|
||||||
doTest(
|
doTest(
|
||||||
"gcw",
|
"gcw",
|
||||||
|
@@ -23,8 +23,6 @@ import com.maddyhome.idea.vim.api.injector
|
|||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
|
import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
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.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class VimExchangeExtensionTest : VimTestCase() {
|
class VimExchangeExtensionTest : VimTestCase() {
|
||||||
@@ -35,7 +33,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words left to right`() {
|
fun `test exchange words left to right`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "w", "cxe"),
|
listOf("cxe", "w", "cxe"),
|
||||||
@@ -47,7 +44,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words dot repeat`() {
|
fun `test exchange words dot repeat`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxiw", "w", "."),
|
listOf("cxiw", "w", "."),
|
||||||
@@ -59,7 +55,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words right to left`() {
|
fun `test exchange words right to left`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "b", "cxe"),
|
listOf("cxe", "b", "cxe"),
|
||||||
@@ -71,7 +66,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words right to left with dot`() {
|
fun `test exchange words right to left with dot`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "b", "."),
|
listOf("cxe", "b", "."),
|
||||||
@@ -83,7 +77,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// |X|
|
// |X|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words left to right`() {
|
fun `test visual exchange words left to right`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("veX", "w", "veX"),
|
listOf("veX", "w", "veX"),
|
||||||
@@ -99,7 +92,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
originalVimAfter = "The ${c}brown catch over the lazy dog",
|
originalVimAfter = "The ${c}brown catch over the lazy dog",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words from inside`() {
|
fun `test visual exchange words from inside`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("veX", "b", "v3e", "X"),
|
listOf("veX", "b", "v3e", "X"),
|
||||||
@@ -115,7 +107,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
originalVimAfter = "The brown ${c}catch over the lazy dog",
|
originalVimAfter = "The brown ${c}catch over the lazy dog",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words from outside`() {
|
fun `test visual exchange words from outside`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("v3e", "X", "w", "veX"),
|
listOf("v3e", "X", "w", "veX"),
|
||||||
@@ -136,7 +127,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange lines top down`() {
|
fun `test exchange lines top down`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxx", "j", "cxx"),
|
listOf("cxx", "j", "cxx"),
|
||||||
@@ -165,7 +155,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange lines top down with dot`() {
|
fun `test exchange lines top down with dot`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxx", "j", "."),
|
listOf("cxx", "j", "."),
|
||||||
@@ -192,7 +181,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
lazy dog
|
lazy dog
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange to the line end`() {
|
fun `test exchange to the line end`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("v$", "X", "jj^ve", "X"),
|
listOf("v$", "X", "jj^ve", "X"),
|
||||||
@@ -221,7 +209,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange visual lines`() {
|
fun `test exchange visual lines`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("Vj", "X", "jj", "Vj", "X"),
|
listOf("Vj", "X", "jj", "Vj", "X"),
|
||||||
@@ -243,7 +230,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual char highlighter`() {
|
fun `test visual char highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -260,7 +246,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual line highdhitligthhter`() {
|
fun `test visual line highdhitligthhter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -277,7 +262,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test till the line end highlighter`() {
|
fun `test till the line end highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -292,7 +276,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test pre line end highlighter`() {
|
fun `test pre line end highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -307,7 +290,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test pre pre line end highlighter`() {
|
fun `test pre pre line end highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -322,7 +304,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test to file end highlighter`() {
|
fun `test to file end highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The quick
|
The quick
|
||||||
@@ -344,7 +325,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test to file end with new line highlighter`() {
|
fun `test to file end with new line highlighter`() {
|
||||||
val before = """
|
val before = """
|
||||||
The quick
|
The quick
|
||||||
@@ -367,7 +347,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test back selection`() {
|
fun `test back selection`() {
|
||||||
val before = """
|
val before = """
|
||||||
The quick
|
The quick
|
||||||
@@ -383,7 +362,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test back selection exchange 1`() {
|
fun `test back selection exchange 1`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("vb", "X", "bevb", "X"),
|
listOf("vb", "X", "bevb", "X"),
|
||||||
@@ -394,7 +372,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test back selection exchange 2`() {
|
fun `test back selection exchange 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("vb", "X", "wve", "X"),
|
listOf("vb", "X", "wve", "X"),
|
||||||
@@ -405,7 +382,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test back selection exchange 3`() {
|
fun `test back selection exchange 3`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("ve", "X", "wevb", "X"),
|
listOf("ve", "X", "wevb", "X"),
|
||||||
@@ -416,7 +392,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test change with down motion`() {
|
fun `test change with down motion`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
@@ -436,7 +411,6 @@ class VimExchangeExtensionTest : VimTestCase() {
|
|||||||
exitExchange()
|
exitExchange()
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test cxx`() {
|
fun `test cxx`() {
|
||||||
val before = """
|
val before = """
|
||||||
The ${c}quick
|
The ${c}quick
|
||||||
|
@@ -25,8 +25,6 @@ import com.maddyhome.idea.vim.extension.exchange.VimExchangeExtension
|
|||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.options.OptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.OptionValueType
|
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.VimOptionTestCase
|
||||||
import org.jetbrains.plugins.ideavim.VimOptionTestConfiguration
|
import org.jetbrains.plugins.ideavim.VimOptionTestConfiguration
|
||||||
import org.jetbrains.plugins.ideavim.VimTestOption
|
import org.jetbrains.plugins.ideavim.VimTestOption
|
||||||
@@ -40,7 +38,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words left to right`() {
|
fun `test exchange words left to right`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "w", "cxe"),
|
listOf("cxe", "w", "cxe"),
|
||||||
@@ -53,7 +50,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words dot repeat`() {
|
fun `test exchange words dot repeat`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxiw", "w", "."),
|
listOf("cxiw", "w", "."),
|
||||||
@@ -66,7 +62,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words right to left`() {
|
fun `test exchange words right to left`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "b", "cxe"),
|
listOf("cxe", "b", "cxe"),
|
||||||
@@ -79,7 +74,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
|
|
||||||
// |cx|
|
// |cx|
|
||||||
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange words right to left with dot`() {
|
fun `test exchange words right to left with dot`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxe", "b", "."),
|
listOf("cxe", "b", "."),
|
||||||
@@ -92,7 +86,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
|
|
||||||
// |X|
|
// |X|
|
||||||
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
@VimOptionTestConfiguration(VimTestOption(OptionConstants.clipboardName, OptionValueType.STRING, "unnamed"))
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words left to right`() {
|
fun `test visual exchange words left to right`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("veX", "w", "veX"),
|
listOf("veX", "w", "veX"),
|
||||||
@@ -109,7 +102,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
originalVimAfter = "The ${c}brown catch over the lazy dog",
|
originalVimAfter = "The ${c}brown catch over the lazy dog",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words from inside`() {
|
fun `test visual exchange words from inside`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("veX", "b", "v3e", "X"),
|
listOf("veX", "b", "v3e", "X"),
|
||||||
@@ -126,7 +118,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
originalVimAfter = "The brown ${c}catch over the lazy dog",
|
originalVimAfter = "The brown ${c}catch over the lazy dog",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test visual exchange words from outside`() {
|
fun `test visual exchange words from outside`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("v3e", "X", "w", "veX"),
|
listOf("v3e", "X", "w", "veX"),
|
||||||
@@ -148,7 +139,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange lines top down`() {
|
fun `test exchange lines top down`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxx", "j", "cxx"),
|
listOf("cxx", "j", "cxx"),
|
||||||
@@ -178,7 +168,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange lines top down with dot`() {
|
fun `test exchange lines top down with dot`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("cxx", "j", "."),
|
listOf("cxx", "j", "."),
|
||||||
@@ -206,7 +195,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
lazy dog
|
lazy dog
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange to the line end`() {
|
fun `test exchange to the line end`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("v$", "X", "jj^ve", "X"),
|
listOf("v$", "X", "jj^ve", "X"),
|
||||||
@@ -236,7 +224,6 @@ class VimExchangeWithClipboardTest : VimOptionTestCase(OptionConstants.clipboard
|
|||||||
""",
|
""",
|
||||||
shouldBeFixed = true
|
shouldBeFixed = true
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test exchange visual lines`() {
|
fun `test exchange visual lines`() {
|
||||||
doTest(
|
doTest(
|
||||||
listOf("Vj", "X", "jj", "Vj", "X"),
|
listOf("Vj", "X", "jj", "Vj", "X"),
|
||||||
|
@@ -23,8 +23,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.extension.highlightedyank.DEFAULT_HIGHLIGHT_DURATION
|
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.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.assertHappened
|
import org.jetbrains.plugins.ideavim.assertHappened
|
||||||
|
|
||||||
@@ -34,7 +32,6 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
enableExtensions("highlightedyank")
|
enableExtensions("highlightedyank")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test highlighting whole line when whole line is yanked`() {
|
fun `test highlighting whole line when whole line is yanked`() {
|
||||||
doTest("yy", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest("yy", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
||||||
|
|
||||||
@@ -42,7 +39,6 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
assertHighlighterRange(1, 40, getFirstHighlighter())
|
assertHighlighterRange(1, 40, getFirstHighlighter())
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test highlighting single word when single word is yanked`() {
|
fun `test highlighting single word when single word is yanked`() {
|
||||||
doTest("yiw", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest("yiw", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
||||||
|
|
||||||
@@ -58,7 +54,6 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
assertHighlighterRange(40, 59, getFirstHighlighter())
|
assertHighlighterRange(40, 59, getFirstHighlighter())
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test removing previous highlight when entering insert mode`() {
|
fun `test removing previous highlight when entering insert mode`() {
|
||||||
doTest("yyi", code, code, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
|
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`() {
|
fun `test highlighting with multiple cursors`() {
|
||||||
doTest("yiw", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
doTest("yiw", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
||||||
|
|
||||||
@@ -121,14 +115,12 @@ class VimHighlightedYankTest : VimTestCase() {
|
|||||||
assertHighlighterRange(28, 31, highlighters[2])
|
assertHighlighterRange(28, 31, highlighters[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test clearing all highlighters with multiple cursors`() {
|
fun `test clearing all highlighters with multiple cursors`() {
|
||||||
doTest("yiwi", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
|
doTest("yiwi", codeWithMultipleCurors, codeWithMultipleCurors, VimStateMachine.Mode.INSERT, VimStateMachine.SubMode.NONE)
|
||||||
|
|
||||||
assertAllHighlightersCount(0)
|
assertAllHighlightersCount(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test highlighting for a correct default amount of time`() {
|
fun `test highlighting for a correct default amount of time`() {
|
||||||
doTest("yiw", code, code, VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE)
|
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`() {
|
fun `test highlighting for a correct user provided amount of time`() {
|
||||||
configureByJavaText(code)
|
configureByJavaText(code)
|
||||||
typeText(injector.parser.parseKeys(":let g:highlightedyank_highlight_duration = \"1000\"<CR>"))
|
typeText(injector.parser.parseKeys(":let g:highlightedyank_highlight_duration = \"1000\"<CR>"))
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.extension.matchit
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class MatchitCMakeTest : VimTestCase() {
|
class MatchitCMakeTest : VimTestCase() {
|
||||||
@@ -30,7 +27,6 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
enableExtensions("matchit")
|
enableExtensions("matchit")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from if to else`() {
|
fun `test jump from if to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -48,11 +44,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from else to endif`() {
|
fun `test jump from else to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -70,11 +65,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
${c}endif()
|
${c}endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endif to if`() {
|
fun `test jump from endif to if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -92,11 +86,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from if to elseif in if-else structure`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -122,11 +115,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from elseif to elseif`() {
|
fun `test jump from elseif to elseif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -152,11 +144,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from elseif to else`() {
|
fun `test jump from elseif to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -182,11 +173,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from else to endif in if-else structure`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -212,11 +202,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
${c}endif()
|
${c}endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from endif to if in if-else structure`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -242,11 +231,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from foreach to endforeach`() {
|
fun `test jump from foreach to endforeach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -260,11 +248,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
${c}endforeach()
|
${c}endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endforeach to foreach`() {
|
fun `test jump from endforeach to foreach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -278,11 +265,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
endforeach()
|
endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from foreach to break`() {
|
fun `test jump from foreach to break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -302,11 +288,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
endforeach()
|
endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from break to endforeach`() {
|
fun `test jump from break to endforeach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -326,11 +311,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
${c}endforeach()
|
${c}endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from while to endwhile`() {
|
fun `test jump from while to endwhile`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -344,11 +328,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
MATH(EXPR VAR "${"\${index}"}+1")
|
MATH(EXPR VAR "${"\${index}"}+1")
|
||||||
${c}endwhile()
|
${c}endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endwhile to while`() {
|
fun `test jump from endwhile to while`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -362,11 +345,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
MATH(EXPR VAR "${"\${index}"}+1")
|
MATH(EXPR VAR "${"\${index}"}+1")
|
||||||
endwhile()
|
endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from while to break`() {
|
fun `test jump from while to break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -386,11 +368,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from break to endwhile`() {
|
fun `test jump from break to endwhile`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -410,11 +391,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
endif()
|
endif()
|
||||||
${c}endwhile()
|
${c}endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from function to endfunction`() {
|
fun `test jump from function to endfunction`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -428,11 +408,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
bar(x y z)
|
bar(x y z)
|
||||||
${c}endfunction()
|
${c}endfunction()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endfunction to function`() {
|
fun `test jump from endfunction to function`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -446,11 +425,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
bar(x y z)
|
bar(x y z)
|
||||||
endfunction()
|
endfunction()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from macro to endmacro`() {
|
fun `test jump from macro to endmacro`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -464,11 +442,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("arg = ${"\${arg}\""}")
|
message("arg = ${"\${arg}\""}")
|
||||||
${c}endmacro()
|
${c}endmacro()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endmacro to macro`() {
|
fun `test jump from endmacro to macro`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -482,13 +459,12 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("arg = ${"\${arg}\""}")
|
message("arg = ${"\${arg}\""}")
|
||||||
endmacro()
|
endmacro()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests for reverse motion
|
// Tests for reverse motion
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from if to endif`() {
|
fun `test reverse jump from if to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -506,11 +482,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
${c}endif()
|
${c}endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from else to if`() {
|
fun `test reverse jump from else to if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -528,11 +503,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endif to else`() {
|
fun `test reverse jump from endif to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -550,11 +524,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Non-linux system")
|
message("Non-linux system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from if to endif in if-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -580,11 +553,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
${c}endif()
|
${c}endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from elseif to if`() {
|
fun `test reverse jump from elseif to if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -610,11 +582,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from elseif in else block to elseif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -640,11 +611,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from else to elseif`() {
|
fun `test reverse jump from else to elseif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -670,11 +640,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from endif to else in if-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -700,11 +669,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("Unknown system")
|
message("Unknown system")
|
||||||
endif()
|
endif()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from foreach to endforeach`() {
|
fun `test reverse jump from foreach to endforeach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -718,11 +686,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
${c}endforeach()
|
${c}endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endforeach to foreach`() {
|
fun `test reverse jump from endforeach to foreach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -736,11 +703,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
endforeach()
|
endforeach()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from foreach to endforeach over a break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -760,11 +726,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
${c}endforeach()
|
${c}endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endforeach to break`() {
|
fun `test reverse jump from endforeach to break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -784,11 +749,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
endforeach()
|
endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from break to foreach`() {
|
fun `test reverse jump from break to foreach`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -808,11 +772,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message(STATUS "X=${"\${X}"}")
|
message(STATUS "X=${"\${X}"}")
|
||||||
endforeach()
|
endforeach()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from while to endwhile`() {
|
fun `test reverse jump from while to endwhile`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -826,11 +789,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
MATH(EXPR VAR "${"\${index}"}+1")
|
MATH(EXPR VAR "${"\${index}"}+1")
|
||||||
${c}endwhile()
|
${c}endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endwhile to while`() {
|
fun `test reverse jump from endwhile to while`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -844,11 +806,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
MATH(EXPR VAR "${"\${index}"}+1")
|
MATH(EXPR VAR "${"\${index}"}+1")
|
||||||
endwhile()
|
endwhile()
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from while to endwhile over a break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -868,11 +829,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
endif()
|
endif()
|
||||||
${c}endwhile()
|
${c}endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endwhile to break`() {
|
fun `test reverse jump from endwhile to break`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -892,11 +852,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from break to while`() {
|
fun `test reverse jump from break to while`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -916,11 +875,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
endif()
|
endif()
|
||||||
endwhile()
|
endwhile()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from function to endfunction`() {
|
fun `test reverse jump from function to endfunction`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -934,11 +892,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
bar(x y z)
|
bar(x y z)
|
||||||
${c}endfunction()
|
${c}endfunction()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endfunction to function`() {
|
fun `test reverse jump from endfunction to function`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -952,11 +909,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
bar(x y z)
|
bar(x y z)
|
||||||
endfunction()
|
endfunction()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from macro to endmacro`() {
|
fun `test reverse jump from macro to endmacro`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -970,11 +926,10 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("arg = ${"\${arg}\""}")
|
message("arg = ${"\${arg}\""}")
|
||||||
${c}endmacro()
|
${c}endmacro()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endmacro to macro`() {
|
fun `test reverse jump from endmacro to macro`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -988,7 +943,7 @@ class MatchitCMakeTest : VimTestCase() {
|
|||||||
message("arg = ${"\${arg}\""}")
|
message("arg = ${"\${arg}\""}")
|
||||||
endmacro()
|
endmacro()
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "CMakeLists.txt"
|
fileName = "CMakeLists.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.extension.matchit
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class MatchitCTest : VimTestCase() {
|
class MatchitCTest : VimTestCase() {
|
||||||
@@ -30,7 +27,6 @@ class MatchitCTest : VimTestCase() {
|
|||||||
enableExtensions("matchit")
|
enableExtensions("matchit")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #if to #endif`() {
|
fun `test jump from #if to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -42,11 +38,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#if !defined (VAL_1)
|
#if !defined (VAL_1)
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from whitespace before #if to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -58,11 +53,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#if !defined (VAL_1)
|
#if !defined (VAL_1)
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #if to #elif`() {
|
fun `test jump from #if to #elif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -78,11 +72,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#elif !defined (VAL_2)
|
$c#elif !defined (VAL_2)
|
||||||
#define VAL_2 2
|
#define VAL_2 2
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #if to #else`() {
|
fun `test jump from #if to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -98,11 +91,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#else
|
$c#else
|
||||||
#define VAL_2 2
|
#define VAL_2 2
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #elif to #else`() {
|
fun `test jump from #elif to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -114,11 +106,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#elif !defined (VAL_2)
|
#elif !defined (VAL_2)
|
||||||
$c#else
|
$c#else
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from whitespace before #elif to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -130,11 +121,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#elif !defined (VAL_2)
|
#elif !defined (VAL_2)
|
||||||
$c#else
|
$c#else
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #else to #endif`() {
|
fun `test jump from #else to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -146,11 +136,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#else
|
#else
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from whitespace before #else to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -162,11 +151,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#else !defined (VAL_2)
|
#else !defined (VAL_2)
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #endif to #if`() {
|
fun `test jump from #endif to #if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -188,11 +176,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#define VAL_3 3
|
#define VAL_3 3
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifdef to #endif`() {
|
fun `test jump from #ifdef to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -204,11 +191,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifdef to #elif`() {
|
fun `test jump from #ifdef to #elif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -220,11 +206,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
$c#elif PROD
|
$c#elif PROD
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifdef to #else`() {
|
fun `test jump from #ifdef to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -236,11 +221,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
$c#else
|
$c#else
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #endif to #ifdef`() {
|
fun `test jump from #endif to #ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -252,11 +236,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifdef DEBUG
|
$c#ifdef DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifndef to #endif`() {
|
fun `test jump from #ifndef to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -268,11 +251,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifndef to #elif`() {
|
fun `test jump from #ifndef to #elif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -284,11 +266,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
$c#elif PROD
|
$c#elif PROD
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #ifndef to #else`() {
|
fun `test jump from #ifndef to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -300,11 +281,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
$c#else
|
$c#else
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from #endif to #ifndef`() {
|
fun `test jump from #endif to #ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -316,11 +296,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifndef DEBUG
|
$c#ifndef DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test don't jump from malformed #if`() {
|
fun `test don't jump from malformed #if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -332,11 +311,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifff DEBUG
|
$c#ifff DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from #if with whitespace to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -348,11 +326,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
# if DEBUG
|
# if DEBUG
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from nested #if to #endif`() {
|
fun `test jump from nested #if to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -368,7 +345,7 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c# endif
|
$c# endif
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +353,6 @@ class MatchitCTest : VimTestCase() {
|
|||||||
* Tests for reverse g% motion
|
* Tests for reverse g% motion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #if to #endif`() {
|
fun `test reverse jump from #if to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -388,11 +364,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#if !defined (VAL_1)
|
#if !defined (VAL_1)
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from whitespace before #if to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -404,11 +379,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#if !defined (VAL_1)
|
#if !defined (VAL_1)
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from #endif to #if with whitespace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -420,11 +394,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c# if DEBUG
|
$c# if DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #endif to #else`() {
|
fun `test reverse jump from #endif to #else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -438,11 +411,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#define VAL_3 3
|
#define VAL_3 3
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #else to #elif`() {
|
fun `test reverse jump from #else to #elif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -460,11 +432,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#define VAL_3 3
|
#define VAL_3 3
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from whitespace before #else to #elif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -482,11 +453,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#define VAL_3 3
|
#define VAL_3 3
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #elif to #if`() {
|
fun `test reverse jump from #elif to #if`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -502,11 +472,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#elif !defined (VAL_2)
|
#elif !defined (VAL_2)
|
||||||
#define VAL_2 2
|
#define VAL_2 2
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #ifdef to #endif`() {
|
fun `test reverse jump from #ifdef to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -518,11 +487,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #endif to #ifdef`() {
|
fun `test reverse jump from #endif to #ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -534,11 +502,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifdef DEBUG
|
$c#ifdef DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #else to #ifdef`() {
|
fun `test reverse jump from #else to #ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -550,11 +517,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifdef DEBUG
|
$c#ifdef DEBUG
|
||||||
#else
|
#else
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #elif to #ifdef`() {
|
fun `test reverse jump from #elif to #ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -566,11 +532,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifdef DEBUG
|
$c#ifdef DEBUG
|
||||||
#elif PROD
|
#elif PROD
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #ifndef to #endif`() {
|
fun `test reverse jump from #ifndef to #endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -582,11 +547,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
$c#endif
|
$c#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #endif to #ifndef`() {
|
fun `test reverse jump from #endif to #ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -598,11 +562,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifndef DEBUG
|
$c#ifndef DEBUG
|
||||||
#endif
|
#endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #elif to #ifndef`() {
|
fun `test reverse jump from #elif to #ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -614,11 +577,10 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifndef DEBUG
|
$c#ifndef DEBUG
|
||||||
#elif PROD
|
#elif PROD
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from #else to #ifndef`() {
|
fun `test reverse jump from #else to #ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -630,7 +592,7 @@ class MatchitCTest : VimTestCase() {
|
|||||||
$c#ifndef DEBUG
|
$c#ifndef DEBUG
|
||||||
#else
|
#else
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "main.c"
|
fileName = "main.c"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.extension.matchit
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class MatchitGNUMakeTest : VimTestCase() {
|
class MatchitGNUMakeTest : VimTestCase() {
|
||||||
@@ -30,7 +27,6 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
enableExtensions("matchit")
|
enableExtensions("matchit")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from define to endef`() {
|
fun `test jump from define to endef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -46,11 +42,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
second line
|
second line
|
||||||
${c}endef
|
${c}endef
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endef to define`() {
|
fun `test jump from endef to define`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -66,11 +61,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
second line
|
second line
|
||||||
endef
|
endef
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifdef to endif`() {
|
fun `test jump from ifdef to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -84,11 +78,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info defined)
|
$(info defined)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endif to ifdef`() {
|
fun `test jump from endif to ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -102,11 +95,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info defined)
|
$(info defined)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifndef to endif`() {
|
fun `test jump from ifndef to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -120,11 +112,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not defined)
|
$(info not defined)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endif to ifndef`() {
|
fun `test jump from endif to ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -138,11 +129,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not defined)
|
$(info not defined)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifeq to endif`() {
|
fun `test jump from ifeq to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -156,11 +146,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info empty)
|
$(info empty)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endif to ifeq`() {
|
fun `test jump from endif to ifeq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -174,11 +163,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info empty)
|
$(info empty)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifneq to endif`() {
|
fun `test jump from ifneq to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -192,11 +180,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from endif to ifneq`() {
|
fun `test jump from endif to ifneq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -210,11 +197,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifneq to else`() {
|
fun `test jump from ifneq to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -228,11 +214,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from ifeq to else in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -254,11 +239,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from else ifeq to else`() {
|
fun `test jump from else ifeq to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -280,11 +264,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifeq in else block to else`() {
|
fun `test jump from ifeq in else block to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -306,11 +289,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from else to endif in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -332,11 +314,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from endif to ifeq in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -358,11 +339,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from ifneq to else in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -384,11 +364,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from else ifneq to else`() {
|
fun `test jump from else ifneq to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -410,11 +389,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from ifneq in else block to else`() {
|
fun `test jump from ifneq in else block to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -436,11 +414,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from else to endif in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -462,11 +439,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from endif to ifneq in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -488,13 +464,12 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse tests
|
// Reverse tests
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from define to endef`() {
|
fun `test reverse jump from define to endef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -510,11 +485,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
second line
|
second line
|
||||||
${c}endef
|
${c}endef
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endef to define`() {
|
fun `test reverse jump from endef to define`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -530,11 +504,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
second line
|
second line
|
||||||
endef
|
endef
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from ifdef to endif`() {
|
fun `test reverse jump from ifdef to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -548,11 +521,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info defined)
|
$(info defined)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endif to ifdef`() {
|
fun `test reverse jump from endif to ifdef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -566,11 +538,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info defined)
|
$(info defined)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from ifndef to endif`() {
|
fun `test reverse jump from ifndef to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -584,11 +555,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not defined)
|
$(info not defined)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endif to ifndef`() {
|
fun `test reverse jump from endif to ifndef`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -602,11 +572,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not defined)
|
$(info not defined)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from ifeq to endif`() {
|
fun `test reverse jump from ifeq to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -620,11 +589,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info empty)
|
$(info empty)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endif to ifeq`() {
|
fun `test reverse jump from endif to ifeq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -638,11 +606,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info empty)
|
$(info empty)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from ifneq to endif`() {
|
fun `test reverse jump from ifneq to endif`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -656,11 +623,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from endif to ifneq`() {
|
fun `test reverse jump from endif to ifneq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -674,11 +640,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from ifneq to else`() {
|
fun `test reverse jump from ifneq to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -692,11 +657,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not empty)
|
$(info not empty)
|
||||||
else
|
else
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from ifeq to endif in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -718,11 +682,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from else ifeq to ifeq`() {
|
fun `test reverse jump from else ifeq to ifeq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -744,11 +707,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from ifeq in else block to ifeq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -770,11 +732,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from else to else in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -796,11 +757,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from endif to else in ifeq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -822,11 +782,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info not x86 based)
|
$(info not x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from ifneq to endif in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -848,11 +807,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
${c}endif
|
${c}endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test reverse jump from else ifneq to ifneq`() {
|
fun `test reverse jump from else ifneq to ifneq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -874,11 +832,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from ifneq in else block to ifneq`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -900,11 +857,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from else to else in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -926,11 +882,10 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test reverse jump from endif to else in ifneq-else block`() {
|
||||||
doTest(
|
doTest(
|
||||||
"g%",
|
"g%",
|
||||||
@@ -952,7 +907,7 @@ class MatchitGNUMakeTest : VimTestCase() {
|
|||||||
$(info x86 based)
|
$(info x86 based)
|
||||||
endif
|
endif
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "Makefile"
|
fileName = "Makefile"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,8 +23,6 @@ import com.intellij.ide.highlighter.JavaFileType
|
|||||||
import com.maddyhome.idea.vim.command.VimStateMachine
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
import com.maddyhome.idea.vim.helper.VimBehaviorDiffers
|
||||||
import com.maddyhome.idea.vim.helper.experimentalApi
|
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
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
|
||||||
class MatchitGeneralTest : VimTestCase() {
|
class MatchitGeneralTest : VimTestCase() {
|
||||||
@@ -38,7 +36,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
* Tests to make sure we didn't break the default % motion
|
* Tests to make sure we didn't break the default % motion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test jump from Java comment start to end`() {
|
fun `test jump from Java comment start to end`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -52,11 +49,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
*
|
*
|
||||||
*$c/
|
*$c/
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from Java comment end to start`() {
|
||||||
doTest(
|
doTest(
|
||||||
"%",
|
"%",
|
||||||
@@ -70,11 +66,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, JavaFileType.INSTANCE
|
fileType = JavaFileType.INSTANCE
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test 25 percent jump`() {
|
fun `test 25 percent jump`() {
|
||||||
doTest(
|
doTest(
|
||||||
"25%",
|
"25%",
|
||||||
@@ -90,11 +85,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
int c;
|
int c;
|
||||||
int d;
|
int d;
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test jump from visual end of line to opening parenthesis`() {
|
||||||
doTest(
|
doTest(
|
||||||
"v$%",
|
"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`() {
|
fun `test jump from visual end of line to opening parenthesis then back to closing`() {
|
||||||
doTest(
|
doTest(
|
||||||
"v$%%",
|
"v$%%",
|
||||||
@@ -114,15 +107,13 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete everything from opening parenthesis to closing parenthesis`() {
|
fun `test delete everything from opening parenthesis to closing parenthesis`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"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`() {
|
fun `test delete everything from closing parenthesis to opening parenthesis`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -130,7 +121,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete everything from opening curly brace to closing curly brace`() {
|
fun `test delete everything from opening curly brace to closing curly brace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -138,7 +128,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete everything from closing curly brace to opening curly brace`() {
|
fun `test delete everything from closing curly brace to opening curly brace`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -146,7 +135,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete everything from opening square bracket to closing square bracket`() {
|
fun `test delete everything from opening square bracket to closing square bracket`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -154,7 +142,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete everything from closing square bracket to opening square bracket`() {
|
fun `test delete everything from closing square bracket to opening square bracket`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -165,7 +152,6 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
/*
|
/*
|
||||||
* Tests for visual mode and deleting on the new Matchit patterns.
|
* 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`() {
|
fun `test jump from visual end of line to opening angle bracket`() {
|
||||||
doTest(
|
doTest(
|
||||||
"v$%",
|
"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`() {
|
fun `test jump from visual end of line to start of for loop`() {
|
||||||
doTest(
|
doTest(
|
||||||
"v$%",
|
"v$%",
|
||||||
@@ -189,7 +174,7 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts n
|
puts n
|
||||||
en${se}d
|
en${se}d
|
||||||
""".trimIndent(),
|
""".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"
|
description = "Our code changes the motion type to linewise, but it should not"
|
||||||
)
|
)
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete from elseif to else`() {
|
fun `test delete from elseif to else`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -232,11 +216,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
end
|
end
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
},
|
},
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
|
fileName = "ruby.rb"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete from elseif to else 2`() {
|
fun `test delete from elseif to else 2`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -256,11 +239,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "Positive"
|
puts "Positive"
|
||||||
end
|
end
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test delete from else to elsif with reverse motion`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dg%",
|
"dg%",
|
||||||
@@ -280,11 +262,10 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "Positive"
|
puts "Positive"
|
||||||
end
|
end
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
|
fileName = "ruby.rb"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete from opening to closing div`() {
|
fun `test delete from opening to closing div`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -293,22 +274,22 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
<img src="fff">
|
<img src="fff">
|
||||||
</div>
|
</div>
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test delete from opening angle bracket to closing angle bracket`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
"""
|
"""
|
||||||
$c<div></div>
|
$c<div></div>
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test delete whole function from def`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -317,11 +298,11 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "hello"
|
puts "hello"
|
||||||
end
|
end
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test delete whole function from def with reverse motion`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dg%",
|
"dg%",
|
||||||
@@ -330,11 +311,11 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "hello"
|
puts "hello"
|
||||||
end
|
end
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
|
"",
|
||||||
|
fileName = "ruby.rb"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestWithoutNeovim(reason = SkipNeovimReason.PLUGIN)
|
|
||||||
fun `test delete whole function from end`() {
|
fun `test delete whole function from end`() {
|
||||||
doTest(
|
doTest(
|
||||||
"d%",
|
"d%",
|
||||||
@@ -343,11 +324,11 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "hello"
|
puts "hello"
|
||||||
en${c}d
|
en${c}d
|
||||||
""".trimIndent(),
|
""".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`() {
|
fun `test delete whole function from end with reverse motion`() {
|
||||||
doTest(
|
doTest(
|
||||||
"dg%",
|
"dg%",
|
||||||
@@ -356,7 +337,8 @@ class MatchitGeneralTest : VimTestCase() {
|
|||||||
puts "hello"
|
puts "hello"
|
||||||
en${c}d
|
en${c}d
|
||||||
""".trimIndent(),
|
""".trimIndent(),
|
||||||
"", VimStateMachine.Mode.COMMAND, VimStateMachine.SubMode.NONE, "ruby.rb"
|
"",
|
||||||
|
fileName = "ruby.rb"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user