mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-18 10:31:44 +02:00
Compare commits
485 Commits
VIM-2227
...
customized
Author | SHA1 | Date | |
---|---|---|---|
8e162bce95
|
|||
2cdd62371e
|
|||
d461f61438
|
|||
de7fe30a97
|
|||
6d80c21344
|
|||
a57a80442c
|
|||
866e6dc831
|
|||
f11bb12f19
|
|||
70ea1bd46f
|
|||
![]() |
2845beaf8a | ||
![]() |
1e58ead126 | ||
![]() |
fafa7572d0 | ||
![]() |
4ddeb72bfe | ||
![]() |
28ba36dddb | ||
![]() |
b6c501311c | ||
![]() |
01d4ebe254 | ||
![]() |
34dd332f0b | ||
![]() |
596d0c7115 | ||
![]() |
672601b028 | ||
![]() |
e5045f28ab | ||
![]() |
12ba067db3 | ||
![]() |
5413606425 | ||
![]() |
72ae18557b | ||
![]() |
99bd119ed6 | ||
![]() |
faebf66065 | ||
![]() |
dc030d6895 | ||
![]() |
7f626005a5 | ||
![]() |
28d0741e14 | ||
![]() |
c0e17a6c61 | ||
![]() |
b5046b089e | ||
![]() |
1075112bfa | ||
![]() |
37fddacf8e | ||
![]() |
2091a59897 | ||
![]() |
d2a427b38f | ||
![]() |
c069719c1c | ||
![]() |
654a443d4b | ||
![]() |
a6ec2d5ed7 | ||
![]() |
02ac083175 | ||
![]() |
561fce5d40 | ||
![]() |
a88263874a | ||
![]() |
943ddeb5ab | ||
![]() |
216a3fedd0 | ||
![]() |
7b8c335a5b | ||
![]() |
8e8efe4862 | ||
![]() |
e64dc3cc1c | ||
![]() |
c833691cf6 | ||
![]() |
ba5e2e8613 | ||
![]() |
b154e31a28 | ||
![]() |
322b888dc5 | ||
![]() |
42eefb763b | ||
![]() |
27be351636 | ||
![]() |
8b20287f93 | ||
![]() |
50a7bdb34d | ||
![]() |
dcac3be0da | ||
![]() |
ec121fb327 | ||
![]() |
ccb260b6a7 | ||
![]() |
c994511ea5 | ||
![]() |
fb5177633a | ||
![]() |
b15fde59d1 | ||
![]() |
1958974c73 | ||
![]() |
00b1b0fea4 | ||
![]() |
743b978e6f | ||
![]() |
cbabd8b76e | ||
![]() |
1fd877c597 | ||
![]() |
4f64ed07b1 | ||
![]() |
4e537b0466 | ||
![]() |
2b1198dfd9 | ||
![]() |
8db23fba43 | ||
![]() |
0451487549 | ||
![]() |
a16faa97ec | ||
![]() |
dbf626a53e | ||
![]() |
27cc767ec4 | ||
![]() |
8d2d08a12b | ||
![]() |
7c91d97440 | ||
![]() |
0eb7b53801 | ||
![]() |
510e31584e | ||
![]() |
0efedd7fa5 | ||
![]() |
01a32705e4 | ||
![]() |
05c1b82bcf | ||
![]() |
cf04796010 | ||
![]() |
fd7e66e144 | ||
![]() |
ceaf290f5e | ||
![]() |
5df9ae57ce | ||
![]() |
04ed7d413f | ||
![]() |
f543835921 | ||
![]() |
8ae35160e7 | ||
![]() |
75516a7217 | ||
![]() |
8783fc89e6 | ||
![]() |
fd0819ca30 | ||
![]() |
650b925251 | ||
![]() |
fd3e32eaa8 | ||
![]() |
a8bebb88b1 | ||
![]() |
3294a74979 | ||
![]() |
db95804eeb | ||
![]() |
15bfc00ddb | ||
![]() |
18580e431f | ||
![]() |
98624d8701 | ||
![]() |
3c03a15831 | ||
![]() |
9710a7bfc1 | ||
![]() |
34426ae32d | ||
![]() |
c2f98ee317 | ||
![]() |
4df2abba82 | ||
![]() |
c3cd207b2b | ||
![]() |
4f6053f767 | ||
![]() |
5578fbdd4f | ||
![]() |
84a6c40e13 | ||
![]() |
3e91004660 | ||
![]() |
ac1d334bf1 | ||
![]() |
368c840177 | ||
![]() |
c3a2fd736c | ||
![]() |
741987f40b | ||
![]() |
375b025e22 | ||
![]() |
7324ee5e8d | ||
![]() |
54c2299654 | ||
![]() |
b2cfb6d6ed | ||
![]() |
e8a11b8f79 | ||
![]() |
f16890f9a7 | ||
![]() |
e881bec45d | ||
![]() |
18eea7ca2d | ||
![]() |
316410a561 | ||
![]() |
76a1a190f6 | ||
![]() |
c243ae9cef | ||
![]() |
2722ee63cc | ||
![]() |
22e7fa1cf3 | ||
![]() |
101dc355ba | ||
![]() |
f5f3d0b827 | ||
![]() |
53cb5d1fe9 | ||
![]() |
0978ca616f | ||
![]() |
bbf42c0a28 | ||
![]() |
7df04c6e2e | ||
![]() |
d3386c8097 | ||
![]() |
309197781e | ||
![]() |
5a3ee970a0 | ||
![]() |
7cbe63e484 | ||
![]() |
5342b02091 | ||
![]() |
7eeca57135 | ||
![]() |
2162985e4a | ||
![]() |
5d53f4c13a | ||
![]() |
7de2c2692d | ||
![]() |
1b9df35a1d | ||
![]() |
d5d39797bb | ||
![]() |
829a228d79 | ||
![]() |
4c589c9610 | ||
![]() |
b9fc58ec45 | ||
![]() |
193a84dafd | ||
![]() |
3880a33208 | ||
![]() |
2edf897e39 | ||
![]() |
27d1170c75 | ||
![]() |
11c850a41e | ||
![]() |
ff4ee06a1f | ||
![]() |
0549f32d6e | ||
![]() |
c5ab3490b3 | ||
![]() |
50ba1a1c4e | ||
![]() |
ee45d2fb38 | ||
![]() |
a94822b79a | ||
![]() |
b5aba454ae | ||
![]() |
a49631e986 | ||
![]() |
bb31b5f2d3 | ||
![]() |
8ad08d466e | ||
![]() |
ab31183a93 | ||
![]() |
3257cc82dc | ||
![]() |
ef73733596 | ||
![]() |
4b45d4cf09 | ||
![]() |
e0b3e1db24 | ||
![]() |
e0b51d653a | ||
![]() |
c17ebbf4d7 | ||
![]() |
44a26d59a4 | ||
![]() |
6b8f81f7eb | ||
![]() |
9a4b9419eb | ||
![]() |
89548d132a | ||
![]() |
45dbb2cd3b | ||
![]() |
a95203e2c9 | ||
![]() |
a79fc4980e | ||
![]() |
1240781503 | ||
![]() |
0875c61bc9 | ||
![]() |
da60a1c393 | ||
![]() |
785f29abf8 | ||
![]() |
2a3e96b891 | ||
![]() |
f1f6dd4c60 | ||
![]() |
b8a8403dc3 | ||
![]() |
ab5eb9c401 | ||
![]() |
74b7fc9f77 | ||
![]() |
ca87316691 | ||
![]() |
cae61587da | ||
![]() |
0238d0bf2e | ||
![]() |
5be575a078 | ||
![]() |
36fbbbf4ae | ||
![]() |
a87ab3c558 | ||
![]() |
75e22a2080 | ||
![]() |
6c89799bfb | ||
![]() |
e0d9a8d0db | ||
![]() |
3208f6a1bd | ||
![]() |
d525be33cf | ||
![]() |
64136f0b93 | ||
![]() |
238203cf35 | ||
![]() |
6b354467ab | ||
![]() |
10444e5995 | ||
![]() |
42f6ca11db | ||
![]() |
eed094103d | ||
![]() |
5051bcd607 | ||
![]() |
74e2bb2d87 | ||
![]() |
a4a6331935 | ||
![]() |
3939144128 | ||
![]() |
7791c0b7be | ||
![]() |
2cfbff5cf6 | ||
![]() |
b734153253 | ||
![]() |
3df637b265 | ||
![]() |
ea220d2514 | ||
![]() |
8bb75fc376 | ||
![]() |
d461fe555d | ||
![]() |
0bd25f2506 | ||
![]() |
2355435275 | ||
![]() |
cc04ef5869 | ||
![]() |
521d8a605d | ||
![]() |
3bff1b1ba5 | ||
![]() |
15192652f0 | ||
![]() |
85873202ca | ||
![]() |
706bde03f9 | ||
![]() |
f855f5f429 | ||
![]() |
cce557e82a | ||
![]() |
7f7d8bd771 | ||
![]() |
9a95093b44 | ||
![]() |
ddf7bbdd31 | ||
![]() |
994a811efa | ||
![]() |
06efa46f32 | ||
![]() |
66778a060c | ||
![]() |
c9697d6cc8 | ||
![]() |
b801daa240 | ||
![]() |
d2f42d67c7 | ||
![]() |
cb9d750db9 | ||
![]() |
0b966c4497 | ||
![]() |
0774a822aa | ||
![]() |
7e0cdce7ea | ||
![]() |
e2ed963af5 | ||
![]() |
4781d29d67 | ||
![]() |
f5b6ca50f4 | ||
![]() |
05852b07c6 | ||
![]() |
689aa4cf95 | ||
![]() |
56aad9200a | ||
![]() |
ac69c0d9c6 | ||
![]() |
860592291f | ||
![]() |
113597333c | ||
![]() |
a83d71aa39 | ||
![]() |
93299ae843 | ||
![]() |
4300cf5330 | ||
![]() |
92d08377ce | ||
![]() |
19a6284023 | ||
![]() |
45908f2a84 | ||
![]() |
8648220e21 | ||
![]() |
68e285b514 | ||
![]() |
5153a42b69 | ||
![]() |
42feed710c | ||
![]() |
9d049b06c3 | ||
![]() |
1105529e91 | ||
![]() |
49c1f11503 | ||
![]() |
f54fd84de3 | ||
![]() |
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 | |||
![]() |
86bf723791 | ||
![]() |
71f2e9de4a | ||
![]() |
33d3f270a3 | ||
![]() |
da94edd386 | ||
![]() |
90dfaefd11 | ||
![]() |
8bc616cc55 | ||
![]() |
a9e79d62c5 | ||
![]() |
1998221a0b | ||
![]() |
a9b1625749 | ||
![]() |
b411836570 | ||
![]() |
df7e0221a8 | ||
![]() |
8ff8f2b685 | ||
![]() |
65dea7e3f7 | ||
![]() |
1942f86633 | ||
![]() |
ee4ce5033a | ||
![]() |
040fe806c8 | ||
![]() |
97f5c9225e | ||
![]() |
09b86c15f9 | ||
![]() |
8f34285d8c | ||
![]() |
d3c3b71e3e | ||
![]() |
aa6f49c9b1 | ||
![]() |
c011628420 | ||
![]() |
1c9fa9d662 | ||
![]() |
7b9bc64364 | ||
![]() |
729062bfdd | ||
![]() |
bc6c726a45 | ||
![]() |
dfc3df713e | ||
![]() |
42eca1d5f2 | ||
![]() |
66245e2730 | ||
![]() |
d44b82c1d1 | ||
![]() |
5440e48fa3 | ||
![]() |
1c513cf8aa | ||
![]() |
a17c4b8d43 | ||
![]() |
15eb4ac278 | ||
![]() |
0d9b81eab3 | ||
![]() |
f02e1a20c7 | ||
![]() |
a11991dad7 | ||
![]() |
1238828bfd | ||
![]() |
ba409cb24c | ||
![]() |
d597670275 | ||
![]() |
d8540e95f8 | ||
![]() |
d35ebf00dd | ||
![]() |
2b32cb26b1 | ||
![]() |
ca95fcb658 | ||
![]() |
cc18bbd168 | ||
![]() |
8c8ea800cb | ||
![]() |
0746dcc686 | ||
![]() |
930650be9d | ||
![]() |
4e3a9ffa40 | ||
![]() |
3bf68a2bb8 | ||
![]() |
a80f6feab0 | ||
![]() |
3cf8ae52ed | ||
![]() |
62632a4514 | ||
![]() |
249bd3778a | ||
![]() |
ab9e5d7a4a | ||
![]() |
083b7dc952 | ||
![]() |
1791692d92 | ||
![]() |
ba23c9ab5e | ||
![]() |
f96ab37bcb | ||
![]() |
0da34bbb34 | ||
![]() |
51e7c745ea | ||
![]() |
8347251572 | ||
![]() |
ce8512f4e0 | ||
![]() |
a724a19d00 | ||
![]() |
7eae7a98e8 | ||
![]() |
fe9566eebd | ||
![]() |
b69756730f | ||
![]() |
6cd1a60b53 | ||
![]() |
9d935e47b5 | ||
![]() |
a7d5372d06 | ||
![]() |
a575942c81 | ||
![]() |
3cf6c53a8e | ||
![]() |
91d86680de | ||
![]() |
d1d082fb99 | ||
![]() |
2c634d1bf0 | ||
![]() |
02a6fe4dc9 | ||
![]() |
223d681526 | ||
![]() |
f42ef1c2fc | ||
![]() |
f4817b2111 | ||
![]() |
6f5def0abf | ||
![]() |
f0fcd7f133 | ||
![]() |
6115adb72e | ||
![]() |
bfd0b5fd91 | ||
![]() |
6c0a52155b | ||
![]() |
c7ebce39bf | ||
![]() |
a0dc7a792f | ||
![]() |
fdb09a8f1f | ||
![]() |
4ac2aa2339 | ||
![]() |
ebbc20692a | ||
![]() |
5c82d112c9 | ||
![]() |
40fd50d7f1 | ||
![]() |
f7b948fee2 | ||
![]() |
6cdcf133bb | ||
![]() |
f3025757b6 | ||
![]() |
a49811a3f9 | ||
![]() |
2ac4b265d1 | ||
![]() |
46e994b563 | ||
![]() |
81482bd298 | ||
![]() |
f1a239c085 | ||
![]() |
a48e38de7b | ||
![]() |
0aaacee117 | ||
![]() |
b8373af69f | ||
![]() |
e99b2ee73d | ||
![]() |
705022331a | ||
![]() |
bf62d444bf | ||
![]() |
5dcff5657b | ||
![]() |
7e79d5a960 | ||
![]() |
c1b480976d | ||
![]() |
ddabbe6891 | ||
![]() |
ffa3052b50 | ||
![]() |
654ea88851 | ||
![]() |
4dc7982baa | ||
![]() |
ae2fc1cd85 | ||
![]() |
78bc8666e6 | ||
![]() |
9c2de2cfc7 | ||
![]() |
71e81465f3 | ||
![]() |
885031e086 | ||
![]() |
d77c5bb5cf | ||
![]() |
781bce0000 | ||
![]() |
a3ca1b965b | ||
![]() |
dd20b480a7 | ||
![]() |
38292e97af | ||
![]() |
46ea752164 | ||
![]() |
194b744361 | ||
b50197f7ce | |||
![]() |
c00703d1d0 | ||
![]() |
6e12377116 | ||
![]() |
b0c4391ad8 | ||
![]() |
f43ac2538a | ||
![]() |
9eaf8b5d2d | ||
![]() |
e365d0b07c | ||
![]() |
69c273c4a5 | ||
![]() |
f7950e7adb | ||
![]() |
7c1ae9812e | ||
![]() |
5c794ac40e |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
31
.github/workflows/checkNewPlugins.yml
vendored
Normal file
31
.github/workflows/checkNewPlugins.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||||
|
|
||||||
|
# This workflow syncs changes from the docs folder of IdeaVim to the IdeaVim.wiki repository
|
||||||
|
|
||||||
|
name: Check new plugin dependencies
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 5 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Fetch origin repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: '17'
|
||||||
|
distribution: 'adopt'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- name: Check new plugins
|
||||||
|
run: ./gradlew scripts:checkNewPluginDependencies
|
39
.github/workflows/closeYoutrackOnCommit.yml
vendored
Normal file
39
.github/workflows/closeYoutrackOnCommit.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||||
|
|
||||||
|
name: Close YouTrack on commit
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 300
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- uses: nrwl/last-successful-commit-action@v1
|
||||||
|
id: last_successful_commit
|
||||||
|
with:
|
||||||
|
branch: 'master'
|
||||||
|
workflow_id: 'closeYoutrackOnCommit.yml'
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Update YouTrack
|
||||||
|
run: ./gradlew updateYoutrackOnCommit
|
||||||
|
env:
|
||||||
|
SUCCESS_COMMIT: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
||||||
|
YOUTRACK_TOKEN: ${{ secrets.YOUTRACK_TOKEN }}
|
32
.github/workflows/integrationsTest.yml
vendored
Normal file
32
.github/workflows/integrationsTest.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||||
|
|
||||||
|
name: Testing CI integrations
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 5 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 300
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: ./gradlew integrationsTest
|
||||||
|
env:
|
||||||
|
YOUTRACK_TOKEN: ${{ secrets.YOUTRACK_TOKEN }}
|
||||||
|
GITHUB_OAUTH: ${{ secrets.MERGE_PR }}
|
35
.github/workflows/kover.yml
vendored
Normal file
35
.github/workflows/kover.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||||
|
|
||||||
|
name: Kover
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 300
|
||||||
|
- name: Set up JDK 11
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'adopt'
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: ./gradlew koverXmlReport
|
||||||
|
|
||||||
|
|
||||||
|
# Upload Kover report to CodeCov
|
||||||
|
- uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml
|
20
.github/workflows/mergePr.yml
vendored
20
.github/workflows/mergePr.yml
vendored
@@ -4,7 +4,8 @@
|
|||||||
name: Update Changelog On PR
|
name: Update Changelog On PR
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
|
pull_request_target:
|
||||||
types: [ closed ]
|
types: [ closed ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -29,13 +30,26 @@ jobs:
|
|||||||
id: update_authors
|
id: update_authors
|
||||||
run: ./gradlew updateMergedPr -PprId=${{ github.event.number }}
|
run: ./gradlew updateMergedPr -PprId=${{ github.event.number }}
|
||||||
env:
|
env:
|
||||||
GITHUB_OAUTH: ${{ secrets.AUTOMATION_TOKEN }}
|
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Reuse from update changelog
|
||||||
|
- uses: nrwl/last-successful-commit-action@v1
|
||||||
|
id: last_successful_commit
|
||||||
|
with:
|
||||||
|
branch: 'master'
|
||||||
|
workflow_id: 'updateChangelog.yml'
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Update changelog
|
||||||
|
run: ./gradlew updateChangelog
|
||||||
|
env:
|
||||||
|
SUCCESS_COMMIT: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
with:
|
with:
|
||||||
branch: master
|
branch: master
|
||||||
commit_message: Update changelog after merging PR
|
commit_message: Update changelog after merging PR
|
||||||
commit_user_name: Alex Plate
|
commit_user_name: Alex Plate
|
||||||
commit_user_email: aleksei.plate@jetbrains.com
|
commit_user_email: aleksei.plate@jetbrains.com
|
||||||
commit_author: Alex Plate <aleksei.plate@jetbrains.com>
|
commit_author: Alex Plate <aleksei.plate@jetbrains.com>
|
||||||
|
42
.github/workflows/syncDoc.yml
vendored
Normal file
42
.github/workflows/syncDoc.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||||
|
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||||
|
|
||||||
|
# This workflow syncs changes from the docs folder of IdeaVim to the IdeaVim.wiki repository
|
||||||
|
|
||||||
|
name: Sync docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Fetch origin repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: origin
|
||||||
|
|
||||||
|
- name: Fetch docs repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: JetBrains/ideavim.wiki
|
||||||
|
path: docs
|
||||||
|
|
||||||
|
- name: Sync docs
|
||||||
|
id: update_authors
|
||||||
|
run: cp -a origin/doc/. docs
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
branch: master
|
||||||
|
repository: docs
|
||||||
|
commit_message: Update docs
|
||||||
|
commit_user_name: Alex Plate
|
||||||
|
commit_user_email: aleksei.plate@jetbrains.com
|
||||||
|
commit_author: Alex Plate <aleksei.plate@jetbrains.com>
|
2
.github/workflows/updateAuthors.yml
vendored
2
.github/workflows/updateAuthors.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
run: ./gradlew updateAuthors --stacktrace
|
run: ./gradlew updateAuthors --stacktrace
|
||||||
env:
|
env:
|
||||||
SUCCESS_COMMIT: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
SUCCESS_COMMIT: ${{ steps.last_successful_commit.outputs.commit_hash }}
|
||||||
GITHUB_OAUTH: ${{ secrets.AUTOMATION_TOKEN }}
|
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: stefanzweifel/git-auto-commit-action@v4
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
2
.github/workflows/updateChangelog.yml
vendored
2
.github/workflows/updateChangelog.yml
vendored
@@ -11,6 +11,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
|
if: github.event.pull_request.merged != true
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -45,3 +46,4 @@ jobs:
|
|||||||
commit_user_email: aleksei.plate@jetbrains.com
|
commit_user_email: aleksei.plate@jetbrains.com
|
||||||
commit_author: Alex Plate <aleksei.plate@jetbrains.com>
|
commit_author: Alex Plate <aleksei.plate@jetbrains.com>
|
||||||
file_pattern: CHANGES.md
|
file_pattern: CHANGES.md
|
||||||
|
skip_fetch: false
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@
|
|||||||
!/.idea/fileTemplates
|
!/.idea/fileTemplates
|
||||||
!/.idea/runConfigurations
|
!/.idea/runConfigurations
|
||||||
!/.idea/codeStyles
|
!/.idea/codeStyles
|
||||||
|
!/.idea/vcs.xml
|
||||||
|
|
||||||
**/build/
|
**/build/
|
||||||
**/out/
|
**/out/
|
||||||
|
2
.idea/copyright/IdeaVim.xml
generated
2
.idea/copyright/IdeaVim.xml
generated
@@ -1,6 +1,6 @@
|
|||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="IdeaVim - Vim emulator for IDEs based on the IntelliJ platform Copyright (C) 2003-&#36;today.year 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/>." />
|
<option name="notice" value="Copyright 2003-2022 The IdeaVim authors Use of this source code is governed by an MIT-style license that can be found in the LICENSE.txt file or at https://opensource.org/licenses/MIT." />
|
||||||
<option name="myName" value="IdeaVim" />
|
<option name="myName" value="IdeaVim" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
14
.idea/inspectionProfiles/Qodana.xml
generated
14
.idea/inspectionProfiles/Qodana.xml
generated
@@ -33,9 +33,11 @@
|
|||||||
<option name="ignoreToString" value="false" />
|
<option name="ignoreToString" value="false" />
|
||||||
<option name="nonNlsCommentPattern" value="NON-NLS" />
|
<option name="nonNlsCommentPattern" value="NON-NLS" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MagicConstant" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
|
<inspection_tool class="MissortedModifiers" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
<option name="m_requireAnnotationsFirst" value="true" />
|
<option name="m_requireAnnotationsFirst" value="true" />
|
||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
|
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="SameReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="SameReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
<option name="processCode" value="true" />
|
<option name="processCode" value="true" />
|
||||||
@@ -44,5 +46,17 @@
|
|||||||
</inspection_tool>
|
</inspection_tool>
|
||||||
<inspection_tool class="SuperTearDownInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
<inspection_tool class="SuperTearDownInFinally" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
<inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
<inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="unused" enabled="false" level="WARNING" enabled_by_default="false" checkParameterExcludingHierarchy="false">
|
||||||
|
<option name="LOCAL_VARIABLE" value="true" />
|
||||||
|
<option name="FIELD" value="true" />
|
||||||
|
<option name="METHOD" value="true" />
|
||||||
|
<option name="CLASS" value="true" />
|
||||||
|
<option name="PARAMETER" value="true" />
|
||||||
|
<option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" />
|
||||||
|
<option name="ADD_MAINS_TO_ENTRIES" value="true" />
|
||||||
|
<option name="ADD_APPLET_TO_ENTRIES" value="true" />
|
||||||
|
<option name="ADD_SERVLET_TO_ENTRIES" value="true" />
|
||||||
|
<option name="ADD_NONJAVA_TO_ENTRIES" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
</profile>
|
</profile>
|
||||||
</component>
|
</component>
|
2
.idea/scopes/Copyright.xml
generated
2
.idea/scopes/Copyright.xml
generated
@@ -1,3 +1,3 @@
|
|||||||
<component name="DependencyValidationManager">
|
<component name="DependencyValidationManager">
|
||||||
<scope name="Copyright" pattern="(file[IdeaVIM.main]:*/||file[IdeaVIM.test]:*/)&&!file[IdeaVIM.main]:resources//*" />
|
<scope name="Copyright" pattern="file:*/&&!file:.github//*&&!file:.idea//*&&!file:.teamcity//*&&!file:assets//*&&!file:config//*&&!file:doc//*&&!file:gradle//*&&!file:gradlew&&!file:gradlew.bat&&!file:src/main/resources//*&&!file:antlr//*&&!file:java/com/maddyhome/idea/vim/regexp/RegExp.kt" />
|
||||||
</component>
|
</component>
|
16
.idea/vcs.xml
generated
Normal file
16
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="IssueNavigationConfiguration">
|
||||||
|
<option name="links">
|
||||||
|
<list>
|
||||||
|
<IssueNavigationLink>
|
||||||
|
<option name="issueRegexp" value="[A-Z]+\-\d+" />
|
||||||
|
<option name="linkRegexp" value="https://youtrack.jetbrains.com/issue/$0" />
|
||||||
|
</IssueNavigationLink>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
7
.teamcity/_Self/Constants.kt
vendored
7
.teamcity/_Self/Constants.kt
vendored
@@ -5,15 +5,16 @@ 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 = "2.0.0"
|
||||||
const val DEV_VERSION = "1.11.0"
|
const val DEV_VERSION = "2.1.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"
|
||||||
const val PROPERTY_TESTS = "LATEST-EAP-SNAPSHOT"
|
const val PROPERTY_TESTS = "LATEST-EAP-SNAPSHOT"
|
||||||
const val LONG_RUNNING_TESTS = "LATEST-EAP-SNAPSHOT"
|
const val LONG_RUNNING_TESTS = "LATEST-EAP-SNAPSHOT"
|
||||||
const val QODANA_TESTS = "LATEST-EAP-SNAPSHOT"
|
const val QODANA_TESTS = "LATEST-EAP-SNAPSHOT"
|
||||||
const val RELEASE = "2021.3"
|
const val RELEASE = "LATEST-EAP-SNAPSHOT"
|
||||||
|
|
||||||
const val RELEASE_DEV = "LATEST-EAP-SNAPSHOT"
|
const val RELEASE_DEV = "LATEST-EAP-SNAPSHOT"
|
||||||
const val RELEASE_EAP = "LATEST-EAP-SNAPSHOT"
|
const val RELEASE_EAP = "LATEST-EAP-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
24
.teamcity/_Self/Project.kt
vendored
24
.teamcity/_Self/Project.kt
vendored
@@ -1,17 +1,17 @@
|
|||||||
package _Self
|
package _Self
|
||||||
|
|
||||||
import _Self.buildTypes.*
|
import _Self.buildTypes.Compatibility
|
||||||
|
import _Self.buildTypes.LongRunning
|
||||||
|
import _Self.buildTypes.Nvim
|
||||||
|
import _Self.buildTypes.PluginVerifier
|
||||||
|
import _Self.buildTypes.PropertyBased
|
||||||
|
import _Self.buildTypes.Qodana
|
||||||
|
import _Self.buildTypes.TestsForIntelliJ20222
|
||||||
|
import _Self.buildTypes.TestsForIntelliJEAP
|
||||||
import _Self.subprojects.GitHub
|
import _Self.subprojects.GitHub
|
||||||
import _Self.subprojects.OldTests
|
import _Self.subprojects.OldTests
|
||||||
import _Self.subprojects.Releases
|
import _Self.subprojects.Releases
|
||||||
import _Self.vcsRoots.Branch_181
|
import _Self.vcsRoots.*
|
||||||
import _Self.vcsRoots.Branch_183
|
|
||||||
import _Self.vcsRoots.Branch_191_193
|
|
||||||
import _Self.vcsRoots.Branch_201
|
|
||||||
import _Self.vcsRoots.Branch_202
|
|
||||||
import _Self.vcsRoots.Branch_203_212
|
|
||||||
import _Self.vcsRoots.Branch_Release
|
|
||||||
import _Self.vcsRoots.GitHubPullRequest
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
|
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
|
||||||
|
|
||||||
object Project : Project({
|
object Project : Project({
|
||||||
@@ -26,11 +26,12 @@ object Project : Project({
|
|||||||
vcsRoot(Branch_201)
|
vcsRoot(Branch_201)
|
||||||
vcsRoot(Branch_202)
|
vcsRoot(Branch_202)
|
||||||
vcsRoot(Branch_203_212)
|
vcsRoot(Branch_203_212)
|
||||||
|
vcsRoot(Branch_213_221)
|
||||||
|
vcsRoot(Branch_222)
|
||||||
vcsRoot(Branch_Release)
|
vcsRoot(Branch_Release)
|
||||||
vcsRoot(GitHubPullRequest)
|
vcsRoot(GitHubPullRequest)
|
||||||
|
|
||||||
// Builds
|
// Builds
|
||||||
buildType(TestsForIntelliJ20213)
|
|
||||||
buildType(TestsForIntelliJEAP)
|
buildType(TestsForIntelliJEAP)
|
||||||
|
|
||||||
buildType(PropertyBased)
|
buildType(PropertyBased)
|
||||||
@@ -38,6 +39,7 @@ object Project : Project({
|
|||||||
|
|
||||||
buildType(Nvim)
|
buildType(Nvim)
|
||||||
buildType(PluginVerifier)
|
buildType(PluginVerifier)
|
||||||
|
buildType(Compatibility)
|
||||||
|
|
||||||
buildType(Qodana)
|
buildType(Qodana)
|
||||||
|
|
||||||
@@ -47,7 +49,7 @@ object Project : Project({
|
|||||||
type = "CloudImage"
|
type = "CloudImage"
|
||||||
id = "PROJECT_EXT_768"
|
id = "PROJECT_EXT_768"
|
||||||
param("agent_pool_id", "41")
|
param("agent_pool_id", "41")
|
||||||
param("amazon-id", "ami-0d1a6a32faa92923e")
|
param("amazon-id", "ami-0fa17ce8238eb8868")
|
||||||
param("ebs-optimized", "false")
|
param("ebs-optimized", "false")
|
||||||
param("image-instances-limit", "")
|
param("image-instances-limit", "")
|
||||||
param("image-name-prefix", "BuildAgentsIdeaVim")
|
param("image-name-prefix", "BuildAgentsIdeaVim")
|
||||||
|
1
.teamcity/_Self/buildTypes/ActiveTests.kt
vendored
1
.teamcity/_Self/buildTypes/ActiveTests.kt
vendored
@@ -55,4 +55,3 @@ 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")
|
|
||||||
|
49
.teamcity/_Self/buildTypes/Compatibility.kt
vendored
Normal file
49
.teamcity/_Self/buildTypes/Compatibility.kt
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package _Self.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.golang
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
|
||||||
|
|
||||||
|
object Compatibility : BuildType({
|
||||||
|
id("IdeaVimCompatibility")
|
||||||
|
name = "IdeaVim compatibility with external plugins"
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
root(DslContext.settingsRoot)
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
name = "Check"
|
||||||
|
scriptContent = """
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}org.jetbrains.IdeaVim-EasyMotion' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}io.github.mishkun.ideavimsneak' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}eu.theblob42.idea.whichkey' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}IdeaVimExtension' [latest-IU] -team-city
|
||||||
|
# Outdated java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}github.zgqq.intellij-enhance' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.github.copilot' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.github.dankinsoid.multicursor' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.joshestein.ideavim-quickscope' [latest-IU] -team-city
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
schedule {
|
||||||
|
schedulingPolicy = daily {
|
||||||
|
hour = 4
|
||||||
|
}
|
||||||
|
branchFilter = ""
|
||||||
|
triggerBuild = always()
|
||||||
|
withPendingChangesOnly = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
features {
|
||||||
|
golang {
|
||||||
|
testFormat = "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
2
.teamcity/_Self/buildTypes/Nvim.kt
vendored
2
.teamcity/_Self/buildTypes/Nvim.kt
vendored
@@ -31,7 +31,7 @@ object Nvim : BuildType({
|
|||||||
script {
|
script {
|
||||||
name = "Set up NeoVim"
|
name = "Set up NeoVim"
|
||||||
scriptContent = """
|
scriptContent = """
|
||||||
wget https://github.com/neovim/neovim/releases/download/v0.4.4/nvim-linux64.tar.gz
|
wget https://github.com/neovim/neovim/releases/download/v0.7.2/nvim-linux64.tar.gz
|
||||||
tar xzf nvim-linux64.tar.gz
|
tar xzf nvim-linux64.tar.gz
|
||||||
cd nvim-linux64/bin
|
cd nvim-linux64/bin
|
||||||
chmod +x nvim
|
chmod +x nvim
|
||||||
|
6
.teamcity/_Self/buildTypes/Qodana.kt
vendored
6
.teamcity/_Self/buildTypes/Qodana.kt
vendored
@@ -4,6 +4,7 @@ import _Self.Constants.QODANA_TESTS
|
|||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
|
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
|
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
|
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.Qodana
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.qodana
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.qodana
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
|
||||||
@@ -46,12 +47,15 @@ object Qodana : BuildType({
|
|||||||
param("clonefinder-enable", "true")
|
param("clonefinder-enable", "true")
|
||||||
param("clonefinder-reference-projects", "src")
|
param("clonefinder-reference-projects", "src")
|
||||||
param("yaml-configuration", "")
|
param("yaml-configuration", "")
|
||||||
|
linter = jvm {
|
||||||
|
version = Qodana.JVMVersion.LATEST
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
vcs {
|
vcs {
|
||||||
enabled = false
|
enabled = true
|
||||||
branchFilter = ""
|
branchFilter = ""
|
||||||
}
|
}
|
||||||
schedule {
|
schedule {
|
||||||
|
62
.teamcity/_Self/buildTypes/TestsForIntelliJ_213-221.kt
vendored
Normal file
62
.teamcity/_Self/buildTypes/TestsForIntelliJ_213-221.kt
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
@file:Suppress("ClassName")
|
||||||
|
|
||||||
|
package _Self.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
||||||
|
|
||||||
|
sealed class TestsForIntelliJ_213_221_branch(private val version: String) : BuildType({
|
||||||
|
name = "Tests for IntelliJ $version"
|
||||||
|
|
||||||
|
params {
|
||||||
|
param("env.ORG_GRADLE_PROJECT_downloadIdeaSources", "false")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_legacyNoJavaPlugin", "true")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_ideaVersion", "IC-$version")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_instrumentPluginCode", "false")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_javaVersion", "1.8")
|
||||||
|
}
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
root(_Self.vcsRoots.Branch_213_221)
|
||||||
|
|
||||||
|
checkoutMode = CheckoutMode.AUTO
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
gradle {
|
||||||
|
tasks = "clean test"
|
||||||
|
buildFile = ""
|
||||||
|
enableStacktrace = true
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
vcs {
|
||||||
|
branchFilter = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
requirements {
|
||||||
|
noLessThanVer("teamcity.agent.jvm.version", "1.8")
|
||||||
|
}
|
||||||
|
|
||||||
|
failureConditions {
|
||||||
|
failOnMetricChange {
|
||||||
|
metric = BuildFailureOnMetric.MetricType.TEST_COUNT
|
||||||
|
threshold = 20
|
||||||
|
units = BuildFailureOnMetric.MetricUnit.PERCENTS
|
||||||
|
comparison = BuildFailureOnMetric.MetricComparison.LESS
|
||||||
|
compareTo = build {
|
||||||
|
buildRule = lastSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
object TestsForIntelliJ20213 : TestsForIntelliJ_213_221_branch("2021.3.2")
|
57
.teamcity/_Self/buildTypes/TestsForIntelliJ_222.kt
vendored
Normal file
57
.teamcity/_Self/buildTypes/TestsForIntelliJ_222.kt
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
@file:Suppress("ClassName")
|
||||||
|
|
||||||
|
package _Self.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
||||||
|
|
||||||
|
sealed class TestsForIntelliJ_222_branch(private val version: String) : BuildType({
|
||||||
|
name = "Tests for IntelliJ $version"
|
||||||
|
|
||||||
|
params {
|
||||||
|
param("env.ORG_GRADLE_PROJECT_downloadIdeaSources", "false")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_legacyNoJavaPlugin", "true")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_ideaVersion", "IC-$version")
|
||||||
|
param("env.ORG_GRADLE_PROJECT_instrumentPluginCode", "false")
|
||||||
|
}
|
||||||
|
|
||||||
|
vcs {
|
||||||
|
root(_Self.vcsRoots.Branch_222)
|
||||||
|
|
||||||
|
checkoutMode = CheckoutMode.AUTO
|
||||||
|
}
|
||||||
|
|
||||||
|
steps {
|
||||||
|
gradle {
|
||||||
|
tasks = "clean test"
|
||||||
|
buildFile = ""
|
||||||
|
enableStacktrace = true
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
vcs {
|
||||||
|
branchFilter = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
failureConditions {
|
||||||
|
failOnMetricChange {
|
||||||
|
metric = BuildFailureOnMetric.MetricType.TEST_COUNT
|
||||||
|
threshold = 20
|
||||||
|
units = BuildFailureOnMetric.MetricUnit.PERCENTS
|
||||||
|
comparison = BuildFailureOnMetric.MetricComparison.LESS
|
||||||
|
compareTo = build {
|
||||||
|
buildRule = lastSuccessful()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
object TestsForIntelliJ20222 : TestsForIntelliJ_222_branch("2022.2.3")
|
4
.teamcity/_Self/subprojects/OldTests.kt
vendored
4
.teamcity/_Self/subprojects/OldTests.kt
vendored
@@ -11,6 +11,8 @@ import _Self.buildTypes.TestsForIntelliJ20202
|
|||||||
import _Self.buildTypes.TestsForIntelliJ20203
|
import _Self.buildTypes.TestsForIntelliJ20203
|
||||||
import _Self.buildTypes.TestsForIntelliJ20211
|
import _Self.buildTypes.TestsForIntelliJ20211
|
||||||
import _Self.buildTypes.TestsForIntelliJ20212
|
import _Self.buildTypes.TestsForIntelliJ20212
|
||||||
|
import _Self.buildTypes.TestsForIntelliJ20213
|
||||||
|
import _Self.buildTypes.TestsForIntelliJ20222
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
|
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
|
||||||
|
|
||||||
object OldTests : Project({
|
object OldTests : Project({
|
||||||
@@ -28,4 +30,6 @@ object OldTests : Project({
|
|||||||
buildType(TestsForIntelliJ20203)
|
buildType(TestsForIntelliJ20203)
|
||||||
buildType(TestsForIntelliJ20211)
|
buildType(TestsForIntelliJ20211)
|
||||||
buildType(TestsForIntelliJ20212)
|
buildType(TestsForIntelliJ20212)
|
||||||
|
buildType(TestsForIntelliJ20213)
|
||||||
|
buildType(TestsForIntelliJ20222)
|
||||||
})
|
})
|
||||||
|
12
.teamcity/_Self/vcsRoots/Branch_213_221.kt
vendored
Normal file
12
.teamcity/_Self/vcsRoots/Branch_213_221.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
@file:Suppress("ClassName")
|
||||||
|
|
||||||
|
package _Self.vcsRoots
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
|
||||||
|
|
||||||
|
object Branch_213_221 : GitVcsRoot({
|
||||||
|
id("HttpsGithubComJetBrainsIdeavimBranch213221")
|
||||||
|
name = "https://github.com/JetBrains/ideavim (branch 213-221)"
|
||||||
|
url = "https://github.com/JetBrains/ideavim.git"
|
||||||
|
branch = "213-221"
|
||||||
|
})
|
12
.teamcity/_Self/vcsRoots/Branch_222.kt
vendored
Normal file
12
.teamcity/_Self/vcsRoots/Branch_222.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
@file:Suppress("ClassName")
|
||||||
|
|
||||||
|
package _Self.vcsRoots
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
|
||||||
|
|
||||||
|
object Branch_222 : GitVcsRoot({
|
||||||
|
id("HttpsGithubComJetBrainsIdeavimBranch222")
|
||||||
|
name = "https://github.com/JetBrains/ideavim (branch 222)"
|
||||||
|
url = "https://github.com/JetBrains/ideavim.git"
|
||||||
|
branch = "222"
|
||||||
|
})
|
65
.teamcity/patches/buildTypes/IdeaVimCompatibility.kts
vendored
Normal file
65
.teamcity/patches/buildTypes/IdeaVimCompatibility.kts
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package patches.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.ScriptBuildStep
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
This patch script was generated by TeamCity on settings change in UI.
|
||||||
|
To apply the patch, change the buildType with id = 'IdeaVimCompatibility'
|
||||||
|
accordingly, and delete the patch script.
|
||||||
|
*/
|
||||||
|
changeBuildType(RelativeId("IdeaVimCompatibility")) {
|
||||||
|
vcs {
|
||||||
|
remove(DslContext.settingsRoot.id!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
expectSteps {
|
||||||
|
script {
|
||||||
|
name = "Check"
|
||||||
|
scriptContent = """
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}org.jetbrains.IdeaVim-EasyMotion' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}io.github.mishkun.ideavimsneak' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}eu.theblob42.idea.whichkey' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}IdeaVimExtension' [latest-IU] -team-city
|
||||||
|
# Outdated java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}github.zgqq.intellij-enhance' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.github.copilot' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.github.dankinsoid.multicursor' [latest-IU] -team-city
|
||||||
|
java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}com.joshestein.ideavim-quickscope' [latest-IU] -team-city
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
update<ScriptBuildStep>(0) {
|
||||||
|
name = "Load Verifier"
|
||||||
|
clearConditions()
|
||||||
|
scriptContent = """
|
||||||
|
mkdir verifier1
|
||||||
|
curl -f -L -o verifier1/verifier-cli-dev-all-1.jar "https://packages.jetbrains.team/files/p/ideavim/plugin-verifier/verifier-cli-dev-all-1.jar"
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
insert(1) {
|
||||||
|
script {
|
||||||
|
name = "Check"
|
||||||
|
scriptContent = """
|
||||||
|
# We use a custom build of verifier that downloads IdeaVim from dev channel
|
||||||
|
# To create a custom build: Download plugin verifier repo, add an if that switches to dev channel for IdeaVim repo
|
||||||
|
# At the moment it's com.jetbrains.pluginverifier.repository.repositories.marketplace.MarketplaceRepository#getLastCompatibleVersionOfPlugin
|
||||||
|
# Build using gradlew :intellij-plugin-verifier:verifier-cli:shadowJar
|
||||||
|
# Upload verifier-cli-dev-all.jar artifact to the repo in IdeaVim space repo
|
||||||
|
|
||||||
|
java --version
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}org.jetbrains.IdeaVim-EasyMotion' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}io.github.mishkun.ideavimsneak' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}eu.theblob42.idea.whichkey' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}IdeaVimExtension' [latest-IU] -team-city
|
||||||
|
# Outdated java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}github.zgqq.intellij-enhance' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}com.github.copilot' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}com.github.dankinsoid.multicursor' [latest-IU] -team-city
|
||||||
|
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}com.joshestein.ideavim-quickscope' [latest-IU] -team-city
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
.teamcity/patches/buildTypes/Nvim.kts
vendored
25
.teamcity/patches/buildTypes/Nvim.kts
vendored
@@ -1,25 +0,0 @@
|
|||||||
package patches.buildTypes
|
|
||||||
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
|
||||||
|
|
||||||
/*
|
|
||||||
This patch script was generated by TeamCity on settings change in UI.
|
|
||||||
To apply the patch, change the buildType with id = 'Nvim'
|
|
||||||
accordingly, and delete the patch script.
|
|
||||||
*/
|
|
||||||
changeBuildType(RelativeId("Nvim")) {
|
|
||||||
triggers {
|
|
||||||
val trigger1 = find<VcsTrigger> {
|
|
||||||
vcs {
|
|
||||||
branchFilter = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
trigger1.apply {
|
|
||||||
enabled = false
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
25
.teamcity/patches/buildTypes/PluginVerifier.kts
vendored
25
.teamcity/patches/buildTypes/PluginVerifier.kts
vendored
@@ -1,25 +0,0 @@
|
|||||||
package patches.buildTypes
|
|
||||||
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
|
||||||
|
|
||||||
/*
|
|
||||||
This patch script was generated by TeamCity on settings change in UI.
|
|
||||||
To apply the patch, change the buildType with id = 'PluginVerifier'
|
|
||||||
accordingly, and delete the patch script.
|
|
||||||
*/
|
|
||||||
changeBuildType(RelativeId("PluginVerifier")) {
|
|
||||||
triggers {
|
|
||||||
val trigger1 = find<VcsTrigger> {
|
|
||||||
vcs {
|
|
||||||
branchFilter = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
trigger1.apply {
|
|
||||||
enabled = false
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
61
.teamcity/patches/buildTypes/Qodana.kts
vendored
61
.teamcity/patches/buildTypes/Qodana.kts
vendored
@@ -2,9 +2,14 @@ package patches.buildTypes
|
|||||||
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.Qodana
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.Qodana
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.qodana
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.qodana
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.ScheduleTrigger
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.ScheduleTrigger
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.VcsTrigger
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -16,9 +21,8 @@ changeBuildType(RelativeId("Qodana")) {
|
|||||||
expectSteps {
|
expectSteps {
|
||||||
qodana {
|
qodana {
|
||||||
name = "Qodana"
|
name = "Qodana"
|
||||||
reportAsTests = true
|
linter = jvm {
|
||||||
inspectionProfile = customProfile {
|
version = Qodana.JVMVersion.LATEST
|
||||||
path = ".idea/inspectionProfiles/Qodana.xml"
|
|
||||||
}
|
}
|
||||||
param("clonefinder-enable", "true")
|
param("clonefinder-enable", "true")
|
||||||
param("clonefinder-languages", "Java")
|
param("clonefinder-languages", "Java")
|
||||||
@@ -26,7 +30,6 @@ changeBuildType(RelativeId("Qodana")) {
|
|||||||
param("clonefinder-mode", "")
|
param("clonefinder-mode", "")
|
||||||
param("clonefinder-queried-project", "src")
|
param("clonefinder-queried-project", "src")
|
||||||
param("clonefinder-reference-projects", "src")
|
param("clonefinder-reference-projects", "src")
|
||||||
param("fail-build-on-errors", "")
|
|
||||||
param("licenseaudit-enable", "true")
|
param("licenseaudit-enable", "true")
|
||||||
param("namesAndTagsCustom", "repo.labs.intellij.net/static-analyser/qodana")
|
param("namesAndTagsCustom", "repo.labs.intellij.net/static-analyser/qodana")
|
||||||
param("report-version", "")
|
param("report-version", "")
|
||||||
@@ -34,16 +37,39 @@ changeBuildType(RelativeId("Qodana")) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
update<Qodana>(0) {
|
insert(0) {
|
||||||
clearConditions()
|
gradle {
|
||||||
linter = jvm {
|
name = "Generate grammar"
|
||||||
version = Qodana.JVMVersion.LATEST
|
tasks = "generateGrammarSource"
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
update<Qodana>(1) {
|
||||||
|
clearConditions()
|
||||||
|
reportAsTests = true
|
||||||
|
additionalDockerArguments = "-e QODANA_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzUFZrQSIsInByb2plY3QiOiIzN1FlQSIsInRva2VuIjoiM0t2bXoifQ.uohp81tM7iAfvvB6k8faarfpV-OjusAaEbWQ8iNrOgs"
|
||||||
|
additionalQodanaArguments = "--baseline qodana.sarif.json"
|
||||||
|
param("clonefinder-languages", "")
|
||||||
|
param("collect-anonymous-statistics", "")
|
||||||
|
param("licenseaudit-enable", "")
|
||||||
|
param("clonefinder-languages-container", "")
|
||||||
|
param("clonefinder-queried-project", "")
|
||||||
|
param("clonefinder-enable", "")
|
||||||
|
param("clonefinder-reference-projects", "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
triggers {
|
triggers {
|
||||||
val trigger1 = find<ScheduleTrigger> {
|
val trigger1 = find<VcsTrigger> {
|
||||||
|
vcs {
|
||||||
|
branchFilter = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
trigger1.apply {
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
}
|
||||||
|
val trigger2 = find<ScheduleTrigger> {
|
||||||
schedule {
|
schedule {
|
||||||
schedulingPolicy = weekly {
|
schedulingPolicy = weekly {
|
||||||
dayOfWeek = ScheduleTrigger.DAY.Tuesday
|
dayOfWeek = ScheduleTrigger.DAY.Tuesday
|
||||||
@@ -52,9 +78,24 @@ changeBuildType(RelativeId("Qodana")) {
|
|||||||
triggerBuild = always()
|
triggerBuild = always()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trigger1.apply {
|
trigger2.apply {
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
failureConditions {
|
||||||
|
val feature1 = find<BuildFailureOnMetric> {
|
||||||
|
failOnMetricChange {
|
||||||
|
metric = BuildFailureOnMetric.MetricType.QODANA_TOTAL_PROBLEMS_COUNT
|
||||||
|
threshold = 0
|
||||||
|
units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT
|
||||||
|
comparison = BuildFailureOnMetric.MetricComparison.MORE
|
||||||
|
compareTo = value()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
feature1.apply {
|
||||||
|
param("metricKey", "QodanaProblemsNew")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
48
.teamcity/patches/buildTypes/Release.kts
vendored
Normal file
48
.teamcity/patches/buildTypes/Release.kts
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package patches.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
This patch script was generated by TeamCity on settings change in UI.
|
||||||
|
To apply the patch, change the buildType with id = 'Release'
|
||||||
|
accordingly, and delete the patch script.
|
||||||
|
*/
|
||||||
|
changeBuildType(RelativeId("Release")) {
|
||||||
|
params {
|
||||||
|
add {
|
||||||
|
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:3cd3e867-282c-451f-b958-bc95d56a8450", display = ParameterDisplay.HIDDEN)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expectSteps {
|
||||||
|
gradle {
|
||||||
|
tasks = "clean publishPlugin slackNotification"
|
||||||
|
buildFile = ""
|
||||||
|
enableStacktrace = true
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
update<GradleBuildStep>(0) {
|
||||||
|
clearConditions()
|
||||||
|
tasks = "clean publishPlugin"
|
||||||
|
}
|
||||||
|
insert(1) {
|
||||||
|
gradle {
|
||||||
|
name = "Run Integrations"
|
||||||
|
tasks = "releaseActions"
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
insert(2) {
|
||||||
|
gradle {
|
||||||
|
name = "Slack Notification"
|
||||||
|
tasks = "slackNotification"
|
||||||
|
param("org.jfrog.artifactory.selectedDeployableServer.defaultModuleVersionConfiguration", "GLOBAL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
.teamcity/patches/buildTypes/ReleaseEap.kts
vendored
Normal file
27
.teamcity/patches/buildTypes/ReleaseEap.kts
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package patches.buildTypes
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.VcsLabeling
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.vcsLabeling
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
This patch script was generated by TeamCity on settings change in UI.
|
||||||
|
To apply the patch, change the buildType with id = 'ReleaseEap'
|
||||||
|
accordingly, and delete the patch script.
|
||||||
|
*/
|
||||||
|
changeBuildType(RelativeId("ReleaseEap")) {
|
||||||
|
features {
|
||||||
|
val feature1 = find<VcsLabeling> {
|
||||||
|
vcsLabeling {
|
||||||
|
vcsRootId = "${DslContext.settingsRoot.id}"
|
||||||
|
labelingPattern = "%system.build.number%"
|
||||||
|
successfulOnly = true
|
||||||
|
branchFilter = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
feature1.apply {
|
||||||
|
successfulOnly = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
50
.teamcity/patches/projects/_Self.kts
vendored
Normal file
50
.teamcity/patches/projects/_Self.kts
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package patches.projects
|
||||||
|
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.AmazonEC2CloudImage
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.amazonEC2CloudImage
|
||||||
|
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||||
|
|
||||||
|
/*
|
||||||
|
This patch script was generated by TeamCity on settings change in UI.
|
||||||
|
To apply the patch, change the root project
|
||||||
|
accordingly, and delete the patch script.
|
||||||
|
*/
|
||||||
|
changeProject(DslContext.projectId) {
|
||||||
|
features {
|
||||||
|
val feature1 = find<AmazonEC2CloudImage> {
|
||||||
|
amazonEC2CloudImage {
|
||||||
|
id = "PROJECT_EXT_768"
|
||||||
|
profileId = "amazon-48"
|
||||||
|
agentPoolId = "41"
|
||||||
|
name = "BuildAgentsIdeaVim"
|
||||||
|
vpcSubnetId = "subnet-58839511"
|
||||||
|
keyPairName = ""
|
||||||
|
instanceType = "c5d.xlarge"
|
||||||
|
securityGroups = listOf("sg-eda08696", "sg-7332cf0f")
|
||||||
|
useSpotInstances = true
|
||||||
|
instanceTags = mapOf(
|
||||||
|
"project" to "idea-vim"
|
||||||
|
)
|
||||||
|
source = Source("ami-0fa17ce8238eb8868")
|
||||||
|
param("image-instances-limit", "")
|
||||||
|
param("spot-instance-price", "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
feature1.apply {
|
||||||
|
profileId = "amazon-48"
|
||||||
|
agentPoolId = "41"
|
||||||
|
name = "BuildAgentsIdeaVim"
|
||||||
|
vpcSubnetId = "subnet-58839511"
|
||||||
|
keyPairName = ""
|
||||||
|
instanceType = "c5d.xlarge"
|
||||||
|
securityGroups = listOf("sg-eda08696", "sg-7332cf0f")
|
||||||
|
useSpotInstances = true
|
||||||
|
instanceTags = mapOf(
|
||||||
|
"project" to "idea-vim"
|
||||||
|
)
|
||||||
|
source = Source("ami-07c529efaddafcf86")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
107
AUTHORS.md
107
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)
|
||||||
@@ -133,11 +165,11 @@ Contributors:
|
|||||||
|
|
||||||
Pavel Fatin
|
Pavel Fatin
|
||||||
* [![icon][mail]](mailto:tietyt@gmail.com)
|
* [![icon][mail]](mailto:tietyt@gmail.com)
|
||||||
[![icon][github-off]](#)
|
[![icon][github-off]](https://github.com/DanKaplanSES)
|
||||||
|
|
||||||
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,11 +181,11 @@ 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)
|
||||||
[![icon][github-off]](#)
|
[![icon][github-off]](https://github.com/lumie1337)
|
||||||
|
|
||||||
Florian Hassmann
|
Florian Hassmann
|
||||||
* [![icon][mail]](mailto:jpalus@fastmail.com)
|
* [![icon][mail]](mailto:jpalus@fastmail.com)
|
||||||
@@ -161,7 +193,7 @@ Contributors:
|
|||||||
|
|
||||||
Jan Palus
|
Jan Palus
|
||||||
* [![icon][mail]](mailto:kpetrov@ripe.net)
|
* [![icon][mail]](mailto:kpetrov@ripe.net)
|
||||||
[![icon][github-off]](#)
|
[![icon][github-off]](https://github.com/constpetrov)
|
||||||
|
|
||||||
Konstantin Petrov
|
Konstantin Petrov
|
||||||
* [![icon][mail]](mailto:ya-ikmik2012@yandex.ru)
|
* [![icon][mail]](mailto:ya-ikmik2012@yandex.ru)
|
||||||
@@ -188,12 +220,8 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/johngrib)
|
[![icon][github]](https://github.com/johngrib)
|
||||||
|
|
||||||
John Grib
|
John Grib
|
||||||
* [![icon][mail]](mailto:hild@b4mad.net)
|
|
||||||
[![icon][github-off]](#)
|
|
||||||
|
|
||||||
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 +236,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)
|
||||||
|
|
||||||
@@ -284,10 +315,6 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/angelbot)
|
[![icon][github]](https://github.com/angelbot)
|
||||||
|
|
||||||
John Weigel
|
John Weigel
|
||||||
* [![icon][mail]](mailto:kevinz@weghst.com)
|
|
||||||
[![icon][github]](https://github.com/kevin70)
|
|
||||||
|
|
||||||
kk
|
|
||||||
* [![icon][mail]](mailto:runforprogram@163.com)
|
* [![icon][mail]](mailto:runforprogram@163.com)
|
||||||
[![icon][github]](https://github.com/runforprogram)
|
[![icon][github]](https://github.com/runforprogram)
|
||||||
|
|
||||||
@@ -416,6 +443,30 @@ Contributors:
|
|||||||
[![icon][github]](https://github.com/Vvalter)
|
[![icon][github]](https://github.com/Vvalter)
|
||||||
|
|
||||||
Simon Rainer
|
Simon Rainer
|
||||||
|
* [![icon][mail]](mailto:filipp.vakhitov@jetbrains.com)
|
||||||
|
[![icon][github]](https://github.com/lippfi)
|
||||||
|
|
||||||
|
lippfi
|
||||||
|
* [![icon][mail]](mailto:3237686+Runinho@users.noreply.github.com)
|
||||||
|
[![icon][github]](https://github.com/Runinho)
|
||||||
|
|
||||||
|
Runinho
|
||||||
|
* [![icon][mail]](mailto:me@yuhaowen.com)
|
||||||
|
[![icon][github]](https://github.com/adaext)
|
||||||
|
|
||||||
|
Ada
|
||||||
|
|
||||||
|
Previous contributors:
|
||||||
|
|
||||||
|
* [![icon][mail]](mailto:hild@b4mad.net)
|
||||||
|
[![icon][github-off]](#)
|
||||||
|
|
||||||
|
Marcel Hild
|
||||||
|
* [![icon][mail]](mailto:kevinz@weghst.com)
|
||||||
|
[![icon][github]](https://github.com/kevin70)
|
||||||
|
|
||||||
|
kk
|
||||||
|
|
||||||
|
|
||||||
If you are a contributor and your name is not listed here, feel free to
|
If you are a contributor and your name is not listed here, feel free to
|
||||||
contact the maintainers.
|
contact the maintainers.
|
||||||
|
54
CHANGES.md
54
CHANGES.md
@@ -25,6 +25,47 @@ usual beta standards.
|
|||||||
|
|
||||||
## To Be Released
|
## To Be Released
|
||||||
|
|
||||||
|
### Features:
|
||||||
|
* Add IdeaVim tutor. You can access it via the status bar icon.
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* [VIM-2797](https://youtrack.jetbrains.com/issue/VIM-2797) Introduce variable to mute default argtextobj mappings
|
||||||
|
* [VIM-758](https://youtrack.jetbrains.com/issue/VIM-758) Support d mappings
|
||||||
|
* [VIM-2577](https://youtrack.jetbrains.com/issue/VIM-2577) Fix paste at the end of notebook cell
|
||||||
|
* [VIM-2813](https://youtrack.jetbrains.com/issue/VIM-2813) Migrate update checker to VimStandalonePluginUpdateChecker
|
||||||
|
|
||||||
|
### Merged PRs:
|
||||||
|
* [558](https://github.com/JetBrains/ideavim/pull/558) by [Matt Ellis](https://github.com/citizenmatt): Fix incorrect normalising for trailing inlay
|
||||||
|
* [554](https://github.com/JetBrains/ideavim/pull/554) by [Matt Ellis](https://github.com/citizenmatt): Refactor "last column" calculations
|
||||||
|
* [553](https://github.com/JetBrains/ideavim/pull/553) by [Matt Ellis](https://github.com/citizenmatt): Rearrange and rename some code in engine
|
||||||
|
* [560](https://github.com/JetBrains/ideavim/pull/560) by [Runinho](https://github.com/Runinho): Fix(VIM-2577) paste not working at end of notebook cell
|
||||||
|
* [571](https://github.com/JetBrains/ideavim/pull/571) by [Ada](https://github.com/adaext): Remove the redundant quotation mark at the end of "packadd matchit" command
|
||||||
|
* [561](https://github.com/JetBrains/ideavim/pull/561) by [Matt Ellis](https://github.com/citizenmatt): Fix incremental search not scrolling to current match
|
||||||
|
* [559](https://github.com/JetBrains/ideavim/pull/559) by [Runinho](https://github.com/Runinho): Fix(VIM-2760) notebookCommandMode detection
|
||||||
|
* [579](https://github.com/JetBrains/ideavim/pull/579) by [Martin Yzeiri](https://github.com/myzeiri): VIM-2799: Add Matchit support for cshtml files
|
||||||
|
|
||||||
|
## 2.0.0, 2022-11-01
|
||||||
|
|
||||||
|
### Changes:
|
||||||
|
* IdeaVim changes license from GPL-2.0 or later to MIT. [VIM-2782](https://youtrack.jetbrains.com/issue/VIM-2782)
|
||||||
|
|
||||||
|
## 1.12.0, 2022-11-01
|
||||||
|
|
||||||
|
### 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
|
||||||
|
* [VIM-2776](https://youtrack.jetbrains.com/issue/VIM-2776) Use filename index for file search
|
||||||
|
|
||||||
|
### Merged PRs:
|
||||||
|
* [550](https://github.com/JetBrains/ideavim/pull/550) by [Matt Ellis](https://github.com/citizenmatt): Fix(VIM-2778) Remove override of editor scroll setting
|
||||||
|
|
||||||
|
## 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`
|
||||||
@@ -36,6 +77,7 @@ usual beta standards.
|
|||||||
E.g. `<Plug>Commentary` instead of `<Plug>(CommentMotion)`. Old mappings are maintained for compatibility.
|
E.g. `<Plug>Commentary` instead of `<Plug>(CommentMotion)`. Old mappings are maintained for compatibility.
|
||||||
* If you open `~/.ideavimrc` in IDE, remove a mapping, and reload the config using the reload button,
|
* If you open `~/.ideavimrc` in IDE, remove a mapping, and reload the config using the reload button,
|
||||||
the mapping will actually be unmapped.
|
the mapping will actually be unmapped.
|
||||||
|
* New vim (and IdeaVim) behaviour: `ci(`& friends searches for the brackets in the line.
|
||||||
|
|
||||||
### Fixes:
|
### Fixes:
|
||||||
* [VIM-2587](https://youtrack.jetbrains.com/issue/VIM-2587) Use ctrl-6 as ctrl-^
|
* [VIM-2587](https://youtrack.jetbrains.com/issue/VIM-2587) Use ctrl-6 as ctrl-^
|
||||||
@@ -52,9 +94,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-2691](https://youtrack.jetbrains.com/issue/VIM-2691) Save file on :w
|
||||||
|
* [VIM-2710](https://youtrack.jetbrains.com/issue/VIM-2710) Show options value on `set opt`
|
||||||
|
* [VIM-913](https://youtrack.jetbrains.com/issue/VIM-913) Partially fix the issue with macros and autocompletion
|
||||||
|
* [VIM-2723](https://youtrack.jetbrains.com/issue/VIM-2723) Move focus to editor after :q
|
||||||
|
* [VIM-2728](https://youtrack.jetbrains.com/issue/VIM-2728) Give access to global variables
|
||||||
|
|
||||||
### Merged PRs:
|
### 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
|
||||||
@@ -63,6 +110,11 @@ usual beta standards.
|
|||||||
* [493](https://github.com/JetBrains/ideavim/pull/493) by [Matt Ellis](https://github.com/citizenmatt): Improvements to Commentary extension
|
* [493](https://github.com/JetBrains/ideavim/pull/493) by [Matt Ellis](https://github.com/citizenmatt): Improvements to Commentary extension
|
||||||
* [494](https://github.com/JetBrains/ideavim/pull/494) by [Matt Ellis](https://github.com/citizenmatt): Cleanup pre-212 CaretVisualAttributes compatibility code
|
* [494](https://github.com/JetBrains/ideavim/pull/494) by [Matt Ellis](https://github.com/citizenmatt): Cleanup pre-212 CaretVisualAttributes compatibility code
|
||||||
* [504](https://github.com/JetBrains/ideavim/pull/504) by [Matt Ellis](https://github.com/citizenmatt): Minor bug fixes
|
* [504](https://github.com/JetBrains/ideavim/pull/504) by [Matt Ellis](https://github.com/citizenmatt): Minor bug fixes
|
||||||
|
* [519](https://github.com/JetBrains/ideavim/pull/519) by [chylex](https://github.com/chylex): Fix(VIM-2227): Wrong behavior when deleting / changing surround with invalid character
|
||||||
|
* [525](https://github.com/JetBrains/ideavim/pull/525) by [Matt Ellis](https://github.com/citizenmatt): Improve handling of fractional width fonts
|
||||||
|
* [526](https://github.com/JetBrains/ideavim/pull/526) by [Alex Pláte](https://github.com/AlexPl292): Create gradle.properties
|
||||||
|
* [528](https://github.com/JetBrains/ideavim/pull/528) by [chylex](https://github.com/chylex): Implement partial code completion support in macros
|
||||||
|
* [531](https://github.com/JetBrains/ideavim/pull/531) by [Matt Ellis](https://github.com/citizenmatt): Consolidate doTest methods
|
||||||
|
|
||||||
## 1.10.0, 2022-02-17
|
## 1.10.0, 2022-02-17
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ IdeaVim is an open source project created by 80+ contributors. Would you like to
|
|||||||
This page is created to help you start contributing. And who knows, maybe in a few days this project will be brighter than ever!
|
This page is created to help you start contributing. And who knows, maybe in a few days this project will be brighter than ever!
|
||||||
|
|
||||||
:warning: The plugin is currently under a huge refactoring aiming to split into vim-engine and IdeaVim in order to
|
:warning: The plugin is currently under a huge refactoring aiming to split into vim-engine and IdeaVim in order to
|
||||||
support the new [Fleet IDE](https://www.jetbrains.com/fleet/).
|
support the new [Fleet IDE](https://www.jetbrains.com/fleet/). Please see [Fleet refactoring](#Fleet-refactoring).
|
||||||
|
|
||||||
## Before you begin
|
## Before you begin
|
||||||
|
|
||||||
@@ -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:
|
||||||
|
|
||||||
@@ -120,6 +120,17 @@ so you can reuse your `.vimrc` settings.
|
|||||||
We also support proper command mappings (functions are mapped to `<Plug>...`), the operator function (`OperatorFunction`), and so on.
|
We also support proper command mappings (functions are mapped to `<Plug>...`), the operator function (`OperatorFunction`), and so on.
|
||||||
- Magic is supported as well. See `Magic`.
|
- Magic is supported as well. See `Magic`.
|
||||||
|
|
||||||
|
|
||||||
|
## Fleet refactoring
|
||||||
|
At the moment, IdeaVim is under an active refactoring aiming to split IdeaVim into two modules: vim-engine and IdeaVim.
|
||||||
|
|
||||||
|
If you develop a plugin that depends on IdeaVim: We have an instrument to check that our changes don't affect
|
||||||
|
the plugins in the marketplace. Also, we commit to support currently used API at least till the end of 2022.
|
||||||
|
If you still encounter any issues with the newer versions of IdeaVim, please [contact maintainers](https://github.com/JetBrains/ideavim#contact-maintainers).
|
||||||
|
We kindly ask you not to use anything from the new API (like `VimEditor`, `injector`) because at the moment we don't
|
||||||
|
guarantee the compatibility of this API in the future versions.
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
### I read the whole page but something is still unclear.
|
### I read the whole page but something is still unclear.
|
||||||
|
352
LICENSE.txt
352
LICENSE.txt
@@ -1,339 +1,21 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
MIT License
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
Copyright (c) 2003-present The IdeaVim authors
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The above copyright notice and this permission notice shall be included in all
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
copies or substantial portions of the Software.
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Lesser General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
have the freedom to distribute copies of free software (and charge for
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
this service if you wish), that you receive source code or can get it
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
if you want it, that you can change the software or use pieces of it
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
in new free programs; and that you know you can do these things.
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
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, write to the Free Software Foundation, Inc.,
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) year name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License.
|
|
||||||
|
26
README.md
26
README.md
@@ -9,9 +9,10 @@ IdeaVim
|
|||||||
[![Rating][plugin-rating-svg]][plugin-repo]
|
[![Rating][plugin-rating-svg]][plugin-repo]
|
||||||
[![Version][plugin-version-svg]][plugin-repo]
|
[![Version][plugin-version-svg]][plugin-repo]
|
||||||
[![Gitter][gitter-svg]][gitter]
|
[![Gitter][gitter-svg]][gitter]
|
||||||
|
[](https://codecov.io/gh/JetBrains/ideavim)
|
||||||
[![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 +37,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 +89,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/IdeaVim-Plugins):
|
||||||
|
|
||||||
* vim-easymotion
|
* vim-easymotion
|
||||||
* NERDTree
|
* NERDTree
|
||||||
@@ -103,6 +104,7 @@ Here are some examples of supported vim features and commands:
|
|||||||
* vim-paragraph-motion
|
* vim-paragraph-motion
|
||||||
* vim-indent-object
|
* vim-indent-object
|
||||||
* match.it
|
* match.it
|
||||||
|
etc
|
||||||
|
|
||||||
See also:
|
See also:
|
||||||
|
|
||||||
@@ -198,10 +200,10 @@ 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/IdeaVim-Plugins)
|
||||||
|
|
||||||
Executing IDE Actions
|
Executing IDE Actions
|
||||||
---------------------
|
---------------------
|
||||||
@@ -226,7 +228,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>
|
||||||
|
|
||||||
|
|
||||||
@@ -361,8 +366,13 @@ is the full list of synonyms.
|
|||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
IdeaVim is licensed under the terms of the GNU Public License version 2
|
IdeaVim is licensed under the MIT license.
|
||||||
or any later version.
|
|
||||||
|
Third-party components and licenses are listed in [ThirdPartyLicenses.md](ThirdPartyLicenses.md).
|
||||||
|
|
||||||
|
All releases before 2.0.0 were licensed under terms of GPL-2.0 or later.
|
||||||
|
The last commit before switch to MIT is 05852b07c6090ad40fde7d3cafe0b074604f7ac5.
|
||||||
|
You can read more about the license change here: https://github.com/JetBrains/ideavim/discussions/543
|
||||||
|
|
||||||
|
|
||||||
<!-- Badges -->
|
<!-- Badges -->
|
||||||
|
85
ThirdPartyLicenses.md
Normal file
85
ThirdPartyLicenses.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
IdeaVim project is licensed under MIT license except the following parts of it:
|
||||||
|
|
||||||
|
File [RegExp.kt](src/main/java/com/maddyhome/idea/vim/regexp/RegExp.kt) is licensed under Vim License.
|
||||||
|
File [Tutor.kt](src/main/java/com/maddyhome/idea/vim/ui/Tutor.kt) is licensed under Vim License.
|
||||||
|
|
||||||
|
```
|
||||||
|
VIM LICENSE
|
||||||
|
|
||||||
|
I) There are no restrictions on distributing unmodified copies of Vim except
|
||||||
|
that they must include this license text. You can also distribute
|
||||||
|
unmodified parts of Vim, likewise unrestricted except that they must
|
||||||
|
include this license text. You are also allowed to include executables
|
||||||
|
that you made from the unmodified Vim sources, plus your own usage
|
||||||
|
examples and Vim scripts.
|
||||||
|
|
||||||
|
II) It is allowed to distribute a modified (or extended) version of Vim,
|
||||||
|
including executables and/or source code, when the following four
|
||||||
|
conditions are met:
|
||||||
|
1) This license text must be included unmodified.
|
||||||
|
2) The modified Vim must be distributed in one of the following five ways:
|
||||||
|
a) If you make changes to Vim yourself, you must clearly describe in
|
||||||
|
the distribution how to contact you. When the maintainer asks you
|
||||||
|
(in any way) for a copy of the modified Vim you distributed, you
|
||||||
|
must make your changes, including source code, available to the
|
||||||
|
maintainer without fee. The maintainer reserves the right to
|
||||||
|
include your changes in the official version of Vim. What the
|
||||||
|
maintainer will do with your changes and under what license they
|
||||||
|
will be distributed is negotiable. If there has been no negotiation
|
||||||
|
then this license, or a later version, also applies to your changes.
|
||||||
|
The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
|
||||||
|
changes it will be announced in appropriate places (most likely
|
||||||
|
vim.sf.net, www.vim.org and/or comp.editors). When it is completely
|
||||||
|
impossible to contact the maintainer, the obligation to send him
|
||||||
|
your changes ceases. Once the maintainer has confirmed that he has
|
||||||
|
received your changes they will not have to be sent again.
|
||||||
|
b) If you have received a modified Vim that was distributed as
|
||||||
|
mentioned under a) you are allowed to further distribute it
|
||||||
|
unmodified, as mentioned at I). If you make additional changes the
|
||||||
|
text under a) applies to those changes.
|
||||||
|
c) Provide all the changes, including source code, with every copy of
|
||||||
|
the modified Vim you distribute. This may be done in the form of a
|
||||||
|
context diff. You can choose what license to use for new code you
|
||||||
|
add. The changes and their license must not restrict others from
|
||||||
|
making their own changes to the official version of Vim.
|
||||||
|
d) When you have a modified Vim which includes changes as mentioned
|
||||||
|
under c), you can distribute it without the source code for the
|
||||||
|
changes if the following three conditions are met:
|
||||||
|
- The license that applies to the changes permits you to distribute
|
||||||
|
the changes to the Vim maintainer without fee or restriction, and
|
||||||
|
permits the Vim maintainer to include the changes in the official
|
||||||
|
version of Vim without fee or restriction.
|
||||||
|
- You keep the changes for at least three years after last
|
||||||
|
distributing the corresponding modified Vim. When the maintainer
|
||||||
|
or someone who you distributed the modified Vim to asks you (in
|
||||||
|
any way) for the changes within this period, you must make them
|
||||||
|
available to him.
|
||||||
|
- You clearly describe in the distribution how to contact you. This
|
||||||
|
contact information must remain valid for at least three years
|
||||||
|
after last distributing the corresponding modified Vim, or as long
|
||||||
|
as possible.
|
||||||
|
e) When the GNU General Public License (GPL) applies to the changes,
|
||||||
|
you can distribute the modified Vim under the GNU GPL version 2 or
|
||||||
|
any later version.
|
||||||
|
3) A message must be added, at least in the output of the ":version"
|
||||||
|
command and in the intro screen, such that the user of the modified Vim
|
||||||
|
is able to see that it was modified. When distributing as mentioned
|
||||||
|
under 2)e) adding the message is only required for as far as this does
|
||||||
|
not conflict with the license used for the changes.
|
||||||
|
4) The contact information as required under 2)a) and 2)d) must not be
|
||||||
|
removed or changed, except that the person himself can make
|
||||||
|
corrections.
|
||||||
|
|
||||||
|
III) If you distribute a modified version of Vim, you are encouraged to use
|
||||||
|
the Vim license for your changes and make them available to the
|
||||||
|
maintainer, including the source code. The preferred way to do this is
|
||||||
|
by e-mail or by uploading the files to a server and e-mailing the URL.
|
||||||
|
If the number of changes is small (e.g., a modified Makefile) e-mailing a
|
||||||
|
context diff will do. The e-mail address to be used is
|
||||||
|
<maintainer@vim.org>
|
||||||
|
|
||||||
|
IV) It is not allowed to remove this license from the distribution of the Vim
|
||||||
|
sources, parts of it or from a modified version. You may use this
|
||||||
|
license for previous Vim releases instead of the license that they came
|
||||||
|
with, at your option.
|
||||||
|
```
|
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 |
456
build.gradle.kts
456
build.gradle.kts
@@ -1,5 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
import dev.feedforward.markdownto.DownParser
|
import dev.feedforward.markdownto.DownParser
|
||||||
|
import io.ktor.client.*
|
||||||
|
import io.ktor.client.call.*
|
||||||
|
import io.ktor.client.engine.cio.*
|
||||||
|
import io.ktor.client.plugins.auth.*
|
||||||
|
import io.ktor.client.plugins.auth.providers.*
|
||||||
|
import io.ktor.client.plugins.contentnegotiation.*
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.http.*
|
||||||
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
import kotlinx.serialization.json.JsonArray
|
||||||
|
import kotlinx.serialization.json.JsonObject
|
||||||
|
import kotlinx.serialization.json.addJsonObject
|
||||||
|
import kotlinx.serialization.json.buildJsonObject
|
||||||
|
import kotlinx.serialization.json.jsonArray
|
||||||
|
import kotlinx.serialization.json.jsonObject
|
||||||
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
|
import kotlinx.serialization.json.put
|
||||||
|
import kotlinx.serialization.json.putJsonArray
|
||||||
|
import kotlinx.serialization.json.putJsonObject
|
||||||
|
import org.eclipse.jgit.api.Git
|
||||||
|
import org.eclipse.jgit.lib.RepositoryBuilder
|
||||||
import org.intellij.markdown.ast.getTextInNode
|
import org.intellij.markdown.ast.getTextInNode
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
@@ -11,24 +41,36 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
|
||||||
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")
|
|
||||||
|
classpath("io.ktor:ktor-client-core:2.1.3")
|
||||||
|
classpath("io.ktor:ktor-client-cio:2.1.3")
|
||||||
|
classpath("io.ktor:ktor-client-auth:2.1.3")
|
||||||
|
classpath("io.ktor:ktor-client-content-negotiation:2.1.3")
|
||||||
|
classpath("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
|
||||||
|
|
||||||
|
// This comes from the changelog plugin
|
||||||
|
// classpath("org.jetbrains:markdown:0.3.1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
antlr
|
antlr
|
||||||
java
|
java
|
||||||
kotlin("jvm") version "1.6.21"
|
kotlin("jvm") version "1.7.20"
|
||||||
|
application
|
||||||
|
|
||||||
id("org.jetbrains.intellij") version "1.6.0"
|
id("org.jetbrains.intellij") version "1.11.1-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
|
||||||
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
|
id("org.jlleitschuh.gradle.ktlint") version "10.3.0"
|
||||||
|
|
||||||
|
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||||
|
id("com.dorongold.task-tree") version "2.1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import variables from gradle.properties file
|
// Import variables from gradle.properties file
|
||||||
@@ -44,6 +86,7 @@ val publishChannels: String by project
|
|||||||
val publishToken: String by project
|
val publishToken: String by project
|
||||||
|
|
||||||
val slackUrl: String by project
|
val slackUrl: String by project
|
||||||
|
val youtrackToken: String by project
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -70,7 +113,9 @@ dependencies {
|
|||||||
runtimeOnly("org.antlr:antlr4-runtime:$antlrVersion")
|
runtimeOnly("org.antlr:antlr4-runtime:$antlrVersion")
|
||||||
antlr("org.antlr:antlr4:$antlrVersion")
|
antlr("org.antlr:antlr4:$antlrVersion")
|
||||||
|
|
||||||
implementation(project(":vim-engine"))
|
api(project(":vim-engine"))
|
||||||
|
|
||||||
|
testApi("com.squareup.okhttp3:okhttp:4.10.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -85,6 +130,8 @@ tasks.register<Test>("testWithNeovim") {
|
|||||||
group = "verification"
|
group = "verification"
|
||||||
systemProperty("ideavim.nvim.test", "true")
|
systemProperty("ideavim.nvim.test", "true")
|
||||||
exclude("/ui/**")
|
exclude("/ui/**")
|
||||||
|
exclude("**/longrunning/**")
|
||||||
|
exclude("**/propertybased/**")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Test>("testPropertyBased") {
|
tasks.register<Test>("testPropertyBased") {
|
||||||
@@ -115,6 +162,8 @@ tasks {
|
|||||||
include("**/*test.class")
|
include("**/*test.class")
|
||||||
include("**/*Tests.class")
|
include("**/*Tests.class")
|
||||||
exclude("**/ParserTest.class")
|
exclude("**/ParserTest.class")
|
||||||
|
exclude("**/longrunning/**")
|
||||||
|
exclude("**/propertybased/**")
|
||||||
}
|
}
|
||||||
|
|
||||||
val testPropertyBased by getting(Test::class) {
|
val testPropertyBased by getting(Test::class) {
|
||||||
@@ -144,19 +193,32 @@ tasks {
|
|||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = javaVersion
|
jvmTarget = javaVersion
|
||||||
apiVersion = "1.5"
|
apiVersion = "1.6"
|
||||||
|
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
|
||||||
// allWarningsAsErrors = true
|
// allWarningsAsErrors = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = javaVersion
|
jvmTarget = javaVersion
|
||||||
apiVersion = "1.5"
|
apiVersion = "1.6"
|
||||||
// allWarningsAsErrors = true
|
// allWarningsAsErrors = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
gradle.projectsEvaluated {
|
||||||
tasks.compileJava {
|
tasks.compileJava {
|
||||||
// options.compilerArgs.add("-Werror")
|
// options.compilerArgs.add("-Werror")
|
||||||
@@ -199,7 +261,7 @@ tasks {
|
|||||||
runPluginVerifier {
|
runPluginVerifier {
|
||||||
downloadDir.set("${project.buildDir}/pluginVerifier/ides")
|
downloadDir.set("${project.buildDir}/pluginVerifier/ides")
|
||||||
teamCityOutputFormat.set(true)
|
teamCityOutputFormat.set(true)
|
||||||
ideVersions.set(listOf("IC-2021.3.4"))
|
// ideVersions.set(listOf("IC-2021.3.4"))
|
||||||
}
|
}
|
||||||
|
|
||||||
generateGrammarSource {
|
generateGrammarSource {
|
||||||
@@ -211,12 +273,41 @@ tasks {
|
|||||||
named("compileKotlin") {
|
named("compileKotlin") {
|
||||||
dependsOn("generateGrammarSource")
|
dependsOn("generateGrammarSource")
|
||||||
}
|
}
|
||||||
|
named("compileTestKotlin") {
|
||||||
|
dependsOn("generateTestGrammarSource")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add plugin open API sources to the plugin ZIP
|
||||||
|
val createOpenApiSourceJar by registering(Jar::class) {
|
||||||
|
dependsOn("generateGrammarSource")
|
||||||
|
// Java sources
|
||||||
|
from(sourceSets.main.get().java) {
|
||||||
|
include("**/com/maddyhome/idea/vim/**/*.java")
|
||||||
|
}
|
||||||
|
// Kotlin sources
|
||||||
|
from(kotlin.sourceSets.main.get().kotlin) {
|
||||||
|
include("**/com/maddyhome/idea/vim/**/*.kt")
|
||||||
|
}
|
||||||
|
destinationDirectory.set(layout.buildDirectory.dir("libs"))
|
||||||
|
archiveClassifier.set("src")
|
||||||
|
}
|
||||||
|
|
||||||
|
buildPlugin {
|
||||||
|
dependsOn(createOpenApiSourceJar)
|
||||||
|
from(createOpenApiSourceJar) { into("lib/src") }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't forget to update plugin.xml
|
||||||
|
patchPluginXml {
|
||||||
|
sinceBuild.set("223.7401.7")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Linting
|
// --- Linting
|
||||||
|
|
||||||
ktlint {
|
ktlint {
|
||||||
disabledRules.add("no-wildcard-imports")
|
disabledRules.add("no-wildcard-imports")
|
||||||
|
version.set("0.43.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Tests
|
// --- Tests
|
||||||
@@ -241,7 +332,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"
|
||||||
}
|
}
|
||||||
@@ -254,6 +345,22 @@ tasks.register("getUnreleasedChangelog") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Kover
|
||||||
|
|
||||||
|
koverMerged {
|
||||||
|
enable()
|
||||||
|
}
|
||||||
|
|
||||||
|
kover {
|
||||||
|
instrumentation {
|
||||||
|
// set of test tasks names to exclude from instrumentation. The results of their execution will not be presented in the report
|
||||||
|
excludeTasks += "testPropertyBased"
|
||||||
|
excludeTasks += "testLongRunning"
|
||||||
|
excludeTasks += "testWithNeovim"
|
||||||
|
excludeTasks += "testUi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- Slack notification
|
// --- Slack notification
|
||||||
|
|
||||||
tasks.register("slackNotification") {
|
tasks.register("slackNotification") {
|
||||||
@@ -294,20 +401,31 @@ 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(
|
||||||
"aleksei.plate@jetbrains.com",
|
"aleksei.plate@jetbrains.com",
|
||||||
"aleksei.plate@teamcity",
|
"aleksei.plate@teamcity",
|
||||||
"aleksei.plate@TeamCity",
|
"aleksei.plate@TeamCity",
|
||||||
"alex.plate@192.168.0.109"
|
"alex.plate@192.168.0.109",
|
||||||
|
"nikita.koshcheev@TeamCity",
|
||||||
|
"TeamCity@TeamCity",
|
||||||
)
|
)
|
||||||
updateAuthors(uncheckedEmails)
|
updateAuthors(uncheckedEmails)
|
||||||
}
|
}
|
||||||
@@ -318,6 +436,7 @@ val prId: String by project
|
|||||||
tasks.register("updateMergedPr") {
|
tasks.register("updateMergedPr") {
|
||||||
doLast {
|
doLast {
|
||||||
if (project.hasProperty("prId")) {
|
if (project.hasProperty("prId")) {
|
||||||
|
println("Got pr id: $prId")
|
||||||
updateMergedPr(prId.toInt())
|
updateMergedPr(prId.toInt())
|
||||||
} else {
|
} else {
|
||||||
error("Cannot get prId")
|
error("Cannot get prId")
|
||||||
@@ -331,6 +450,82 @@ tasks.register("updateChangelog") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("updateYoutrackOnCommit") {
|
||||||
|
doLast {
|
||||||
|
updateYoutrackOnCommit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val vimProjectId = "22-43"
|
||||||
|
val fixVersionsFieldId = "123-285"
|
||||||
|
val fixVersionsFieldType = "VersionProjectCustomField"
|
||||||
|
val fixVersionsElementType = "VersionBundleElement"
|
||||||
|
|
||||||
|
tasks.register("releaseActions") {
|
||||||
|
group = "other"
|
||||||
|
doLast {
|
||||||
|
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D")
|
||||||
|
if (tickets.isNotEmpty()) {
|
||||||
|
println("Updating statuses for tickets: $tickets")
|
||||||
|
setYoutrackStatus(tickets, "Fixed")
|
||||||
|
if (!checkReleaseVersionExists(version.toString())) {
|
||||||
|
addReleaseToYoutrack(version.toString())
|
||||||
|
} else {
|
||||||
|
println("Version $version is already exists in YouTrack")
|
||||||
|
}
|
||||||
|
setYoutrackFixVersion(tickets, version.toString())
|
||||||
|
} else {
|
||||||
|
println("No tickets to update statuses")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("integrationsTest") {
|
||||||
|
group = "other"
|
||||||
|
doLast {
|
||||||
|
val testTicketId = "VIM-2784"
|
||||||
|
|
||||||
|
// YouTrack set to Ready To Release on Fix commit
|
||||||
|
setYoutrackStatus(listOf(testTicketId), "Ready To Release")
|
||||||
|
if ("Ready To Release" != getYoutrackStatus(testTicketId)) {
|
||||||
|
error("Ticket status was not updated")
|
||||||
|
}
|
||||||
|
setYoutrackStatus(listOf(testTicketId), "Open")
|
||||||
|
|
||||||
|
// Check YouTrack requests
|
||||||
|
val prevStatus = getYoutrackStatus(testTicketId)
|
||||||
|
setYoutrackStatus(listOf(testTicketId), "Ready To Release")
|
||||||
|
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D")
|
||||||
|
if (testTicketId !in tickets) {
|
||||||
|
error("Test ticket is not found in request")
|
||||||
|
}
|
||||||
|
setYoutrackStatus(listOf(testTicketId), prevStatus)
|
||||||
|
|
||||||
|
// Check adding and removing release
|
||||||
|
guard(!checkReleaseVersionExists("TEST_VERSION")) { "Test version already exists" }
|
||||||
|
val versionId = addReleaseToYoutrack("TEST_VERSION")
|
||||||
|
guard(checkReleaseVersionExists("TEST_VERSION")) { "Test version isn't created" }
|
||||||
|
setYoutrackStatus(listOf(testTicketId), "Fixed")
|
||||||
|
setYoutrackFixVersion(listOf(testTicketId), "TEST_VERSION")
|
||||||
|
deleteVersionById(versionId)
|
||||||
|
setYoutrackStatus(listOf(testTicketId), "Open")
|
||||||
|
guard(!checkReleaseVersionExists("TEST_VERSION")) { "Test version isn't deleted" }
|
||||||
|
|
||||||
|
updateMergedPr(525)
|
||||||
|
// TODO: test Ticket parsing
|
||||||
|
// TODO: test Update CHANGES
|
||||||
|
// TODO: test Update AUTHORS
|
||||||
|
// TODO: test Slack notification
|
||||||
|
// TODO: Add a comment on EAP release
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun guard(check: Boolean, ifWrong: () -> String) {
|
||||||
|
if (!check) {
|
||||||
|
error(ifWrong())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register("testUpdateChangelog") {
|
tasks.register("testUpdateChangelog") {
|
||||||
group = "verification"
|
group = "verification"
|
||||||
description = "This is a task to manually assert the correctness of the update tasks"
|
description = "This is a task to manually assert the correctness of the update tasks"
|
||||||
@@ -347,37 +542,152 @@ tasks.register("testUpdateChangelog") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addReleaseToYoutrack(name: String): String {
|
||||||
|
val client = httpClient()
|
||||||
|
println("Creating new release version in YouTrack: $name")
|
||||||
|
|
||||||
|
return runBlocking {
|
||||||
|
val response = client.post("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name") {
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
accept(ContentType.Application.Json)
|
||||||
|
val request = buildJsonObject {
|
||||||
|
put("name", name)
|
||||||
|
put("\$type", fixVersionsElementType)
|
||||||
|
}
|
||||||
|
setBody(request)
|
||||||
|
}
|
||||||
|
response.body<JsonObject>().getValue("id").jsonPrimitive.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkReleaseVersionExists(name: String): Boolean {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
return runBlocking {
|
||||||
|
val response = client.get("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name&query=$name")
|
||||||
|
response.body<JsonArray>().isNotEmpty()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteVersionById(id: String) {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
client.delete("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values/$id")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateYoutrackOnCommit() {
|
||||||
|
println("Start updating youtrack")
|
||||||
|
println(projectDir)
|
||||||
|
|
||||||
|
val newFixes = changes()
|
||||||
|
val newTickets = newFixes.map { it.id }
|
||||||
|
println("Set new status for $newTickets")
|
||||||
|
setYoutrackStatus(newTickets, "Ready To Release")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getYoutrackTicketsByQuery(query: String): Set<String> {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
return runBlocking {
|
||||||
|
val response = client.get("https://youtrack.jetbrains.com/api/issues/?fields=idReadable&query=project:VIM+$query")
|
||||||
|
response.body<JsonArray>().mapTo(HashSet()) { it.jsonObject.getValue("idReadable").jsonPrimitive.content }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setYoutrackStatus(tickets: Collection<String>, status: String) {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
for (ticket in tickets) {
|
||||||
|
println("Try to set $ticket to $status")
|
||||||
|
val response = client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
accept(ContentType.Application.Json)
|
||||||
|
val request = buildJsonObject {
|
||||||
|
putJsonArray("customFields") {
|
||||||
|
addJsonObject {
|
||||||
|
put("name", "State")
|
||||||
|
put("\$type", "SingleEnumIssueCustomField")
|
||||||
|
putJsonObject("value") {
|
||||||
|
put("name", status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setBody(request)
|
||||||
|
}
|
||||||
|
println(response)
|
||||||
|
println(response.body<String>())
|
||||||
|
if (!response.status.isSuccess()) {
|
||||||
|
error("Request failed. $ticket, ${response.body<String>()}")
|
||||||
|
}
|
||||||
|
val finalState = response.body<JsonObject>()["customFields"]!!.jsonArray
|
||||||
|
.single { it.jsonObject["name"]!!.jsonPrimitive.content == "State" }
|
||||||
|
.jsonObject["value"]!!
|
||||||
|
.jsonObject["name"]!!
|
||||||
|
.jsonPrimitive.content
|
||||||
|
if (finalState != status) {
|
||||||
|
error("Ticket $ticket is not updated! Expected status $status, but actually $finalState")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setYoutrackFixVersion(tickets: Collection<String>, version: String) {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
for (ticket in tickets) {
|
||||||
|
println("Try to set fix version $version for $ticket")
|
||||||
|
val response = client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||||
|
contentType(ContentType.Application.Json)
|
||||||
|
accept(ContentType.Application.Json)
|
||||||
|
val request = buildJsonObject {
|
||||||
|
putJsonArray("customFields") {
|
||||||
|
addJsonObject {
|
||||||
|
put("name", "Fix versions")
|
||||||
|
put("\$type", "MultiVersionIssueCustomField")
|
||||||
|
putJsonArray("value") {
|
||||||
|
addJsonObject { put("name", version) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setBody(request)
|
||||||
|
}
|
||||||
|
println(response)
|
||||||
|
println(response.body<String>())
|
||||||
|
if (!response.status.isSuccess()) {
|
||||||
|
error("Request failed. $ticket, ${response.body<String>()}")
|
||||||
|
}
|
||||||
|
val finalState = response.body<JsonObject>()["customFields"]!!.jsonArray
|
||||||
|
.single { it.jsonObject["name"]!!.jsonPrimitive.content == "Fix versions" }
|
||||||
|
.jsonObject["value"]!!
|
||||||
|
.jsonArray[0]
|
||||||
|
.jsonObject["name"]!!
|
||||||
|
.jsonPrimitive.content
|
||||||
|
if (finalState != version) {
|
||||||
|
error("Ticket $ticket is not updated! Expected fix version $version, but actually $finalState")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getYoutrackStatus(ticket: String): String {
|
||||||
|
val client = httpClient()
|
||||||
|
|
||||||
|
return runBlocking {
|
||||||
|
val response = client.get("https://youtrack.jetbrains.com/api/issues/$ticket/customFields/123-129?fields=value(name)")
|
||||||
|
response.body<JsonObject>()["value"]!!.jsonObject.getValue("name").jsonPrimitive.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun updateChangelog() {
|
fun updateChangelog() {
|
||||||
println("Start update authors")
|
println("Start update authors")
|
||||||
println(projectDir)
|
println(projectDir)
|
||||||
val repository = org.eclipse.jgit.lib.RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
|
val newFixes = changes()
|
||||||
val git = org.eclipse.jgit.api.Git(repository)
|
|
||||||
val lastSuccessfulCommit = System.getenv("SUCCESS_COMMIT")!!
|
|
||||||
val messages = git.log().call()
|
|
||||||
.takeWhile {
|
|
||||||
!it.id.name.equals(lastSuccessfulCommit, ignoreCase = true)
|
|
||||||
}
|
|
||||||
.map { it.shortMessage }
|
|
||||||
|
|
||||||
// Collect fixes
|
|
||||||
val newFixes = mutableListOf<Change>()
|
|
||||||
println("Last successful commit: $lastSuccessfulCommit")
|
|
||||||
println("Amount of commits: ${messages.size}")
|
|
||||||
println("Start emails processing")
|
|
||||||
for (message in messages) {
|
|
||||||
println("Processing '$message'...")
|
|
||||||
val lowercaseMessage = message.toLowerCase()
|
|
||||||
val regex = "^fix\\((vim-\\d+)\\):".toRegex()
|
|
||||||
val findResult = regex.find(lowercaseMessage)
|
|
||||||
if (findResult != null) {
|
|
||||||
println("Message matches")
|
|
||||||
val value = findResult.groups[1]!!.value.toUpperCase()
|
|
||||||
val shortMessage = message.drop(findResult.range.last + 1).trim()
|
|
||||||
newFixes += Change(value, shortMessage)
|
|
||||||
} else {
|
|
||||||
println("Message doesn't match")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update changes file
|
// Update changes file
|
||||||
val changesFile = File("$projectDir/CHANGES.md")
|
val changesFile = File("$projectDir/CHANGES.md")
|
||||||
@@ -403,8 +713,8 @@ fun updateChangelog() {
|
|||||||
fun updateAuthors(uncheckedEmails: Set<String>) {
|
fun updateAuthors(uncheckedEmails: Set<String>) {
|
||||||
println("Start update authors")
|
println("Start update authors")
|
||||||
println(projectDir)
|
println(projectDir)
|
||||||
val repository = org.eclipse.jgit.lib.RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
|
val repository = RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
|
||||||
val git = org.eclipse.jgit.api.Git(repository)
|
val git = Git(repository)
|
||||||
val lastSuccessfulCommit = System.getenv("SUCCESS_COMMIT")!!
|
val lastSuccessfulCommit = System.getenv("SUCCESS_COMMIT")!!
|
||||||
val hashesAndEmailes = git.log().call()
|
val hashesAndEmailes = git.log().call()
|
||||||
.takeWhile {
|
.takeWhile {
|
||||||
@@ -480,8 +790,12 @@ data class Author(val name: String, val url: String, val mail: String)
|
|||||||
data class Change(val id: String, val text: String)
|
data class Change(val id: String, val text: String)
|
||||||
|
|
||||||
fun updateMergedPr(number: Int) {
|
fun updateMergedPr(number: Int) {
|
||||||
val gitHub = org.kohsuke.github.GitHub.connect()
|
val token = System.getenv("GITHUB_OAUTH")
|
||||||
|
println("Token size: ${token.length}")
|
||||||
|
val gitHub = org.kohsuke.github.GitHubBuilder().withOAuthToken(token).build()
|
||||||
|
println("Connecting to the repo...")
|
||||||
val repository = gitHub.getRepository("JetBrains/ideavim")
|
val repository = gitHub.getRepository("JetBrains/ideavim")
|
||||||
|
println("Getting pull requests...")
|
||||||
val pullRequest = repository.getPullRequest(number)
|
val pullRequest = repository.getPullRequest(number)
|
||||||
if (pullRequest.user.login == "dependabot[bot]") return
|
if (pullRequest.user.login == "dependabot[bot]") return
|
||||||
|
|
||||||
@@ -495,7 +809,7 @@ fun updateMergedPr(number: Int) {
|
|||||||
if (pullRequest.user.login == "dependabot[bot]") return
|
if (pullRequest.user.login == "dependabot[bot]") return
|
||||||
|
|
||||||
val prNumber = pullRequest.number
|
val prNumber = pullRequest.number
|
||||||
val userName = pullRequest.user.name
|
val userName = pullRequest.user.name ?: pullRequest.user.login
|
||||||
val login = pullRequest.user.login
|
val login = pullRequest.user.login
|
||||||
val title = pullRequest.title
|
val title = pullRequest.title
|
||||||
val section =
|
val section =
|
||||||
@@ -573,3 +887,57 @@ val sections = listOf(
|
|||||||
"### Fixes:",
|
"### Fixes:",
|
||||||
"### Merged PRs:",
|
"### Merged PRs:",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun changes(): List<Change> {
|
||||||
|
val repository = RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
|
||||||
|
val git = Git(repository)
|
||||||
|
val lastSuccessfulCommit = System.getenv("SUCCESS_COMMIT")!!
|
||||||
|
val messages = git.log().call()
|
||||||
|
.takeWhile {
|
||||||
|
!it.id.name.equals(lastSuccessfulCommit, ignoreCase = true)
|
||||||
|
}
|
||||||
|
.map { it.shortMessage }
|
||||||
|
|
||||||
|
// Collect fixes
|
||||||
|
val newFixes = mutableListOf<Change>()
|
||||||
|
println("Last successful commit: $lastSuccessfulCommit")
|
||||||
|
println("Amount of commits: ${messages.size}")
|
||||||
|
println("Start emails processing")
|
||||||
|
for (message in messages) {
|
||||||
|
println("Processing '$message'...")
|
||||||
|
val lowercaseMessage = message.toLowerCase()
|
||||||
|
val regex = "^fix\\((vim-\\d+)\\):".toRegex()
|
||||||
|
val findResult = regex.find(lowercaseMessage)
|
||||||
|
if (findResult != null) {
|
||||||
|
println("Message matches")
|
||||||
|
val value = findResult.groups[1]!!.value.toUpperCase()
|
||||||
|
val shortMessage = message.drop(findResult.range.last + 1).trim()
|
||||||
|
newFixes += Change(value, shortMessage)
|
||||||
|
} else {
|
||||||
|
println("Message doesn't match")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newFixes
|
||||||
|
}
|
||||||
|
|
||||||
|
fun httpClient(): HttpClient {
|
||||||
|
return HttpClient(CIO) {
|
||||||
|
expectSuccess = true
|
||||||
|
install(Auth) {
|
||||||
|
bearer {
|
||||||
|
loadTokens {
|
||||||
|
val accessToken = youtrackToken.ifBlank { System.getenv("YOUTRACK_TOKEN")!! }
|
||||||
|
BearerTokens(accessToken, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
install(ContentNegotiation) {
|
||||||
|
json(
|
||||||
|
Json {
|
||||||
|
prettyPrint = true
|
||||||
|
isLenient = true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,248 +0,0 @@
|
|||||||
Emulated Vim Plugins
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
IdeaVim extensions emulate plugins of the original Vim. In order to use
|
|
||||||
IdeaVim extensions, you have to enable them via this command in your `~/.ideavimrc`:
|
|
||||||
|
|
||||||
```
|
|
||||||
Plug '<extension-github-reference>'
|
|
||||||
```
|
|
||||||
|
|
||||||
If you reuse your existing `.vimrc` file using `source ~/.vimrc`, IdeaVim can parse and enable plugins that are defined
|
|
||||||
using [vim-plug](https://github.com/junegunn/vim-plug) or [vundle](https://github.com/VundleVim/Vundle.vim).
|
|
||||||
No additional set commands in `~/.ideavimrc` are required.
|
|
||||||
If you'd like to disable some plugin that's enabled in `.vimrc`, you can use `set no<extension-name>`
|
|
||||||
in `~/.ideavimrc`. E.g. `set nosurround`.
|
|
||||||
|
|
||||||
Available extensions:
|
|
||||||
|
|
||||||
## easymotion
|
|
||||||
|
|
||||||
* Setup:
|
|
||||||
* Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
|
||||||
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
|
||||||
* `Plug 'easymotion/vim-easymotion'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/easymotion/vim-easymotion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-easymotion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set easymotion</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-easymotion](https://github.com/easymotion/vim-easymotion)
|
|
||||||
* Commands: All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
|
||||||
|
|
||||||
## NERDTree
|
|
||||||
* Setup: `Plug 'preservim/nerdtree'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/preservim/nerdtree'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'nerdtree'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set NERDTree</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [NERDTree](https://github.com/preservim/nerdtree)
|
|
||||||
* Commands: [[see here|NERDTree-support]]
|
|
||||||
|
|
||||||
## surround
|
|
||||||
|
|
||||||
* Setup: `Plug 'tpope/vim-surround'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/tpope/vim-surround'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-surround'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=1697'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set surround</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-surround](https://github.com/tpope/vim-surround)
|
|
||||||
* Commands: `ys`, `cs`, `ds`, `S`
|
|
||||||
|
|
||||||
## multiple-cursors
|
|
||||||
|
|
||||||
* Setup: `Plug 'terryma/vim-multiple-cursors'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/terryma/vim-multiple-cursors'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-multiple-cursors'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set multiple-cursors</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors)
|
|
||||||
* Commands: `<A-n>`, `<A-x>`, `<A-p>`, `g<A-n>`
|
|
||||||
|
|
||||||
## commentary
|
|
||||||
|
|
||||||
* Setup: `Plug 'tpope/vim-commentary'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/tpope/vim-commentary'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-commentary'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=3695'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'tomtom/tcomment_vim'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'tcomment_vim'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=1173'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set commentary</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [commentary.vim](https://github.com/tpope/vim-commentary)
|
|
||||||
* Commands: `gcc`, `gc + motion`, `v_gc`
|
|
||||||
* By [Daniel Leong](https://github.com/dhleong)
|
|
||||||
|
|
||||||
## ReplaceWithRegister
|
|
||||||
|
|
||||||
* Setup: `Plug 'vim-scripts/ReplaceWithRegister'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/vim-scripts/ReplaceWithRegister'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'ReplaceWithRegister'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://github.com/inkarkat/vim-ReplaceWithRegister'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'inkarkat/vim-ReplaceWithRegister'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-ReplaceWithRegister'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2703'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set ReplaceWithRegister</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister)
|
|
||||||
* Commands: `gr`, `grr`
|
|
||||||
* By [igrekster](https://github.com/igrekster)
|
|
||||||
|
|
||||||
## argtextobj
|
|
||||||
|
|
||||||
* Setup:
|
|
||||||
* `Plug 'vim-scripts/argtextobj.vim'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/vim-scripts/argtextobj.vim'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'argtextobj.vim'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2699'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set argtextobj</code>
|
|
||||||
</details>
|
|
||||||
* By default, only the arguments inside parenthesis are considered. To extend the functionality
|
|
||||||
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
|
|
||||||
list of colon-separated pairs (same as VIM's `matchpairs` option), like
|
|
||||||
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
|
|
||||||
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
|
|
||||||
this syntax parenthesis, must come before angle brackets in the list.
|
|
||||||
* Emulates [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699)
|
|
||||||
* Additional text objects: `aa`, `ia`
|
|
||||||
|
|
||||||
## exchange
|
|
||||||
|
|
||||||
* Setup: `Plug 'tommcdo/vim-exchange'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/tommcdo/vim-exchange'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-exchange'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set exchange</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-exchange](https://github.com/tommcdo/vim-exchange)
|
|
||||||
* Commands: `cx`, `cxx`, `X`, `cxc`
|
|
||||||
* By [fan-tom](https://github.com/fan-tom)
|
|
||||||
|
|
||||||
## textobj-entire
|
|
||||||
|
|
||||||
* Setup: `Plug 'kana/vim-textobj-entire'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/kana/vim-textobj-entire'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-textobj-entire'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2610'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set textobj-entire</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-textobj-entire](https://github.com/kana/vim-textobj-entire)
|
|
||||||
* Additional text objects: `ae`, `ie`
|
|
||||||
* By [Alexandre Grison](https://github.com/agrison)
|
|
||||||
|
|
||||||
## highlightedyank
|
|
||||||
|
|
||||||
* Setup:
|
|
||||||
* `Plug 'machakann/vim-highlightedyank'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/machakann/vim-highlightedyank'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-highlightedyank'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set highlightedyank</code>
|
|
||||||
</details>
|
|
||||||
* if you want to optimize highlight duration, assign a time in milliseconds:
|
|
||||||
`let g:highlightedyank_highlight_duration = "1000"`
|
|
||||||
A negative number makes the highlight persistent.
|
|
||||||
`let g:highlightedyank_highlight_duration = "-1"`
|
|
||||||
* if you want to change background color of highlight you can provide the rgba of the color you want e.g.
|
|
||||||
`let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"`
|
|
||||||
* Emulates [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank)
|
|
||||||
* By [KostkaBrukowa](https://github.com/KostkaBrukowa)
|
|
||||||
|
|
||||||
## vim-paragraph-motion
|
|
||||||
|
|
||||||
* Setup: `Plug 'dbakker/vim-paragraph-motion'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/dbakker/vim-paragraph-motion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-paragraph-motion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'https://github.com/vim-scripts/Improved-paragraph-motion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-scripts/Improved-paragraph-motion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'Improved-paragraph-motion'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set vim-paragraph-motion</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-paragraph-motion](https://github.com/dbakker/vim-paragraph-motion)
|
|
||||||
|
|
||||||
## vim-indent-object
|
|
||||||
|
|
||||||
* Setup: `Plug 'michaeljsmith/vim-indent-object'`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'https://github.com/michaeljsmith/vim-indent-object'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'vim-indent-object'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set textobj-indent</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object)
|
|
||||||
* Additional text objects: `ai`, `ii`, `aI`
|
|
||||||
* By [Shrikant Sharat Kandula](https://github.com/sharat87)
|
|
||||||
|
|
||||||
## matchit.vim
|
|
||||||
|
|
||||||
* Setup: `packadd matchit`
|
|
||||||
* <details>
|
|
||||||
<summary>Alternative vim-plug / vundle syntax</summary>
|
|
||||||
<code>Plug 'vim-matchit'</code>
|
|
||||||
<br/>
|
|
||||||
<code>Plug 'chrisbra/matchit'</code>
|
|
||||||
<br/>
|
|
||||||
<code>set matchit</code>
|
|
||||||
</details>
|
|
||||||
* Emulates [matchit.vim](https://github.com/chrisbra/matchit)
|
|
||||||
* Currently works for HTML/XML and ruby
|
|
||||||
* By [Martin Yzeiri](https://github.com/myzeiri)
|
|
@@ -1,6 +1,6 @@
|
|||||||
Welcome to the IdeaVim wiki!
|
Welcome to the IdeaVim wiki!
|
||||||
|
|
||||||
- List of emulated plugins: [[plugins|Emulated-plugins]]
|
- List of IdeaVim plugins: [[plugins|IdeaVim Plugins]]
|
||||||
- Examples of `ideajoin` option (also known as "smart join"): [["ideajoin" examples|"ideajoin"-examples]]
|
- Examples of `ideajoin` option (also known as "smart join"): [["ideajoin" examples|ideajoin-examples]]
|
||||||
- List of "set" commands: [["set" commands|"set"-commands]]
|
- List of "set" commands: [["set" commands|set-commands]]
|
||||||
- Docs about "select" mode in vim: [[select mode|Select-mode]]
|
- Docs about "select" mode in vim: [[select mode|Select-mode]]
|
||||||
|
398
doc/IdeaVim Plugins.md
Normal file
398
doc/IdeaVim Plugins.md
Normal file
@@ -0,0 +1,398 @@
|
|||||||
|
IdeaVim Plugins
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
IdeaVim plugins work like the original Vim plugins. If you want to turn of any of them, you have to enable it via this command in your `~/.ideavimrc`:
|
||||||
|
|
||||||
|
```
|
||||||
|
Plug '<plugin-github-reference>'
|
||||||
|
```
|
||||||
|
|
||||||
|
If you reuse your existing `.vimrc` file using `source ~/.vimrc`, IdeaVim can parse and enable plugins that are defined
|
||||||
|
using [vim-plug](https://github.com/junegunn/vim-plug) or [vundle](https://github.com/VundleVim/Vundle.vim).
|
||||||
|
No additional set commands in `~/.ideavimrc` are required.
|
||||||
|
If you'd like to disable some plugin that's enabled in `.vimrc`, you can use `set no<extension-name>`
|
||||||
|
in `~/.ideavimrc`. E.g. `set nosurround`.
|
||||||
|
|
||||||
|
Available plugins:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>easymotion</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [vim-easymotion](https://github.com/easymotion/vim-easymotion).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Install [IdeaVim-EasyMotion](https://plugins.jetbrains.com/plugin/13360-ideavim-easymotion/)
|
||||||
|
and [AceJump](https://plugins.jetbrains.com/plugin/7086-acejump/) plugins.
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'easymotion/vim-easymotion'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'easymotion/vim-easymotion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/easymotion/vim-easymotion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-easymotion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set easymotion</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
All commands with the mappings are supported. See the [full list of supported commands](https://github.com/AlexPl292/IdeaVim-EasyMotion#supported-commands).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>sneak</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [vim-sneak](https://github.com/justinmk/vim-sneak).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Install [IdeaVim-sneak](https://plugins.jetbrains.com/plugin/15348-ideavim-sneak) plugin.
|
||||||
|
- Add the following command to `~/.ideavimrc`: `set sneak`
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
See the [docs](https://github.com/Mishkun/ideavim-sneak#usage)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>NERDTree</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [NERDTree](https://github.com/preservim/nerdtree).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'preservim/nerdtree'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'preservim/nerdtree'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/preservim/nerdtree'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'nerdtree'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set NERDTree</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
[[See here|NERDTree-support]].
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>surround</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [vim-surround](https://github.com/tpope/vim-surround).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'tpope/vim-surround'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'tpope/vim-surround'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=1697'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-surround'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set surround</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/tpope/vim-surround/blob/master/doc/surround.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>multiple-cursors</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'terryma/vim-multiple-cursors'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'terryma/vim-multiple-cursors'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/terryma/vim-multiple-cursors'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-multiple-cursors'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set multiple-cursors</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/terryma/vim-multiple-cursors/blob/master/doc/multiple_cursors.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>commentary</h2></summary>
|
||||||
|
|
||||||
|
By [Daniel Leong](https://github.com/dhleong)
|
||||||
|
Original plugin: [commentary.vim](https://github.com/tpope/vim-commentary).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'tpope/vim-commentary'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'tpope/vim-commentary'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/tpope/vim-commentary'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-commentary'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'tcomment_vim'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set commentary</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/tpope/vim-commentary/blob/master/doc/commentary.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>ReplaceWithRegister</h2></summary>
|
||||||
|
|
||||||
|
By [igrekster](https://github.com/igrekster)
|
||||||
|
Original plugin: [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'vim-scripts/ReplaceWithRegister'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'vim-scripts/ReplaceWithRegister'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'ReplaceWithRegister'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/inkarkat/vim-ReplaceWithRegister'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'inkarkat/vim-ReplaceWithRegister'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-ReplaceWithRegister'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2703'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set ReplaceWithRegister</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/vim-scripts/ReplaceWithRegister/blob/master/doc/ReplaceWithRegister.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>argtextobj</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [argtextobj.vim](https://www.vim.org/scripts/script.php?script_id=2699).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'vim-scripts/argtextobj.vim'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'vim-scripts/argtextobj.vim'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/vim-scripts/argtextobj.vim'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'argtextobj.vim'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2699'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set argtextobj</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
By default, only the arguments inside parenthesis are considered. To extend the functionality
|
||||||
|
to other types of brackets, set `g:argtextobj_pairs` variable to a comma-separated
|
||||||
|
list of colon-separated pairs (same as VIM's `matchpairs` option), like
|
||||||
|
`let g:argtextobj_pairs="(:),{:},<:>"`. The order of pairs matters when
|
||||||
|
handling symbols that can also be operators: `func(x << 5, 20) >> 17`. To handle
|
||||||
|
this syntax parenthesis, must come before angle brackets in the list.
|
||||||
|
|
||||||
|
https://www.vim.org/scripts/script.php?script_id=2699
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>exchange</h2></summary>
|
||||||
|
|
||||||
|
By [fan-tom](https://github.com/fan-tom)
|
||||||
|
Original plugin: [vim-exchange](https://github.com/tommcdo/vim-exchange).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'tommcdo/vim-exchange'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'tommcdo/vim-exchange'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/tommcdo/vim-exchange'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-exchange'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set exchange</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/tommcdo/vim-exchange/blob/master/doc/exchange.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>textobj-entire</h2></summary>
|
||||||
|
|
||||||
|
By [Alexandre Grison](https://github.com/agrison)
|
||||||
|
Original plugin: [vim-textobj-entire](https://github.com/kana/vim-textobj-entire).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'kana/vim-textobj-entire'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'kana/vim-textobj-entire'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-textobj-entire'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://www.vim.org/scripts/script.php?script_id=2610'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set textobj-entire</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/kana/vim-textobj-entire/blob/master/doc/textobj-entire.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>highlightedyank</h2></summary>
|
||||||
|
|
||||||
|
By [KostkaBrukowa](https://github.com/KostkaBrukowa)
|
||||||
|
Original plugin: [vim-highlightedyank](https://github.com/machakann/vim-highlightedyank).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'machakann/vim-highlightedyank'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'machakann/vim-highlightedyank'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/machakann/vim-highlightedyank'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-highlightedyank'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set highlightedyank</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
If you want to optimize highlight duration, assign a time in milliseconds:
|
||||||
|
`let g:highlightedyank_highlight_duration = "1000"`
|
||||||
|
A negative number makes the highlight persistent.
|
||||||
|
|
||||||
|
If you want to change background color of highlight you can provide the rgba of the color you want e.g.
|
||||||
|
`let g:highlightedyank_highlight_color = "rgba(160, 160, 160, 155)"`
|
||||||
|
|
||||||
|
https://github.com/machakann/vim-highlightedyank/blob/master/doc/highlightedyank.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>vim-paragraph-motion</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [vim-paragraph-motion](https://github.com/dbakker/vim-paragraph-motion).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'dbakker/vim-paragraph-motion'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'dbakker/vim-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/dbakker/vim-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/vim-scripts/Improved-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-scripts/Improved-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'Improved-paragraph-motion'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set vim-paragraph-motion</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/dbakker/vim-paragraph-motion#vim-paragraph-motion
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>vim-indent-object</h2></summary>
|
||||||
|
|
||||||
|
By [Shrikant Sharat Kandula](https://github.com/sharat87)
|
||||||
|
Original plugin: [vim-indent-object](https://github.com/michaeljsmith/vim-indent-object).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `Plug 'michaeljsmith/vim-indent-object'`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plugin 'michaeljsmith/vim-indent-object'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'https://github.com/michaeljsmith/vim-indent-object'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'vim-indent-object'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set textobj-indent</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/michaeljsmith/vim-indent-object/blob/master/doc/indent-object.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>matchit.vim</h2></summary>
|
||||||
|
|
||||||
|
By [Martin Yzeiri](https://github.com/myzeiri)
|
||||||
|
Original plugin: [matchit.vim](https://github.com/chrisbra/matchit).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Add the following command to `~/.ideavimrc`: `packadd matchit`
|
||||||
|
<details>
|
||||||
|
<summary>Alternative syntax</summary>
|
||||||
|
<code>Plug 'vim-matchit'</code>
|
||||||
|
<br/>
|
||||||
|
<code>Plug 'chrisbra/matchit'</code>
|
||||||
|
<br/>
|
||||||
|
<code>set matchit</code>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://github.com/adelarsq/vim-matchit/blob/master/doc/matchit.txt
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><h2>IdeaVim-Quickscope</h2></summary>
|
||||||
|
|
||||||
|
Original plugin: [quick-scope](https://github.com/unblevable/quick-scope).
|
||||||
|
|
||||||
|
### Setup:
|
||||||
|
- Install [IdeaVim-sneak](https://plugins.jetbrains.com/plugin/15348-ideavim-sneak) plugin.
|
||||||
|
- Add the following command to `~/.ideavimrc`: `set quickscope`
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
https://plugins.jetbrains.com/plugin/19417-ideavim-quickscope
|
||||||
|
|
||||||
|
</details>
|
@@ -1,6 +1,6 @@
|
|||||||
# NERDTree
|
# NERDTree
|
||||||
|
|
||||||
IdeaVim supports emulation of the NERDTree plugin. Update your `~/.ideavimrc` to turn it on:
|
IdeaVim supports the NERDTree plugin. Update your `~/.ideavimrc` to turn it on:
|
||||||
```vim
|
```vim
|
||||||
Plug 'preservim/nerdtree`
|
Plug 'preservim/nerdtree`
|
||||||
```
|
```
|
||||||
|
@@ -1,19 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2003-2022 The IdeaVim authors
|
||||||
|
#
|
||||||
|
# Use of this source code is governed by an MIT-style
|
||||||
|
# license that can be found in the LICENSE.txt file or at
|
||||||
|
# https://opensource.org/licenses/MIT.
|
||||||
|
#
|
||||||
|
|
||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
ideaVersion=LATEST-EAP-SNAPSHOT
|
ideaVersion=2022.3
|
||||||
downloadIdeaSources=true
|
downloadIdeaSources=true
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=SNAPSHOT
|
version=chylex-15
|
||||||
javaVersion=11
|
javaVersion=17
|
||||||
remoteRobotVersion=0.11.10
|
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.7.20
|
||||||
publishToken=token
|
publishToken=token
|
||||||
publishChannels=eap
|
publishChannels=eap
|
||||||
|
|
||||||
slackUrl=
|
slackUrl=
|
||||||
|
youtrackToken=
|
||||||
|
|
||||||
# Gradle settings
|
# Gradle settings
|
||||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||||
|
|
||||||
|
# Disable warning from gradle-intellij-plugin. Kotlin stdlib is included as compileOnly, so the warning is unnecessary
|
||||||
|
kotlin.stdlib.default.dependency=false
|
||||||
|
79982
qodana.sarif.json
Normal file
79982
qodana.sarif.json
Normal file
File diff suppressed because it is too large
Load Diff
24
qodana.yaml
24
qodana.yaml
@@ -1,6 +1,8 @@
|
|||||||
version: 1.0
|
version: 1.0
|
||||||
profile:
|
profile:
|
||||||
name: Qodana
|
name: Qodana
|
||||||
|
include:
|
||||||
|
- name: CheckDependencyLicenses
|
||||||
exclude:
|
exclude:
|
||||||
- name: MoveVariableDeclarationIntoWhen
|
- name: MoveVariableDeclarationIntoWhen
|
||||||
- name: PluginXmlValidity
|
- name: PluginXmlValidity
|
||||||
@@ -9,12 +11,18 @@ exclude:
|
|||||||
- name: UnusedReturnValue
|
- name: UnusedReturnValue
|
||||||
- name: All
|
- name: All
|
||||||
paths:
|
paths:
|
||||||
- build.gradle
|
- build.gradle.kts
|
||||||
- gradle/wrapper/gradle-wrapper.properties
|
- gradle/wrapper/gradle-wrapper.properties
|
||||||
- resources/icons/youtrack.svg
|
- src/main/resources/icons/youtrack.svg
|
||||||
- src/com/maddyhome/idea/vim/ex/vimscript/VimScriptCommandHandler.java
|
- src/main/java/com/maddyhome/idea/vim/helper/SearchHelper.java
|
||||||
- src/com/maddyhome/idea/vim/helper/SearchHelper.java
|
- src/main/java/com/maddyhome/idea/vim/regexp/RegExp.kt
|
||||||
- src/com/maddyhome/idea/vim/regexp/RegExp.java
|
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/JavaText.kt
|
||||||
- test/org/jetbrains/plugins/ideavim/propertybased/samples/JavaText.kt
|
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/LoremText.kt
|
||||||
- test/org/jetbrains/plugins/ideavim/propertybased/samples/LoremText.kt
|
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
|
||||||
- test/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
|
- src/main/java/com/maddyhome/idea/vim/vimscript/parser/generated
|
||||||
|
- src/main/java/com/maddyhome/idea/vim/package-info.java
|
||||||
|
dependencyIgnores:
|
||||||
|
- name: "acejump"
|
||||||
|
- name: "icu4j"
|
||||||
|
- name: "antlr-runtime"
|
||||||
|
- name: "javax.json"
|
51
scripts/build.gradle.kts
Normal file
51
scripts/build.gradle.kts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
java
|
||||||
|
kotlin("jvm")
|
||||||
|
application
|
||||||
|
}
|
||||||
|
|
||||||
|
// group 'org.jetbrains.ideavim'
|
||||||
|
// version 'SNAPSHOT'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20")
|
||||||
|
|
||||||
|
implementation("io.ktor:ktor-client-core:2.1.3")
|
||||||
|
implementation("io.ktor:ktor-client-cio:2.1.3")
|
||||||
|
implementation("io.ktor:ktor-client-content-negotiation:2.1.3")
|
||||||
|
implementation("io.ktor:ktor-serialization-kotlinx-json:2.1.3")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
compileKotlin {
|
||||||
|
kotlinOptions {
|
||||||
|
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("generateIdeaVimConfigurations", JavaExec::class) {
|
||||||
|
group = "verification"
|
||||||
|
description = "This job tracks if there are any new plugins in marketplace we don't know about"
|
||||||
|
mainClass.set("scripts.MainKt")
|
||||||
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register("checkNewPluginDependencies", JavaExec::class) {
|
||||||
|
group = "verification"
|
||||||
|
description = "This job tracks if there are any new plugins in marketplace we don't know about"
|
||||||
|
mainClass.set("scripts.CheckNewPluginDependenciesKt")
|
||||||
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
|
}
|
13
scripts/src/main/kotlin/scripts/Main.kt
Normal file
13
scripts/src/main/kotlin/scripts/Main.kt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package scripts
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println("Hello")
|
||||||
|
}
|
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package scripts
|
||||||
|
|
||||||
|
import io.ktor.client.*
|
||||||
|
import io.ktor.client.call.*
|
||||||
|
import io.ktor.client.engine.cio.*
|
||||||
|
import io.ktor.client.plugins.contentnegotiation.*
|
||||||
|
import io.ktor.client.request.*
|
||||||
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marketplace has a API to get all plugins that depend on our plugin.
|
||||||
|
* Here we have a list of dependent plugins at some moment and we check if something changed in that.
|
||||||
|
* If so, we need to update our list of plugins.
|
||||||
|
*
|
||||||
|
* This script makes no actions and aimed to notify the devs in case they need to update the list of IdeaVim plugins.
|
||||||
|
*/
|
||||||
|
|
||||||
|
val knownPlugins = listOf(
|
||||||
|
"IdeaVimExtension",
|
||||||
|
"github.zgqq.intellij-enhance",
|
||||||
|
"org.jetbrains.IdeaVim-EasyMotion",
|
||||||
|
"io.github.mishkun.ideavimsneak",
|
||||||
|
"eu.theblob42.idea.whichkey",
|
||||||
|
"com.github.copilot",
|
||||||
|
"com.github.dankinsoid.multicursor",
|
||||||
|
"com.joshestein.ideavim-quickscope",
|
||||||
|
)
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
val client = HttpClient(CIO) {
|
||||||
|
install(ContentNegotiation) {
|
||||||
|
json()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runBlocking {
|
||||||
|
val res = client.get("https://plugins.jetbrains.com/api/plugins/") {
|
||||||
|
parameter("dependency", "IdeaVIM")
|
||||||
|
parameter("includeOptional", true)
|
||||||
|
}
|
||||||
|
val output = res.body<List<String>>()
|
||||||
|
println(output)
|
||||||
|
if (knownPlugins != output) error("Unknown plugins list: ${output}")
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,14 @@
|
|||||||
|
// Set repository for snapshot versions of gradle plugin
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootProject.name = 'IdeaVIM'
|
rootProject.name = 'IdeaVIM'
|
||||||
include 'vim-engine'
|
include 'vim-engine'
|
||||||
|
include 'scripts'
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ rShift: GREATER+;
|
|||||||
|
|
||||||
letCommands:
|
letCommands:
|
||||||
(WS | COLON)* range? (WS | COLON)* LET WS+ expr WS*
|
(WS | COLON)* range? (WS | COLON)* LET WS+ expr WS*
|
||||||
assignmentOperator = (ASSIGN | PLUS_ASSIGN | MINUS_ASSIGN | STAR_ASSIGN | DIV_ASSIGN | MOD_ASSIGN | DOT_ASSIGN)
|
assignmentOperator
|
||||||
WS* expr WS* ((inline_comment NEW_LINE) | (NEW_LINE | BAR)+)
|
WS* expr WS* ((inline_comment NEW_LINE) | (NEW_LINE | BAR)+)
|
||||||
#Let1Command|
|
#Let1Command|
|
||||||
|
|
||||||
@@ -154,6 +154,21 @@ letCommands:
|
|||||||
#Let2Command
|
#Let2Command
|
||||||
;
|
;
|
||||||
|
|
||||||
|
assignmentOperator:
|
||||||
|
ASSIGN | plusAssign | minusAssign | startAssign | divAssign | modAssign | dotAssign;
|
||||||
|
plusAssign:
|
||||||
|
PLUS ASSIGN;
|
||||||
|
minusAssign:
|
||||||
|
MINUS ASSIGN;
|
||||||
|
startAssign:
|
||||||
|
STAR ASSIGN;
|
||||||
|
divAssign:
|
||||||
|
DIV ASSIGN;
|
||||||
|
modAssign:
|
||||||
|
MOD ASSIGN;
|
||||||
|
dotAssign:
|
||||||
|
DOT ASSIGN;
|
||||||
|
|
||||||
shortRange:
|
shortRange:
|
||||||
((QUESTION (~QUESTION)* QUESTION?) | (DIV (~DIV)* DIV?));
|
((QUESTION (~QUESTION)* QUESTION?) | (DIV (~DIV)* DIV?));
|
||||||
range:
|
range:
|
||||||
@@ -778,12 +793,12 @@ IS_NOT_CS: 'isnot#';
|
|||||||
|
|
||||||
// Assignment operators
|
// Assignment operators
|
||||||
ASSIGN: '=';
|
ASSIGN: '=';
|
||||||
PLUS_ASSIGN: '+=';
|
//PLUS_ASSIGN: '+=';
|
||||||
MINUS_ASSIGN: '-=';
|
//MINUS_ASSIGN: '-=';
|
||||||
STAR_ASSIGN: '*=';
|
//STAR_ASSIGN: '*=';
|
||||||
DIV_ASSIGN: '/=';
|
//DIV_ASSIGN: '/=';
|
||||||
MOD_ASSIGN: '%=';
|
//MOD_ASSIGN: '%=';
|
||||||
DOT_ASSIGN: '.=';
|
//DOT_ASSIGN: '.=';
|
||||||
|
|
||||||
// Escaped chars
|
// Escaped chars
|
||||||
ESCAPED_QUESTION: '\\?';
|
ESCAPED_QUESTION: '\\?';
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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
|
package com.maddyhome.idea.vim
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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;
|
package com.maddyhome.idea.vim;
|
||||||
@@ -27,6 +17,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,38 +92,51 @@ public class EventFacade {
|
|||||||
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
|
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
public void addCaretListener(@NotNull Editor editor,
|
||||||
public void removeEditorFactoryListener(@NotNull EditorFactoryListener listener) {
|
@NotNull CaretListener listener,
|
||||||
// Listener is removed not only if application is disposed
|
@NotNull Disposable disposable) {
|
||||||
EditorFactory.getInstance().removeEditorFactoryListener(listener);
|
editor.getCaretModel().addCaretListener(listener, disposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEditorMouseListener(@NotNull Editor editor, @NotNull EditorMouseListener listener) {
|
public void removeCaretListener(@NotNull Editor editor, @NotNull CaretListener listener) {
|
||||||
editor.addEditorMouseListener(listener);
|
editor.getCaretModel().removeCaretListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEditorMouseListener(@NotNull Editor editor,
|
||||||
|
@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) {
|
||||||
|
@@ -1,25 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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
|
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 +32,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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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
|
package com.maddyhome.idea.vim
|
||||||
|
@@ -1,26 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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;
|
package com.maddyhome.idea.vim;
|
||||||
|
|
||||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||||
import com.intellij.ide.plugins.PluginManagerCore;
|
import com.intellij.ide.plugins.PluginManagerCore;
|
||||||
import com.intellij.notification.Notification;
|
|
||||||
import com.intellij.notification.NotificationListener;
|
|
||||||
import com.intellij.openapi.Disposable;
|
import com.intellij.openapi.Disposable;
|
||||||
import com.intellij.openapi.application.Application;
|
import com.intellij.openapi.application.Application;
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
@@ -32,9 +20,9 @@ import com.intellij.openapi.extensions.PluginId;
|
|||||||
import com.intellij.openapi.keymap.Keymap;
|
import com.intellij.openapi.keymap.Keymap;
|
||||||
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
import com.intellij.openapi.keymap.ex.KeymapManagerEx;
|
||||||
import com.intellij.openapi.keymap.impl.DefaultKeymap;
|
import com.intellij.openapi.keymap.impl.DefaultKeymap;
|
||||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.ui.Messages;
|
import com.intellij.openapi.ui.Messages;
|
||||||
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.intellij.openapi.util.SystemInfo;
|
import com.intellij.openapi.util.SystemInfo;
|
||||||
import com.maddyhome.idea.vim.api.VimInjectorKt;
|
import com.maddyhome.idea.vim.api.VimInjectorKt;
|
||||||
import com.maddyhome.idea.vim.api.VimKeyGroup;
|
import com.maddyhome.idea.vim.api.VimKeyGroup;
|
||||||
@@ -43,25 +31,22 @@ import com.maddyhome.idea.vim.config.migration.ApplicationConfigurationMigrator;
|
|||||||
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
|
import com.maddyhome.idea.vim.extension.VimExtensionRegistrar;
|
||||||
import com.maddyhome.idea.vim.group.*;
|
import com.maddyhome.idea.vim.group.*;
|
||||||
import com.maddyhome.idea.vim.group.copy.PutGroup;
|
import com.maddyhome.idea.vim.group.copy.PutGroup;
|
||||||
import com.maddyhome.idea.vim.group.copy.YankGroup;
|
|
||||||
import com.maddyhome.idea.vim.group.visual.VisualMotionGroup;
|
import com.maddyhome.idea.vim.group.visual.VisualMotionGroup;
|
||||||
import com.maddyhome.idea.vim.helper.MacKeyRepeat;
|
import com.maddyhome.idea.vim.helper.MacKeyRepeat;
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerManager;
|
import com.maddyhome.idea.vim.listener.VimListenerManager;
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimInjector;
|
import com.maddyhome.idea.vim.newapi.IjVimInjector;
|
||||||
import com.maddyhome.idea.vim.options.OptionService;
|
|
||||||
import com.maddyhome.idea.vim.ui.StatusBarIconFactory;
|
import com.maddyhome.idea.vim.ui.StatusBarIconFactory;
|
||||||
import com.maddyhome.idea.vim.ui.VimEmulationConfigurable;
|
|
||||||
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel;
|
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel;
|
||||||
import com.maddyhome.idea.vim.vimscript.services.FunctionStorage;
|
import com.maddyhome.idea.vim.vimscript.services.FunctionStorage;
|
||||||
import com.maddyhome.idea.vim.vimscript.services.IjVimOptionService;
|
import com.maddyhome.idea.vim.vimscript.services.IjVimOptionService;
|
||||||
import com.maddyhome.idea.vim.vimscript.services.VimVariableService;
|
import com.maddyhome.idea.vim.vimscript.services.OptionService;
|
||||||
|
import com.maddyhome.idea.vim.vimscript.services.VariableService;
|
||||||
|
import com.maddyhome.idea.vim.yank.YankGroupBase;
|
||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
import org.jetbrains.annotations.Nls;
|
import org.jetbrains.annotations.Nls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.event.HyperlinkEvent;
|
|
||||||
|
|
||||||
import static com.maddyhome.idea.vim.group.EditorGroup.EDITOR_STORE_ELEMENT;
|
import static com.maddyhome.idea.vim.group.EditorGroup.EDITOR_STORE_ELEMENT;
|
||||||
import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
import static com.maddyhome.idea.vim.group.KeyGroup.SHORTCUT_CONFLICTS_ELEMENT;
|
||||||
import static com.maddyhome.idea.vim.vimscript.services.VimRcService.executeIdeaVimRc;
|
import static com.maddyhome.idea.vim.vimscript.services.VimRcService.executeIdeaVimRc;
|
||||||
@@ -94,6 +79,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
|
|
||||||
private final @NotNull VimState state = new VimState();
|
private final @NotNull VimState state = new VimState();
|
||||||
|
|
||||||
|
public Disposable onOffDisposable;
|
||||||
|
|
||||||
VimPlugin() {
|
VimPlugin() {
|
||||||
ApplicationConfigurationMigrator.getInstance().migrate();
|
ApplicationConfigurationMigrator.getInstance().migrate();
|
||||||
}
|
}
|
||||||
@@ -117,7 +104,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");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,10 +189,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
return ((WindowGroup)VimInjectorKt.getInjector().getWindow());
|
return ((WindowGroup)VimInjectorKt.getInjector().getWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull TabService getTabService() {
|
|
||||||
return ApplicationManager.getApplication().getService(TabService.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @NotNull EditorGroup getEditor() {
|
public static @NotNull EditorGroup getEditor() {
|
||||||
return ApplicationManager.getApplication().getService(EditorGroup.class);
|
return ApplicationManager.getApplication().getService(EditorGroup.class);
|
||||||
}
|
}
|
||||||
@@ -218,16 +201,16 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
return (VisualMotionGroup)VimInjectorKt.getInjector().getVisualMotionGroup();
|
return (VisualMotionGroup)VimInjectorKt.getInjector().getVisualMotionGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull YankGroup getYank() {
|
public static @NotNull YankGroupBase getYank() {
|
||||||
return (YankGroup)VimInjectorKt.getInjector().getYank();
|
return (YankGroupBase)VimInjectorKt.getInjector().getYank();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull PutGroup getPut() {
|
public static @NotNull PutGroup getPut() {
|
||||||
return (PutGroup)VimInjectorKt.getInjector().getPut();
|
return (PutGroup)VimInjectorKt.getInjector().getPut();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull VimVariableService getVariableService() {
|
public static @NotNull VariableService getVariableService() {
|
||||||
return ApplicationManager.getApplication().getService(VimVariableService.class);
|
return ApplicationManager.getApplication().getService(VariableService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull OptionService getOptionService() {
|
public static @NotNull OptionService getOptionService() {
|
||||||
@@ -259,12 +242,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
|
|
||||||
public static @NotNull String getVersion() {
|
public static @NotNull String getVersion() {
|
||||||
final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(getPluginId());
|
final IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(getPluginId());
|
||||||
if (!ApplicationManager.getApplication().isInternal()) {
|
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
||||||
return plugin != null ? plugin.getVersion() : "SNAPSHOT";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "INTERNAL" + (plugin != null ? " - " + plugin.getVersion() : "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEnabled() {
|
public static boolean isEnabled() {
|
||||||
@@ -275,7 +253,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;
|
||||||
@@ -306,12 +284,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
VimInjectorKt.getInjector().getMessages().clearError();
|
VimInjectorKt.getInjector().getMessages().clearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showMode(String msg) {
|
|
||||||
VimInjectorKt.getInjector().getMessages().showMode(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showMessage(@Nls(capitalization = Nls.Capitalization.Sentence) @Nullable String msg) {
|
public static void showMessage(@Nls(capitalization = Nls.Capitalization.Sentence) @Nullable String msg) {
|
||||||
VimInjectorKt.getInjector().getMessages().showStatusBarMessage(msg);
|
VimInjectorKt.getInjector().getMessages().showStatusBarMessage(null, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull VimPlugin getInstance() {
|
public static @NotNull VimPlugin getInstance() {
|
||||||
@@ -341,6 +315,8 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
* execution, what theoretically may cause bugs (e.g. VIM-2540)
|
* execution, what theoretically may cause bugs (e.g. VIM-2540)
|
||||||
*/
|
*/
|
||||||
private void turnOnPlugin() {
|
private void turnOnPlugin() {
|
||||||
|
onOffDisposable = Disposer.newDisposable(this, "IdeaVimOnOffDisposer");
|
||||||
|
|
||||||
// 1) Update state
|
// 1) Update state
|
||||||
ApplicationManager.getApplication().invokeLater(this::updateState);
|
ApplicationManager.getApplication().invokeLater(this::updateState);
|
||||||
|
|
||||||
@@ -366,16 +342,20 @@ 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
|
||||||
RegisterActions.unregisterActions();
|
RegisterActions.unregisterActions();
|
||||||
|
|
||||||
|
Disposer.dispose(onOffDisposable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean stateUpdated = false;
|
private boolean stateUpdated = false;
|
||||||
@@ -389,7 +369,9 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
final Boolean enabled = keyRepeat.isEnabled();
|
final Boolean enabled = keyRepeat.isEnabled();
|
||||||
final Boolean isKeyRepeat = getEditor().isKeyRepeat();
|
final Boolean isKeyRepeat = getEditor().isKeyRepeat();
|
||||||
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
|
if ((enabled == null || !enabled) && (isKeyRepeat == null || isKeyRepeat)) {
|
||||||
if (VimPlugin.getNotifications().enableRepeatingMode() == Messages.YES) {
|
// This system property is used in IJ ui robot to hide the startup tips
|
||||||
|
boolean showNotification = Boolean.getBoolean("ide.show.tips.on.startup.default.value");
|
||||||
|
if (showNotification && VimPlugin.getNotifications().enableRepeatingMode() == Messages.YES) {
|
||||||
getEditor().setKeyRepeat(true);
|
getEditor().setKeyRepeat(true);
|
||||||
keyRepeat.setEnabled(true);
|
keyRepeat.setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -408,12 +390,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
|
|||||||
keymap = manager.getKeymap(DefaultKeymap.getInstance().getDefaultKeymapName());
|
keymap = manager.getKeymap(DefaultKeymap.getInstance().getDefaultKeymapName());
|
||||||
}
|
}
|
||||||
assert keymap != null : "Default keymap not found";
|
assert keymap != null : "Default keymap not found";
|
||||||
VimPlugin.getNotifications().specialKeymap(keymap, new NotificationListener.Adapter() {
|
|
||||||
@Override
|
|
||||||
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
|
|
||||||
ShowSettingsUtil.getInstance().showSettingsDialog(null, VimEmulationConfigurable.class);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
manager.setActiveKeymap(keymap);
|
manager.setActiveKeymap(keymap);
|
||||||
}
|
}
|
||||||
if (previousStateVersion > 0 && previousStateVersion < 4) {
|
if (previousStateVersion > 0 && previousStateVersion < 4) {
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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
|
package com.maddyhome.idea.vim
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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
|
package com.maddyhome.idea.vim
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action
|
package com.maddyhome.idea.vim.action
|
||||||
|
|
||||||
|
@@ -1,24 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.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 +33,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
|
||||||
}
|
}
|
||||||
|
@@ -1,25 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action
|
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 +86,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)
|
||||||
@@ -149,6 +144,10 @@ class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible*/ {
|
|||||||
|
|
||||||
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) {
|
||||||
// TODO: This stops VimEditorTab seeing <Tab> in insert mode and correctly scrolling the view
|
// TODO: This stops VimEditorTab seeing <Tab> in insert mode and correctly scrolling the view
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change
|
package com.maddyhome.idea.vim.action.change
|
||||||
|
|
||||||
@@ -22,6 +12,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
|
||||||
@@ -34,13 +25,13 @@ import com.maddyhome.idea.vim.group.visual.VimSelection
|
|||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
import com.maddyhome.idea.vim.handler.VisualOperatorActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||||
import com.maddyhome.idea.vim.helper.commandState
|
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
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 +40,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
|
||||||
}
|
}
|
||||||
@@ -61,7 +52,7 @@ class OperatorAction : VimActionHandler.SingleExecution() {
|
|||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||||
val argument = cmd.argument ?: return false
|
val argument = cmd.argument ?: return false
|
||||||
if (!editor.commandState.isDotRepeatInProgress) {
|
if (!editor.vimStateMachine.isDotRepeatInProgress) {
|
||||||
argumentCaptured = argument
|
argumentCaptured = argument
|
||||||
}
|
}
|
||||||
val range = getMotionRange(editor, context, argument, operatorArguments)
|
val range = getMotionRange(editor, context, argument, operatorArguments)
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change
|
package com.maddyhome.idea.vim.action.change
|
||||||
|
|
||||||
@@ -25,14 +15,14 @@ import com.maddyhome.idea.vim.api.injector
|
|||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.commandState
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
|
|
||||||
class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
class RepeatChangeAction : VimActionHandler.SingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
override val type: Command.Type = Command.Type.OTHER_WRITABLE
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||||
val state = editor.commandState
|
val state = editor.vimStateMachine
|
||||||
val lastCommand = VimRepeater.lastChangeCommand
|
val lastCommand = VimRepeater.lastChangeCommand
|
||||||
|
|
||||||
if (lastCommand == null && Extension.lastExtensionHandler == null) return false
|
if (lastCommand == null && Extension.lastExtensionHandler == null) return false
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change.delete
|
package com.maddyhome.idea.vim.action.change.delete
|
||||||
|
|
||||||
@@ -28,8 +18,28 @@ import com.maddyhome.idea.vim.handler.ChangeEditorActionHandler
|
|||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.OptionScope
|
||||||
import com.maddyhome.idea.vim.vimscript.services.IjVimOptionService
|
import com.maddyhome.idea.vim.vimscript.services.IjVimOptionService
|
||||||
|
|
||||||
class DeleteJoinLinesAction : ChangeEditorActionHandler.SingleExecution() {
|
class DeleteJoinLinesAction : ChangeEditorActionHandler.ConditionalSingleExecution() {
|
||||||
override val type: Command.Type = Command.Type.DELETE
|
override val type: Command.Type = Command.Type.DELETE
|
||||||
|
override fun runAsMulticaret(
|
||||||
|
editor: VimEditor,
|
||||||
|
context: ExecutionContext,
|
||||||
|
cmd: Command,
|
||||||
|
operatorArguments: OperatorArguments,
|
||||||
|
): Boolean {
|
||||||
|
return !injector.optionService.isSet(OptionScope.LOCAL(editor), IjVimOptionService.ideajoinName)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(
|
||||||
|
editor: VimEditor,
|
||||||
|
caret: VimCaret,
|
||||||
|
context: ExecutionContext,
|
||||||
|
argument: Argument?,
|
||||||
|
operatorArguments: OperatorArguments,
|
||||||
|
): Boolean {
|
||||||
|
injector.editorGroup.notifyIdeaJoin(editor)
|
||||||
|
|
||||||
|
return injector.changeGroup.deleteJoinLines(editor, caret, operatorArguments.count1, false, operatorArguments)
|
||||||
|
}
|
||||||
|
|
||||||
override fun execute(
|
override fun execute(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
@@ -38,17 +48,6 @@ class DeleteJoinLinesAction : ChangeEditorActionHandler.SingleExecution() {
|
|||||||
operatorArguments: OperatorArguments,
|
operatorArguments: OperatorArguments,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (editor.isOneLineMode()) return false
|
if (editor.isOneLineMode()) return false
|
||||||
if (injector.optionService.isSet(OptionScope.LOCAL(editor), IjVimOptionService.ideajoinName)) {
|
return injector.changeGroup.joinViaIdeaByCount(editor, context, operatorArguments.count1)
|
||||||
return injector.changeGroup.joinViaIdeaByCount(editor, context, operatorArguments.count1)
|
|
||||||
}
|
|
||||||
injector.editorGroup.notifyIdeaJoin(editor)
|
|
||||||
val res = arrayOf(true)
|
|
||||||
editor.forEachNativeCaret(
|
|
||||||
{ caret: VimCaret ->
|
|
||||||
if (!injector.changeGroup.deleteJoinLines(editor, caret, operatorArguments.count1, false)) res[0] = false
|
|
||||||
},
|
|
||||||
true
|
|
||||||
)
|
|
||||||
return res[0]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change.delete
|
package com.maddyhome.idea.vim.action.change.delete
|
||||||
|
|
||||||
@@ -45,7 +35,7 @@ class DeleteJoinLinesSpacesAction : ChangeEditorActionHandler.SingleExecution()
|
|||||||
val res = arrayOf(true)
|
val res = arrayOf(true)
|
||||||
editor.forEachNativeCaret(
|
editor.forEachNativeCaret(
|
||||||
{ caret: VimCaret ->
|
{ caret: VimCaret ->
|
||||||
if (!injector.changeGroup.deleteJoinLines(editor, caret, operatorArguments.count1, true)) res[0] = false
|
if (!injector.changeGroup.deleteJoinLines(editor, caret, operatorArguments.count1, true, operatorArguments)) res[0] = false
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change.delete
|
package com.maddyhome.idea.vim.action.change.delete
|
||||||
|
|
||||||
@@ -57,7 +47,14 @@ class DeleteJoinVisualLinesAction : VisualOperatorActionHandler.SingleExecution(
|
|||||||
caret: VimCaret ->
|
caret: VimCaret ->
|
||||||
if (!caret.isValid) return@forEachNativeCaret
|
if (!caret.isValid) return@forEachNativeCaret
|
||||||
val range = caretsAndSelections[caret] ?: return@forEachNativeCaret
|
val range = caretsAndSelections[caret] ?: return@forEachNativeCaret
|
||||||
if (!injector.changeGroup.deleteJoinRange(editor, caret, range.toVimTextRange(true).normalize(), false)) {
|
if (!injector.changeGroup.deleteJoinRange(
|
||||||
|
editor,
|
||||||
|
caret,
|
||||||
|
range.toVimTextRange(true).normalize(),
|
||||||
|
false,
|
||||||
|
operatorArguments
|
||||||
|
)
|
||||||
|
) {
|
||||||
res[0] = false
|
res[0] = false
|
||||||
}
|
}
|
||||||
}, true
|
}, true
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.change.delete
|
package com.maddyhome.idea.vim.action.change.delete
|
||||||
|
|
||||||
@@ -56,7 +46,14 @@ class DeleteJoinVisualLinesSpacesAction : VisualOperatorActionHandler.SingleExec
|
|||||||
{ caret: VimCaret ->
|
{ caret: VimCaret ->
|
||||||
if (!caret.isValid) return@forEachNativeCaret
|
if (!caret.isValid) return@forEachNativeCaret
|
||||||
val range = caretsAndSelections[caret] ?: return@forEachNativeCaret
|
val range = caretsAndSelections[caret] ?: return@forEachNativeCaret
|
||||||
if (!injector.changeGroup.deleteJoinRange(editor, caret, range.toVimTextRange(true).normalize(), true)) {
|
if (!injector.changeGroup.deleteJoinRange(
|
||||||
|
editor,
|
||||||
|
caret,
|
||||||
|
range.toVimTextRange(true).normalize(),
|
||||||
|
true,
|
||||||
|
operatorArguments
|
||||||
|
)
|
||||||
|
) {
|
||||||
res[0] = false
|
res[0] = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.editor
|
package com.maddyhome.idea.vim.action.editor
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.ex
|
package com.maddyhome.idea.vim.action.ex
|
||||||
|
|
||||||
|
@@ -1,23 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.internal
|
package com.maddyhome.idea.vim.action.internal
|
||||||
|
|
||||||
import com.intellij.ide.ui.AntialiasingType
|
import com.intellij.ide.ui.AntialiasingType
|
||||||
|
import com.intellij.ide.ui.UISettings
|
||||||
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.CommonDataKeys
|
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||||
@@ -124,7 +115,7 @@ class AddBlockInlaysAction : AnAction() {
|
|||||||
val editorContext = FontInfo.getFontRenderContext(editor.contentComponent)
|
val editorContext = FontInfo.getFontRenderContext(editor.contentComponent)
|
||||||
return FontRenderContext(
|
return FontRenderContext(
|
||||||
editorContext.transform, AntialiasingType.getKeyForCurrentScope(false),
|
editorContext.transform, AntialiasingType.getKeyForCurrentScope(false),
|
||||||
if (editor is EditorImpl) editor.myFractionalMetricsHintValue else RenderingHints.VALUE_FRACTIONALMETRICS_OFF
|
if (editor is EditorImpl) UISettings.editorFractionalMetricsHint else RenderingHints.VALUE_FRACTIONALMETRICS_OFF
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.action.internal
|
package com.maddyhome.idea.vim.action.internal
|
||||||
@@ -25,8 +15,10 @@ import com.intellij.openapi.actionSystem.CommonDataKeys
|
|||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.VisualPosition
|
import com.intellij.openapi.editor.VisualPosition
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
import com.maddyhome.idea.vim.api.lineLength
|
||||||
|
import com.maddyhome.idea.vim.api.visualLineToBufferLine
|
||||||
import com.maddyhome.idea.vim.helper.VimNlsSafe
|
import com.maddyhome.idea.vim.helper.VimNlsSafe
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
@@ -38,17 +30,18 @@ class AddInlineInlaysAction : AnAction() {
|
|||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val dataContext = e.dataContext
|
val dataContext = e.dataContext
|
||||||
val editor = getEditor(dataContext) ?: return
|
val editor = getEditor(dataContext) ?: return
|
||||||
|
val vimEditor = editor.vim
|
||||||
val inlayModel = editor.inlayModel
|
val inlayModel = editor.inlayModel
|
||||||
val currentVisualLine = editor.caretModel.primaryCaret.visualPosition.line
|
val currentVisualLine = editor.caretModel.primaryCaret.visualPosition.line
|
||||||
var i = random.nextInt(10)
|
var i = random.nextInt(10)
|
||||||
val lineLength = EditorHelper.getLineLength(editor, EditorHelper.visualLineToLogicalLine(editor, currentVisualLine))
|
val lineLength = vimEditor.lineLength(vimEditor.visualLineToBufferLine(currentVisualLine))
|
||||||
while (i < lineLength) {
|
while (i < lineLength) {
|
||||||
val relatesToPrecedingText = random.nextInt(10) > 7
|
val relatesToPrecedingText = random.nextInt(10) > 7
|
||||||
|
|
||||||
@VimNlsSafe
|
@VimNlsSafe
|
||||||
val text = "a".repeat(max(1, random.nextInt(7)))
|
val text = "a".repeat(max(1, random.nextInt(7)))
|
||||||
|
|
||||||
val offset = EditorHelper.visualPositionToOffset(editor, VisualPosition(currentVisualLine, i))
|
val offset = editor.visualPositionToOffset(VisualPosition(currentVisualLine, i))
|
||||||
// We don't need a custom renderer, just use the standard parameter hint renderer
|
// We don't need a custom renderer, just use the standard parameter hint renderer
|
||||||
inlayModel.addInlineElement(
|
inlayModel.addInlineElement(
|
||||||
offset,
|
offset,
|
||||||
|
87
src/main/java/com/maddyhome/idea/vim/command/CommandState.kt
Normal file
87
src/main/java/com/maddyhome/idea/vim/command/CommandState.kt
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.maddyhome.idea.vim.command
|
||||||
|
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COMPATIBILITY-LAYER: Additional class
|
||||||
|
* Please see: https://jb.gg/zo8n0r
|
||||||
|
*/
|
||||||
|
class CommandState(private val machine: VimStateMachine) {
|
||||||
|
|
||||||
|
val isOperatorPending: Boolean
|
||||||
|
get() = machine.isOperatorPending
|
||||||
|
|
||||||
|
val mode: CommandState.Mode
|
||||||
|
get() = machine.mode.ij
|
||||||
|
|
||||||
|
val commandBuilder: CommandBuilder
|
||||||
|
get() = machine.commandBuilder
|
||||||
|
|
||||||
|
val mappingState: MappingState
|
||||||
|
get() = machine.mappingState
|
||||||
|
|
||||||
|
enum class Mode {
|
||||||
|
// Basic modes
|
||||||
|
COMMAND, VISUAL, SELECT, INSERT, CMD_LINE, /*EX*/
|
||||||
|
|
||||||
|
// Additional modes
|
||||||
|
OP_PENDING, REPLACE /*, VISUAL_REPLACE*/, INSERT_NORMAL, INSERT_VISUAL, INSERT_SELECT
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class SubMode {
|
||||||
|
NONE, VISUAL_CHARACTER, VISUAL_LINE, VISUAL_BLOCK
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun getInstance(editor: Editor): CommandState {
|
||||||
|
return CommandState(editor.vim.vimStateMachine)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val CommandState.SubMode.engine: VimStateMachine.SubMode
|
||||||
|
get() = when (this) {
|
||||||
|
CommandState.SubMode.NONE -> VimStateMachine.SubMode.NONE
|
||||||
|
CommandState.SubMode.VISUAL_CHARACTER -> VimStateMachine.SubMode.VISUAL_CHARACTER
|
||||||
|
CommandState.SubMode.VISUAL_LINE -> VimStateMachine.SubMode.VISUAL_LINE
|
||||||
|
CommandState.SubMode.VISUAL_BLOCK -> VimStateMachine.SubMode.VISUAL_BLOCK
|
||||||
|
}
|
||||||
|
|
||||||
|
val CommandState.Mode.engine: VimStateMachine.Mode
|
||||||
|
get() = when (this) {
|
||||||
|
CommandState.Mode.COMMAND -> VimStateMachine.Mode.COMMAND
|
||||||
|
CommandState.Mode.VISUAL -> VimStateMachine.Mode.VISUAL
|
||||||
|
CommandState.Mode.SELECT -> VimStateMachine.Mode.SELECT
|
||||||
|
CommandState.Mode.INSERT -> VimStateMachine.Mode.INSERT
|
||||||
|
CommandState.Mode.CMD_LINE -> VimStateMachine.Mode.CMD_LINE
|
||||||
|
CommandState.Mode.OP_PENDING -> VimStateMachine.Mode.OP_PENDING
|
||||||
|
CommandState.Mode.REPLACE -> VimStateMachine.Mode.REPLACE
|
||||||
|
CommandState.Mode.INSERT_NORMAL -> VimStateMachine.Mode.INSERT_NORMAL
|
||||||
|
CommandState.Mode.INSERT_VISUAL -> VimStateMachine.Mode.INSERT_VISUAL
|
||||||
|
CommandState.Mode.INSERT_SELECT -> VimStateMachine.Mode.INSERT_SELECT
|
||||||
|
}
|
||||||
|
|
||||||
|
val VimStateMachine.Mode.ij: CommandState.Mode
|
||||||
|
get() = when (this) {
|
||||||
|
VimStateMachine.Mode.COMMAND -> CommandState.Mode.COMMAND
|
||||||
|
VimStateMachine.Mode.VISUAL -> CommandState.Mode.VISUAL
|
||||||
|
VimStateMachine.Mode.SELECT -> CommandState.Mode.SELECT
|
||||||
|
VimStateMachine.Mode.INSERT -> CommandState.Mode.INSERT
|
||||||
|
VimStateMachine.Mode.CMD_LINE -> CommandState.Mode.CMD_LINE
|
||||||
|
VimStateMachine.Mode.OP_PENDING -> CommandState.Mode.OP_PENDING
|
||||||
|
VimStateMachine.Mode.REPLACE -> CommandState.Mode.REPLACE
|
||||||
|
VimStateMachine.Mode.INSERT_NORMAL -> CommandState.Mode.INSERT_NORMAL
|
||||||
|
VimStateMachine.Mode.INSERT_VISUAL -> CommandState.Mode.INSERT_VISUAL
|
||||||
|
VimStateMachine.Mode.INSERT_SELECT -> CommandState.Mode.INSERT_SELECT
|
||||||
|
}
|
@@ -1,35 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.common
|
package com.maddyhome.idea.vim.common
|
||||||
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.LogicalPosition
|
import com.intellij.openapi.editor.LogicalPosition
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getLineStartOffset
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
|
|
||||||
class CharacterPosition(line: Int, col: Int) : LogicalPosition(line, col) {
|
class CharacterPosition(line: Int, col: Int) : LogicalPosition(line, col) {
|
||||||
fun toOffset(editor: Editor) = getLineStartOffset(editor, line) + column
|
fun toOffset(editor: Editor) = editor.vim.getLineStartOffset(line) + column
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun fromOffset(editor: Editor, offset: Int): CharacterPosition {
|
fun fromOffset(editor: Editor, offset: Int): CharacterPosition {
|
||||||
// logical position "expands" tabs
|
// logical position "expands" tabs
|
||||||
val logicalPosition = editor.offsetToLogicalPosition(offset)
|
val logicalPosition = editor.offsetToLogicalPosition(offset)
|
||||||
val lineStartOffset = getLineStartOffset(editor, logicalPosition.line)
|
val lineStartOffset = editor.vim.getLineStartOffset(logicalPosition.line)
|
||||||
return CharacterPosition(logicalPosition.line, offset - lineStartOffset)
|
return CharacterPosition(logicalPosition.line, offset - lineStartOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.common
|
package com.maddyhome.idea.vim.common
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.config
|
package com.maddyhome.idea.vim.config
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.config.migration
|
package com.maddyhome.idea.vim.config.migration
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.config.migration
|
package com.maddyhome.idea.vim.config.migration
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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/>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("ClassName")
|
@file:Suppress("ClassName")
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.ex
|
package com.maddyhome.idea.vim.ex
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.ex.vimscript;
|
package com.maddyhome.idea.vim.ex.vimscript;
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension
|
package com.maddyhome.idea.vim.extension
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension;
|
package com.maddyhome.idea.vim.extension;
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension
|
package com.maddyhome.idea.vim.extension
|
||||||
|
|
||||||
@@ -23,14 +13,16 @@ import com.intellij.openapi.editor.Editor
|
|||||||
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.action.change.Extension
|
import com.maddyhome.idea.vim.action.change.Extension
|
||||||
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.SelectionType
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
import com.maddyhome.idea.vim.common.CommandAlias
|
import com.maddyhome.idea.vim.common.CommandAlias
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
import com.maddyhome.idea.vim.common.MappingMode
|
|
||||||
import com.maddyhome.idea.vim.helper.CommandLineHelper
|
import com.maddyhome.idea.vim.helper.CommandLineHelper
|
||||||
import com.maddyhome.idea.vim.helper.EditorDataContext
|
import com.maddyhome.idea.vim.helper.EditorDataContext
|
||||||
import com.maddyhome.idea.vim.helper.TestInputModel
|
import com.maddyhome.idea.vim.helper.TestInputModel
|
||||||
import com.maddyhome.idea.vim.helper.commandState
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner
|
import com.maddyhome.idea.vim.key.MappingOwner
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
@@ -48,6 +40,22 @@ import javax.swing.KeyStroke
|
|||||||
object VimExtensionFacade {
|
object VimExtensionFacade {
|
||||||
/** The 'map' command for mapping keys to handlers defined in extensions. */
|
/** The 'map' command for mapping keys to handlers defined in extensions. */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
fun putExtensionHandlerMapping(
|
||||||
|
modes: Set<MappingMode>,
|
||||||
|
fromKeys: List<KeyStroke>,
|
||||||
|
pluginOwner: MappingOwner,
|
||||||
|
extensionHandler: ExtensionHandler,
|
||||||
|
recursive: Boolean,
|
||||||
|
) {
|
||||||
|
VimPlugin.getKey().putKeyMapping(modes, fromKeys, pluginOwner, extensionHandler, recursive)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COMPATIBILITY-LAYER: Additional method
|
||||||
|
* Please see: https://jb.gg/zo8n0r
|
||||||
|
*/
|
||||||
|
/** The 'map' command for mapping keys to handlers defined in extensions. */
|
||||||
|
@JvmStatic
|
||||||
fun putExtensionHandlerMapping(
|
fun putExtensionHandlerMapping(
|
||||||
modes: Set<MappingMode>,
|
modes: Set<MappingMode>,
|
||||||
fromKeys: List<KeyStroke>,
|
fromKeys: List<KeyStroke>,
|
||||||
@@ -110,7 +118,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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,7 +137,7 @@ object VimExtensionFacade {
|
|||||||
/** Returns a single key stroke from the user input similar to 'getchar()'. */
|
/** Returns a single key stroke from the user input similar to 'getchar()'. */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun inputKeyStroke(editor: Editor): KeyStroke {
|
fun inputKeyStroke(editor: Editor): KeyStroke {
|
||||||
if (editor.vim.commandState.isDotRepeatInProgress) {
|
if (editor.vim.vimStateMachine.isDotRepeatInProgress) {
|
||||||
val input = Extension.consumeKeystroke()
|
val input = Extension.consumeKeystroke()
|
||||||
return input ?: error("Not enough keystrokes saved: ${Extension.lastExtensionHandler}")
|
return input ?: error("Not enough keystrokes saved: ${Extension.lastExtensionHandler}")
|
||||||
}
|
}
|
||||||
@@ -137,7 +145,7 @@ object VimExtensionFacade {
|
|||||||
val key: KeyStroke? = if (ApplicationManager.getApplication().isUnitTestMode) {
|
val key: KeyStroke? = if (ApplicationManager.getApplication().isUnitTestMode) {
|
||||||
val mappingStack = KeyHandler.getInstance().keyStack
|
val mappingStack = KeyHandler.getInstance().keyStack
|
||||||
mappingStack.feedSomeStroke() ?: TestInputModel.getInstance(editor).nextKeyStroke()?.also {
|
mappingStack.feedSomeStroke() ?: TestInputModel.getInstance(editor).nextKeyStroke()?.also {
|
||||||
if (editor.vim.commandState.isRecording) {
|
if (editor.vim.vimStateMachine.isRecording) {
|
||||||
KeyHandler.getInstance().modalEntryKeys += it
|
KeyHandler.getInstance().modalEntryKeys += it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,12 +175,24 @@ object VimExtensionFacade {
|
|||||||
return reg.keys
|
return reg.keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getRegisterForCaret(register: Char, caret: VimCaret): List<KeyStroke>? {
|
||||||
|
val reg = caret.registerStorage.getRegister(caret, register) ?: return null
|
||||||
|
return reg.keys
|
||||||
|
}
|
||||||
|
|
||||||
/** Set the current contents of the given register */
|
/** Set the current contents of the given register */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setRegister(register: Char, keys: List<KeyStroke?>?) {
|
fun setRegister(register: Char, keys: List<KeyStroke?>?) {
|
||||||
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList())
|
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set the current contents of the given register */
|
||||||
|
@JvmStatic
|
||||||
|
fun setRegisterForCaret(register: Char, caret: ImmutableVimCaret, keys: List<KeyStroke?>?) {
|
||||||
|
caret.registerStorage.setKeys(caret, register, keys?.filterNotNull() ?: emptyList())
|
||||||
|
}
|
||||||
|
|
||||||
/** Set the current contents of the given register */
|
/** Set the current contents of the given register */
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
||||||
|
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.maddyhome.idea.vim.extension
|
||||||
|
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.editor.Editor
|
||||||
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
|
|
||||||
|
/**
|
||||||
|
* COMPATIBILITY-LAYER: Created a class, renamed original class
|
||||||
|
* Please see: https://jb.gg/zo8n0r
|
||||||
|
*/
|
||||||
|
interface VimExtensionHandler : ExtensionHandler {
|
||||||
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
|
execute(editor.ij, context.ij)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun execute(editor: Editor, context: DataContext)
|
||||||
|
|
||||||
|
abstract class WithCallback : ExtensionHandler.WithCallback(), VimExtensionHandler
|
||||||
|
}
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension
|
package com.maddyhome.idea.vim.extension
|
||||||
|
|
||||||
@@ -25,9 +15,9 @@ import com.maddyhome.idea.vim.api.VimExtensionRegistrator
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.ex.ExException
|
import com.maddyhome.idea.vim.ex.ExException
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner.Plugin.Companion.remove
|
import com.maddyhome.idea.vim.key.MappingOwner.Plugin.Companion.remove
|
||||||
|
import com.maddyhome.idea.vim.option.ToggleOption
|
||||||
import com.maddyhome.idea.vim.options.OptionChangeListener
|
import com.maddyhome.idea.vim.options.OptionChangeListener
|
||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.OptionScope
|
||||||
import com.maddyhome.idea.vim.options.ToggleOption
|
|
||||||
import com.maddyhome.idea.vim.statistic.PluginState
|
import com.maddyhome.idea.vim.statistic.PluginState
|
||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
||||||
|
|
||||||
|
@@ -1,44 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.argtextobj;
|
package com.maddyhome.idea.vim.extension.argtextobj;
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext;
|
|
||||||
import com.intellij.openapi.editor.Caret;
|
|
||||||
import com.intellij.openapi.editor.Document;
|
import com.intellij.openapi.editor.Document;
|
||||||
import com.intellij.openapi.editor.Editor;
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
import com.maddyhome.idea.vim.api.*;
|
import com.maddyhome.idea.vim.api.*;
|
||||||
import com.maddyhome.idea.vim.command.*;
|
import com.maddyhome.idea.vim.command.*;
|
||||||
import com.maddyhome.idea.vim.common.MappingMode;
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
|
import com.maddyhome.idea.vim.extension.ExtensionHandler;
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension;
|
import com.maddyhome.idea.vim.extension.VimExtension;
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler;
|
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler;
|
||||||
import com.maddyhome.idea.vim.helper.InlayHelperKt;
|
import com.maddyhome.idea.vim.helper.InlayHelperKt;
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper;
|
import com.maddyhome.idea.vim.helper.MessageHelper;
|
||||||
import com.maddyhome.idea.vim.helper.VimNlsSafe;
|
import com.maddyhome.idea.vim.helper.VimNlsSafe;
|
||||||
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
|
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor;
|
||||||
import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
|
import com.maddyhome.idea.vim.listener.VimListenerSuppressor;
|
||||||
import com.maddyhome.idea.vim.newapi.IjExecutionContext;
|
|
||||||
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;
|
||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString;
|
||||||
|
import kotlin.Unit;
|
||||||
import org.jetbrains.annotations.Nls;
|
import org.jetbrains.annotations.Nls;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -48,8 +34,7 @@ import java.util.Deque;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
import static com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping;
|
import static com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping;
|
||||||
import static com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping;
|
import static com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing;
|
||||||
import static com.maddyhome.idea.vim.group.visual.VisualGroupKt.vimSetSelection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author igrekster
|
* @author igrekster
|
||||||
@@ -68,9 +53,8 @@ public class VimArgTextObjExtension implements VimExtension {
|
|||||||
putExtensionHandlerMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("<Plug>InnerArgument"), getOwner(), new VimArgTextObjExtension.ArgumentHandler(true), false);
|
putExtensionHandlerMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("<Plug>InnerArgument"), getOwner(), new VimArgTextObjExtension.ArgumentHandler(true), false);
|
||||||
putExtensionHandlerMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("<Plug>OuterArgument"), getOwner(), new VimArgTextObjExtension.ArgumentHandler(false), false);
|
putExtensionHandlerMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("<Plug>OuterArgument"), getOwner(), new VimArgTextObjExtension.ArgumentHandler(false), false);
|
||||||
|
|
||||||
putKeyMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("ia"), getOwner(), VimInjectorKt.getInjector().getParser().parseKeys("<Plug>InnerArgument"), true);
|
putKeyMappingIfMissing(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("ia"), getOwner(), VimInjectorKt.getInjector().getParser().parseKeys("<Plug>InnerArgument"), true);
|
||||||
putKeyMapping(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("aa"), getOwner(), VimInjectorKt.getInjector().getParser().parseKeys("<Plug>OuterArgument"), true);
|
putKeyMappingIfMissing(MappingMode.XO, VimInjectorKt.getInjector().getParser().parseKeys("aa"), getOwner(), VimInjectorKt.getInjector().getParser().parseKeys("<Plug>OuterArgument"), true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,8 +161,8 @@ public class VimArgTextObjExtension implements VimExtension {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private static String bracketPairsVariable() {
|
private static String bracketPairsVariable() {
|
||||||
final Object value = VimPlugin.getVariableService().getGlobalVariableValue("argtextobj_pairs");
|
final Object value = VimPlugin.getVariableService().getGlobalVariableValue("argtextobj_pairs");
|
||||||
if (value instanceof VimString) {
|
if (value instanceof VimString vimValue) {
|
||||||
return ((VimString)value).getValue();
|
return vimValue.getValue();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -186,7 +170,7 @@ public class VimArgTextObjExtension implements VimExtension {
|
|||||||
/**
|
/**
|
||||||
* A text object for an argument to a function definition or a call.
|
* A text object for an argument to a function definition or a call.
|
||||||
*/
|
*/
|
||||||
static class ArgumentHandler implements VimExtensionHandler {
|
static class ArgumentHandler implements ExtensionHandler {
|
||||||
final boolean isInner;
|
final boolean isInner;
|
||||||
|
|
||||||
ArgumentHandler(boolean isInner) {
|
ArgumentHandler(boolean isInner) {
|
||||||
@@ -209,7 +193,7 @@ public class VimArgTextObjExtension implements VimExtension {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public TextRange getRange(@NotNull VimEditor editor,
|
public TextRange getRange(@NotNull VimEditor editor,
|
||||||
@NotNull VimCaret caret,
|
@NotNull ImmutableVimCaret caret,
|
||||||
@NotNull ExecutionContext context,
|
@NotNull ExecutionContext context,
|
||||||
int count,
|
int count,
|
||||||
int rawCount,
|
int rawCount,
|
||||||
@@ -262,28 +246,28 @@ public class VimArgTextObjExtension implements VimExtension {
|
|||||||
public void execute(@NotNull VimEditor editor, @NotNull ExecutionContext context) {
|
public void execute(@NotNull VimEditor editor, @NotNull ExecutionContext context) {
|
||||||
|
|
||||||
IjVimEditor vimEditor = (IjVimEditor) editor;
|
IjVimEditor vimEditor = (IjVimEditor) editor;
|
||||||
@NotNull CommandState commandState = CommandState.getInstance(vimEditor);
|
@NotNull VimStateMachine vimStateMachine = VimStateMachine.getInstance(vimEditor);
|
||||||
int count = Math.max(1, commandState.getCommandBuilder().getCount());
|
int count = Math.max(1, vimStateMachine.getCommandBuilder().getCount());
|
||||||
|
|
||||||
final ArgumentTextObjectHandler textObjectHandler = new ArgumentTextObjectHandler(isInner);
|
final ArgumentTextObjectHandler textObjectHandler = new ArgumentTextObjectHandler(isInner);
|
||||||
//noinspection DuplicatedCode
|
//noinspection DuplicatedCode
|
||||||
if (!commandState.isOperatorPending()) {
|
if (!vimStateMachine.isOperatorPending()) {
|
||||||
vimEditor.getEditor().getCaretModel().runForEachCaret((Caret caret) -> {
|
editor.forEachNativeCaret((VimCaret caret) -> {
|
||||||
final TextRange range = textObjectHandler.getRange(vimEditor, new IjVimCaret(caret), context, count, 0, null);
|
final TextRange range = textObjectHandler.getRange(editor, caret, context, count, 0, null);
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
try (VimListenerSuppressor.Locked ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
|
try (VimListenerSuppressor.Locked ignored = SelectionVimListenerSuppressor.INSTANCE.lock()) {
|
||||||
if (commandState.getMode() == CommandState.Mode.VISUAL) {
|
if (vimStateMachine.getMode() == VimStateMachine.Mode.VISUAL) {
|
||||||
vimSetSelection(caret, range.getStartOffset(), range.getEndOffset() - 1, true);
|
com.maddyhome.idea.vim.group.visual.EngineVisualGroupKt.vimSetSelection(caret, range.getStartOffset(), range.getEndOffset() - 1, true);
|
||||||
} else {
|
} else {
|
||||||
InlayHelperKt.moveToInlayAwareOffset(caret, range.getStartOffset());
|
InlayHelperKt.moveToInlayAwareOffset(((IjVimCaret)caret).getCaret(), range.getStartOffset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Unit.INSTANCE;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
commandState.getCommandBuilder().completeCommandPart(new Argument(new Command(count,
|
vimStateMachine.getCommandBuilder().completeCommandPart(new Argument(new Command(count,
|
||||||
textObjectHandler, Command.Type.MOTION, EnumSet.noneOf(CommandFlags.class))));
|
textObjectHandler, Command.Type.MOTION, EnumSet.noneOf(CommandFlags.class))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,26 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.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
|
||||||
@@ -28,19 +19,21 @@ import com.intellij.psi.PsiWhiteSpace
|
|||||||
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.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.getLineEndOffset
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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
|
||||||
import com.maddyhome.idea.vim.command.CommandState
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.SelectionType
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
import com.maddyhome.idea.vim.common.MappingMode
|
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
||||||
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
@@ -48,11 +41,9 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMa
|
|||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
|
||||||
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
|
||||||
import com.maddyhome.idea.vim.helper.PsiHelper
|
import com.maddyhome.idea.vim.helper.PsiHelper
|
||||||
import com.maddyhome.idea.vim.helper.commandState
|
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
|
||||||
@@ -62,41 +53,60 @@ 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(
|
||||||
val mode = editor.commandState.mode
|
editor: VimEditor,
|
||||||
if (mode !== CommandState.Mode.VISUAL) {
|
context: ExecutionContext,
|
||||||
|
range: TextRange,
|
||||||
|
selectionType: SelectionType,
|
||||||
|
resetCaret: Boolean,
|
||||||
|
): Boolean {
|
||||||
|
val mode = editor.vimStateMachine.mode
|
||||||
|
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 !== CommandState.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 +122,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
|
||||||
@@ -129,17 +145,22 @@ class CommentaryExtension : VimExtension {
|
|||||||
* E.g. handles the `gc` in `gc_`, by setting the operator function, then invoking `g@` to receive the `_` motion to
|
* E.g. handles the `gc` in `gc_`, by setting the operator function, then invoking `g@` to receive the `_` motion to
|
||||||
* invoke the operator. This object is both the mapping handler and the operator function.
|
* invoke the operator. This object is both the mapping handler and the operator function.
|
||||||
*/
|
*/
|
||||||
private class CommentaryOperatorHandler : OperatorFunction, VimExtensionHandler {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,11 +169,11 @@ class CommentaryExtension : VimExtension {
|
|||||||
*
|
*
|
||||||
* This object is both the `<Plug>Commentary` mapping handler and the text object handler
|
* This object is both the `<Plug>Commentary` mapping handler and the text object handler
|
||||||
*/
|
*/
|
||||||
private class CommentaryTextObjectMotionHandler : TextObjectActionHandler(), VimExtensionHandler {
|
private class CommentaryTextObjectMotionHandler : TextObjectActionHandler(), ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
val commandState = editor.commandState
|
val commandState = editor.vimStateMachine
|
||||||
val count = maxOf(1, commandState.commandBuilder.count)
|
val count = maxOf(1, commandState.commandBuilder.count)
|
||||||
|
|
||||||
val textObjectHandler = this
|
val textObjectHandler = this
|
||||||
@@ -170,25 +191,25 @@ class CommentaryExtension : VimExtension {
|
|||||||
|
|
||||||
override fun getRange(
|
override fun getRange(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
caret: VimCaret,
|
caret: ImmutableVimCaret,
|
||||||
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
|
||||||
val file = PsiHelper.getFile(nativeEditor) ?: return null
|
val file = PsiHelper.getFile(nativeEditor) ?: return null
|
||||||
val lastLine = editor.lineCount()
|
val lastLine = editor.lineCount()
|
||||||
|
|
||||||
var startLine = caret.getLogicalPosition().line
|
var startLine = caret.getBufferPosition().line
|
||||||
while (startLine > 0 && isCommentLine(file, nativeEditor, startLine - 1)) startLine--
|
while (startLine > 0 && isCommentLine(file, nativeEditor, startLine - 1)) startLine--
|
||||||
var endLine = caret.getLogicalPosition().line - 1
|
var endLine = caret.getBufferPosition().line - 1
|
||||||
while (endLine < lastLine && isCommentLine(file, nativeEditor, endLine + 1)) endLine++
|
while (endLine < lastLine && isCommentLine(file, nativeEditor, endLine + 1)) endLine++
|
||||||
|
|
||||||
if (startLine <= endLine) {
|
if (startLine <= endLine) {
|
||||||
val startOffset = EditorHelper.getLineStartOffset(nativeEditor, startLine)
|
val startOffset = editor.getLineStartOffset(startLine)
|
||||||
val endOffset = EditorHelper.getLineStartOffset(nativeEditor, endLine + 1)
|
val endOffset = editor.getLineStartOffset(endLine + 1)
|
||||||
return TextRange(startOffset, endOffset)
|
return TextRange(startOffset, endOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +218,8 @@ class CommentaryExtension : VimExtension {
|
|||||||
|
|
||||||
// Check all leaf nodes in the given line are whitespace, comments, or are owned by comments
|
// Check all leaf nodes in the given line are whitespace, comments, or are owned by comments
|
||||||
private fun isCommentLine(file: PsiFile, editor: Editor, logicalLine: Int): Boolean {
|
private fun isCommentLine(file: PsiFile, editor: Editor, logicalLine: Int): Boolean {
|
||||||
val startOffset = EditorHelper.getLineStartOffset(editor, logicalLine)
|
val startOffset = editor.vim.getLineStartOffset(logicalLine)
|
||||||
val endOffset = EditorHelper.getLineEndOffset(editor, logicalLine, true)
|
val endOffset = editor.vim.getLineEndOffset(logicalLine, true)
|
||||||
val startElement = file.findElementAt(startOffset) ?: return false
|
val startElement = file.findElementAt(startOffset) ?: return false
|
||||||
var next: PsiElement? = startElement
|
var next: PsiElement? = startElement
|
||||||
while (next != null && next.textRange.startOffset <= endOffset) {
|
while (next != null && next.textRange.startOffset <= endOffset) {
|
||||||
|
@@ -1,24 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.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
|
||||||
@@ -30,11 +19,13 @@ import com.intellij.openapi.util.Key
|
|||||||
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.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.getOffset
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.CommandState
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.SelectionType
|
import com.maddyhome.idea.vim.command.SelectionType
|
||||||
import com.maddyhome.idea.vim.common.MappingMode
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
||||||
@@ -42,8 +33,6 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMa
|
|||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
|
||||||
import com.maddyhome.idea.vim.helper.fileSize
|
import com.maddyhome.idea.vim.helper.fileSize
|
||||||
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
|
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
|
||||||
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
|
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
|
||||||
@@ -51,6 +40,7 @@ import com.maddyhome.idea.vim.helper.subMode
|
|||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.mark.Mark
|
import com.maddyhome.idea.vim.mark.Mark
|
||||||
import com.maddyhome.idea.vim.mark.VimMarkConstants
|
import com.maddyhome.idea.vim.mark.VimMarkConstants
|
||||||
|
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 com.maddyhome.idea.vim.newapi.vim
|
||||||
import org.jetbrains.annotations.NonNls
|
import org.jetbrains.annotations.NonNls
|
||||||
@@ -95,7 +85,7 @@ class VimExchangeExtension : VimExtension {
|
|||||||
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
||||||
|
|
||||||
// End mark has always greater of eq offset than start mark
|
// End mark has always greater of eq offset than start mark
|
||||||
class Exchange(val type: CommandState.SubMode, val start: Mark, val end: Mark, val text: String) {
|
class Exchange(val type: VimStateMachine.SubMode, val start: Mark, val end: Mark, val text: String) {
|
||||||
private var myHighlighter: RangeHighlighter? = null
|
private var myHighlighter: RangeHighlighter? = null
|
||||||
fun setHighlighter(highlighter: RangeHighlighter) {
|
fun setHighlighter(highlighter: RangeHighlighter) {
|
||||||
myHighlighter = highlighter
|
myHighlighter = highlighter
|
||||||
@@ -112,7 +102,7 @@ class VimExchangeExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExchangeHandler(private val isLine: Boolean) : VimExtensionHandler {
|
private class ExchangeHandler(private val isLine: Boolean) : ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
@@ -121,37 +111,38 @@ class VimExchangeExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExchangeClearHandler : VimExtensionHandler {
|
private class ExchangeClearHandler : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
clearExchange(editor.ij)
|
clearExchange(editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VExchangeHandler : VimExtensionHandler {
|
private class VExchangeHandler : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Operator(private val isVisual: Boolean) : OperatorFunction {
|
private class Operator(private val isVisual: Boolean) : OperatorFunction {
|
||||||
fun Editor.getMarkOffset(mark: Mark) = EditorHelper.getOffset(this, mark.logicalLine, mark.col)
|
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
|
||||||
fun CommandState.SubMode.getString() = when (this) {
|
fun VimStateMachine.SubMode.getString() = when (this) {
|
||||||
CommandState.SubMode.VISUAL_CHARACTER -> "v"
|
VimStateMachine.SubMode.VISUAL_CHARACTER -> "v"
|
||||||
CommandState.SubMode.VISUAL_LINE -> "V"
|
VimStateMachine.SubMode.VISUAL_LINE -> "V"
|
||||||
CommandState.SubMode.VISUAL_BLOCK -> "\\<C-V>"
|
VimStateMachine.SubMode.VISUAL_BLOCK -> "\\<C-V>"
|
||||||
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) {
|
||||||
CommandState.SubMode.VISUAL_LINE -> HighlighterTargetArea.LINES_IN_RANGE
|
VimStateMachine.SubMode.VISUAL_LINE -> HighlighterTargetArea.LINES_IN_RANGE
|
||||||
// TODO: handle other modes
|
// TODO: handle other modes
|
||||||
else -> HighlighterTargetArea.EXACT_RANGE
|
else -> HighlighterTargetArea.EXACT_RANGE
|
||||||
}
|
}
|
||||||
@@ -217,19 +208,19 @@ class VimExchangeExtension : VimExtension {
|
|||||||
if (reverse) {
|
if (reverse) {
|
||||||
primaryCaret.moveToInlayAwareOffset(editor.getMarkOffset(ex1.start))
|
primaryCaret.moveToInlayAwareOffset(editor.getMarkOffset(ex1.start))
|
||||||
} else {
|
} else {
|
||||||
if (ex1.start.logicalLine == ex2.start.logicalLine) {
|
if (ex1.start.line == ex2.start.line) {
|
||||||
val horizontalOffset = ex1.end.col - ex2.end.col
|
val horizontalOffset = ex1.end.col - ex2.end.col
|
||||||
primaryCaret.moveToInlayAwareLogicalPosition(
|
primaryCaret.moveToInlayAwareLogicalPosition(
|
||||||
LogicalPosition(
|
LogicalPosition(
|
||||||
ex1.start.logicalLine,
|
ex1.start.line,
|
||||||
ex1.start.col - horizontalOffset
|
ex1.start.col - horizontalOffset
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} else if (ex1.end.logicalLine - ex1.start.logicalLine != ex2.end.logicalLine - ex2.start.logicalLine) {
|
} else if (ex1.end.line - ex1.start.line != ex2.end.line - ex2.start.line) {
|
||||||
val verticalOffset = ex1.end.logicalLine - ex2.end.logicalLine
|
val verticalOffset = ex1.end.line - ex2.end.line
|
||||||
primaryCaret.moveToInlayAwareLogicalPosition(
|
primaryCaret.moveToInlayAwareLogicalPosition(
|
||||||
LogicalPosition(
|
LogicalPosition(
|
||||||
ex1.start.logicalLine - verticalOffset,
|
ex1.start.line - verticalOffset,
|
||||||
ex1.start.col
|
ex1.start.col
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -262,19 +253,19 @@ class VimExchangeExtension : VimExtension {
|
|||||||
|
|
||||||
private fun compareExchanges(x: Exchange, y: Exchange): ExchangeCompareResult {
|
private fun compareExchanges(x: Exchange, y: Exchange): ExchangeCompareResult {
|
||||||
fun intersects(x: Exchange, y: Exchange) =
|
fun intersects(x: Exchange, y: Exchange) =
|
||||||
x.end.logicalLine < y.start.logicalLine ||
|
x.end.line < y.start.line ||
|
||||||
x.start.logicalLine > y.end.logicalLine ||
|
x.start.line > y.end.line ||
|
||||||
x.end.col < y.start.col ||
|
x.end.col < y.start.col ||
|
||||||
x.start.col > y.end.col
|
x.start.col > y.end.col
|
||||||
|
|
||||||
fun comparePos(x: Mark, y: Mark): Int =
|
fun comparePos(x: Mark, y: Mark): Int =
|
||||||
if (x.logicalLine == y.logicalLine) {
|
if (x.line == y.line) {
|
||||||
x.col - y.col
|
x.col - y.col
|
||||||
} else {
|
} else {
|
||||||
x.logicalLine - y.logicalLine
|
x.line - y.line
|
||||||
}
|
}
|
||||||
|
|
||||||
return if (x.type == CommandState.SubMode.VISUAL_BLOCK && y.type == CommandState.SubMode.VISUAL_BLOCK) {
|
return if (x.type == VimStateMachine.SubMode.VISUAL_BLOCK && y.type == VimStateMachine.SubMode.VISUAL_BLOCK) {
|
||||||
when {
|
when {
|
||||||
intersects(x, y) -> {
|
intersects(x, y) -> {
|
||||||
ExchangeCompareResult.OVERLAP
|
ExchangeCompareResult.OVERLAP
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.highlightedyank
|
package com.maddyhome.idea.vim.extension.highlightedyank
|
||||||
@@ -31,15 +21,15 @@ import com.intellij.openapi.editor.markup.TextAttributes
|
|||||||
import com.intellij.openapi.util.Disposer
|
import com.intellij.openapi.util.Disposer
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.VimProjectService
|
import com.maddyhome.idea.vim.VimProjectService
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||||
import com.maddyhome.idea.vim.helper.VimNlsSafe
|
import com.maddyhome.idea.vim.helper.VimNlsSafe
|
||||||
import com.maddyhome.idea.vim.listener.VimInsertListener
|
import com.maddyhome.idea.vim.listener.VimInsertListener
|
||||||
import com.maddyhome.idea.vim.listener.VimYankListener
|
import com.maddyhome.idea.vim.listener.VimYankListener
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.options.OptionScope
|
import com.maddyhome.idea.vim.options.helpers.StrictMode
|
||||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||||
import org.jetbrains.annotations.NonNls
|
import org.jetbrains.annotations.NonNls
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
@@ -101,8 +91,8 @@ class VimHighlightedYank : VimExtension, VimYankListener, VimInsertListener {
|
|||||||
VimPlugin.getChange().removeInsertListener(this)
|
VimPlugin.getChange().removeInsertListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun yankPerformed(editor: Editor, range: TextRange) {
|
override fun yankPerformed(editor: VimEditor, range: TextRange) {
|
||||||
highlightHandler.highlightYankRange(editor, range)
|
highlightHandler.highlightYankRange(editor.ij, range)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun insertModeStarted(editor: Editor) {
|
override fun insertModeStarted(editor: Editor) {
|
||||||
@@ -139,18 +129,12 @@ class VimHighlightedYank : VimExtension, VimYankListener, VimInsertListener {
|
|||||||
|
|
||||||
fun clearAllYankHighlighters() {
|
fun clearAllYankHighlighters() {
|
||||||
yankHighlighters.forEach { highlighter ->
|
yankHighlighters.forEach { highlighter ->
|
||||||
editor?.markupModel?.removeHighlighter(highlighter) ?: failIfStrictMode("Highlighters without an editor")
|
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
|
||||||
}
|
}
|
||||||
|
|
||||||
yankHighlighters.clear()
|
yankHighlighters.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun failIfStrictMode(value: String) {
|
|
||||||
if (injector.optionService.isSet(OptionScope.GLOBAL, OptionConstants.ideastrictmodeName)) {
|
|
||||||
error(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun highlightSingleRange(editor: Editor, range: ClosedRange<Int>) {
|
private fun highlightSingleRange(editor: Editor, range: ClosedRange<Int>) {
|
||||||
val highlighter = editor.markupModel.addRangeHighlighter(
|
val highlighter = editor.markupModel.addRangeHighlighter(
|
||||||
range.start,
|
range.start,
|
||||||
@@ -173,7 +157,7 @@ class VimHighlightedYank : VimExtension, VimYankListener, VimInsertListener {
|
|||||||
Executors.newSingleThreadScheduledExecutor().schedule(
|
Executors.newSingleThreadScheduledExecutor().schedule(
|
||||||
{
|
{
|
||||||
ApplicationManager.getApplication().invokeLater {
|
ApplicationManager.getApplication().invokeLater {
|
||||||
editor?.markupModel?.removeHighlighter(highlighter) ?: failIfStrictMode("Highlighters without an editor")
|
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
timeout, TimeUnit.MILLISECONDS
|
timeout, TimeUnit.MILLISECONDS
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.matchit
|
package com.maddyhome.idea.vim.extension.matchit
|
||||||
@@ -27,27 +17,32 @@ import com.intellij.psi.util.PsiTreeUtil
|
|||||||
import com.intellij.psi.util.elementType
|
import com.intellij.psi.util.elementType
|
||||||
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.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.getLineEndForOffset
|
||||||
|
import com.maddyhome.idea.vim.api.getLineEndOffset
|
||||||
|
import com.maddyhome.idea.vim.api.getLineStartForOffset
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.api.normalizeOffset
|
||||||
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
|
||||||
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.MotionType
|
import com.maddyhome.idea.vim.command.MotionType
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.common.MappingMode
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
|
||||||
import com.maddyhome.idea.vim.handler.Motion
|
import com.maddyhome.idea.vim.handler.Motion
|
||||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
import com.maddyhome.idea.vim.helper.EditorHelper
|
||||||
import com.maddyhome.idea.vim.helper.PsiHelper
|
import com.maddyhome.idea.vim.helper.PsiHelper
|
||||||
import com.maddyhome.idea.vim.helper.commandState
|
|
||||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||||
|
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||||
|
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 com.maddyhome.idea.vim.newapi.vim
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -79,7 +74,7 @@ class Matchit : VimExtension {
|
|||||||
|
|
||||||
override fun getOffset(
|
override fun getOffset(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
caret: VimCaret,
|
caret: ImmutableVimCaret,
|
||||||
context: ExecutionContext,
|
context: ExecutionContext,
|
||||||
argument: Argument?,
|
argument: Argument?,
|
||||||
operatorArguments: OperatorArguments,
|
operatorArguments: OperatorArguments,
|
||||||
@@ -94,14 +89,14 @@ class Matchit : VimExtension {
|
|||||||
override var motionType: MotionType = MotionType.INCLUSIVE
|
override var motionType: MotionType = MotionType.INCLUSIVE
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MatchitHandler(private val reverse: Boolean) : VimExtensionHandler {
|
private class MatchitHandler(private val reverse: Boolean) : ExtensionHandler {
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
val commandState = editor.commandState
|
val commandState = editor.vimStateMachine
|
||||||
val count = commandState.commandBuilder.count
|
val count = commandState.commandBuilder.count
|
||||||
|
|
||||||
// Reset the command count so it doesn't transfer onto subsequent commands.
|
// Reset the command count so it doesn't transfer onto subsequent commands.
|
||||||
editor.commandState.commandBuilder.resetCount()
|
editor.vimStateMachine.commandBuilder.resetCount()
|
||||||
|
|
||||||
// Normally we want to jump to the start of the matching pair. But when moving forward in operator
|
// Normally we want to jump to the start of the matching pair. But when moving forward in operator
|
||||||
// pending mode, we want to include the entire match. isInOpPending makes that distinction.
|
// pending mode, we want to include the entire match. isInOpPending makes that distinction.
|
||||||
@@ -123,7 +118,7 @@ class Matchit : VimExtension {
|
|||||||
} else {
|
} else {
|
||||||
editor.forEachCaret { caret ->
|
editor.forEachCaret { caret ->
|
||||||
VimPlugin.getMark().saveJumpLocation(editor)
|
VimPlugin.getMark().saveJumpLocation(editor)
|
||||||
injector.motion.moveCaret(editor, caret, getMatchitOffset(editor.ij, caret.ij, count, isInOpPending, reverse))
|
caret.moveToOffset(getMatchitOffset(editor.ij, caret.ij, count, isInOpPending, reverse))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,12 +228,13 @@ 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val htmlLikeFileTypes = setOf(
|
private val htmlLikeFileTypes = setOf(
|
||||||
"HTML", "XML", "XHTML", "JSP", "JavaScript", "JSX Harmony", "TypeScript", "TypeScript JSX", "Vue.js", "Handlebars/Mustache"
|
"HTML", "XML", "XHTML", "JSP", "JavaScript", "JSX Harmony", "TypeScript",
|
||||||
|
"TypeScript JSX", "Vue.js", "Handlebars/Mustache", "Razor"
|
||||||
)
|
)
|
||||||
|
|
||||||
private val htmlPatterns = createHtmlPatterns()
|
private val htmlPatterns = createHtmlPatterns()
|
||||||
@@ -326,7 +322,7 @@ private fun getMatchitOffset(editor: Editor, caret: Caret, count: Int, isInOpPen
|
|||||||
var caretOffset = caret.offset
|
var caretOffset = caret.offset
|
||||||
|
|
||||||
// Handle the case where visual mode has brought the cursor past the end of the line.
|
// Handle the case where visual mode has brought the cursor past the end of the line.
|
||||||
val lineEndOffset = EditorHelper.getLineEndOffset(editor, caret.logicalPosition.line, true)
|
val lineEndOffset = editor.vim.getLineEndOffset(caret.logicalPosition.line, true)
|
||||||
if (caretOffset > 0 && caretOffset == lineEndOffset) {
|
if (caretOffset > 0 && caretOffset == lineEndOffset) {
|
||||||
caretOffset--
|
caretOffset--
|
||||||
}
|
}
|
||||||
@@ -359,7 +355,7 @@ private fun getMatchitOffset(editor: Editor, caret: Caret, count: Int, isInOpPen
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (motion >= 0) {
|
if (motion >= 0) {
|
||||||
motion = EditorHelper.normalizeOffset(editor, motion, false)
|
motion = editor.vim.normalizeOffset(motion, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return motion
|
return motion
|
||||||
@@ -374,8 +370,8 @@ private fun findMatchingPair(
|
|||||||
): Int {
|
): Int {
|
||||||
// For better performance, we limit our search to the current line. This way we don't have to scan the entire file
|
// For better performance, we limit our search to the current line. This way we don't have to scan the entire file
|
||||||
// to determine if we're on a pattern or not. The original plugin behaves the same way.
|
// to determine if we're on a pattern or not. The original plugin behaves the same way.
|
||||||
val currentLineStart = EditorHelper.getLineStartForOffset(editor, caretOffset)
|
val currentLineStart = IjVimEditor(editor).getLineStartForOffset(caretOffset)
|
||||||
val currentLineEnd = EditorHelper.getLineEndForOffset(editor, caretOffset)
|
val currentLineEnd = IjVimEditor(editor).getLineEndForOffset(caretOffset)
|
||||||
val currentLineChars = editor.document.charsSequence.subSequence(currentLineStart, currentLineEnd)
|
val currentLineChars = editor.document.charsSequence.subSequence(currentLineStart, currentLineEnd)
|
||||||
val offset = caretOffset - currentLineStart
|
val offset = caretOffset - currentLineStart
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.multiplecursors
|
package com.maddyhome.idea.vim.extension.multiplecursors
|
||||||
@@ -28,17 +18,17 @@ import com.maddyhome.idea.vim.KeyHandler
|
|||||||
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.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
|
import com.maddyhome.idea.vim.api.getText
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.CommandState
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.common.MappingMode
|
import com.maddyhome.idea.vim.command.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
|
||||||
import com.maddyhome.idea.vim.group.MotionGroup
|
import com.maddyhome.idea.vim.group.MotionGroup
|
||||||
import com.maddyhome.idea.vim.group.visual.vimSetSelection
|
import com.maddyhome.idea.vim.group.visual.vimSetSelection
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper
|
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||||
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
|
||||||
@@ -111,7 +101,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("<A-p>"), owner, injector.parser.parseKeys(REMOVE_OCCURRENCE), true)
|
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("<A-p>"), owner, injector.parser.parseKeys(REMOVE_OCCURRENCE), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class WriteActionHandler : VimExtensionHandler {
|
abstract class WriteActionHandler : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
override fun execute(editor: VimEditor, context: ExecutionContext) {
|
||||||
ApplicationManager.getApplication().runWriteAction {
|
ApplicationManager.getApplication().runWriteAction {
|
||||||
executeInWriteAction(editor.ij, context.ij)
|
executeInWriteAction(editor.ij, context.ij)
|
||||||
@@ -167,12 +157,12 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
for (line in startPosition.line + 1..startPosition.line + lines) {
|
for (line in startPosition.line + 1..startPosition.line + lines) {
|
||||||
newPositions.add(VisualPosition(line, startPosition.column))
|
newPositions.add(VisualPosition(line, startPosition.column))
|
||||||
}
|
}
|
||||||
MotionGroup.moveCaret(editor, caret, selectionStart)
|
caret.vim.moveToOffset(selectionStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newPositions.size > 0) {
|
if (newPositions.size > 0) {
|
||||||
editor.exitVisualMode()
|
editor.vim.exitVisualMode()
|
||||||
newPositions.forEach { editor.caretModel.addCaret(it, true) ?: return }
|
newPositions.forEach { editor.caretModel.addCaret(it, true) ?: return }
|
||||||
editor.updateCaretsVisualAttributes()
|
editor.updateCaretsVisualAttributes()
|
||||||
return
|
return
|
||||||
@@ -205,7 +195,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
|
|
||||||
// Always work on the text in the last visual selection range, so we work with any changed text, even if it's no
|
// Always work on the text in the last visual selection range, so we work with any changed text, even if it's no
|
||||||
// longer selected
|
// longer selected
|
||||||
val pattern = EditorHelper.getText(editor, lastSelection)
|
val pattern = editor.vim.getText(lastSelection)
|
||||||
|
|
||||||
val primaryCaret = editor.caretModel.primaryCaret
|
val primaryCaret = editor.caretModel.primaryCaret
|
||||||
val nextOffset = findNextOccurrence(editor, primaryCaret.offset, pattern, wholeWord)
|
val nextOffset = findNextOccurrence(editor, primaryCaret.offset, pattern, wholeWord)
|
||||||
@@ -238,7 +228,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
} else {
|
} else {
|
||||||
val range = SearchHelper.findWordUnderCursor(editor, primaryCaret) ?: return
|
val range = SearchHelper.findWordUnderCursor(editor, primaryCaret) ?: return
|
||||||
if (range.startOffset > primaryCaret.offset) return
|
if (range.startOffset > primaryCaret.offset) return
|
||||||
EditorHelper.getText(editor, range)
|
IjVimEditor(editor).getText(range)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!editor.inVisualMode) {
|
if (!editor.inVisualMode) {
|
||||||
@@ -250,7 +240,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
val matches = SearchHelper.findAll(editor, pattern, 0, -1, false)
|
val matches = SearchHelper.findAll(editor, pattern, 0, -1, false)
|
||||||
for (match in matches) {
|
for (match in matches) {
|
||||||
if (match.contains(primaryCaret.offset)) {
|
if (match.contains(primaryCaret.offset)) {
|
||||||
MotionGroup.moveCaret(editor, primaryCaret, match.startOffset)
|
primaryCaret.vim.moveToOffset(match.startOffset)
|
||||||
selectText(primaryCaret, text, match.startOffset)
|
selectText(primaryCaret, text, match.startOffset)
|
||||||
} else {
|
} else {
|
||||||
val caret = editor.caretModel.addCaret(editor.offsetToVisualPosition(match.startOffset), true) ?: return
|
val caret = editor.caretModel.addCaret(editor.offsetToVisualPosition(match.startOffset), true) ?: return
|
||||||
@@ -287,7 +277,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
val caret = editor.caretModel.primaryCaret
|
val caret = editor.caretModel.primaryCaret
|
||||||
if (caret.selectedText == null) return
|
if (caret.selectedText == null) return
|
||||||
if (!editor.caretModel.removeCaret(caret)) {
|
if (!editor.caretModel.removeCaret(caret)) {
|
||||||
editor.exitVisualMode()
|
editor.vim.exitVisualMode()
|
||||||
}
|
}
|
||||||
MotionGroup.scrollCaretIntoView(caret.editor)
|
MotionGroup.scrollCaretIntoView(caret.editor)
|
||||||
}
|
}
|
||||||
@@ -295,7 +285,7 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
|
|
||||||
private fun selectText(caret: Caret, text: String, offset: Int): TextRange? {
|
private fun selectText(caret: Caret, text: String, offset: Int): TextRange? {
|
||||||
if (text.isEmpty()) return null
|
if (text.isEmpty()) return null
|
||||||
caret.vimSetSelection(offset, offset + text.length - 1, true)
|
caret.vim.vimSetSelection(offset, offset + text.length - 1, true)
|
||||||
MotionGroup.scrollCaretIntoView(caret.editor)
|
MotionGroup.scrollCaretIntoView(caret.editor)
|
||||||
return TextRange(caret.selectionStart, caret.selectionEnd)
|
return TextRange(caret.selectionStart, caret.selectionEnd)
|
||||||
}
|
}
|
||||||
@@ -307,13 +297,13 @@ class VimMultipleCursorsExtension : VimExtension {
|
|||||||
enterVisualMode(editor.vim)
|
enterVisualMode(editor.vim)
|
||||||
|
|
||||||
// Select the word under the caret, moving the caret to the end of the selection
|
// Select the word under the caret, moving the caret to the end of the selection
|
||||||
caret.vimSetSelection(range.startOffset, range.endOffsetInclusive, true)
|
caret.vim.vimSetSelection(range.startOffset, range.endOffsetInclusive, true)
|
||||||
return TextRange(caret.selectionStart, caret.selectionEnd)
|
return TextRange(caret.selectionStart, caret.selectionEnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enterVisualMode(editor: VimEditor) {
|
private fun enterVisualMode(editor: VimEditor) {
|
||||||
// We need to reset the key handler to make sure we pick up the fact that we're in visual mode
|
// We need to reset the key handler to make sure we pick up the fact that we're in visual mode
|
||||||
VimPlugin.getVisualMotion().enterVisualMode(editor, CommandState.SubMode.VISUAL_CHARACTER)
|
VimPlugin.getVisualMotion().enterVisualMode(editor, VimStateMachine.SubMode.VISUAL_CHARACTER)
|
||||||
KeyHandler.getInstance().reset(editor)
|
KeyHandler.getInstance().reset(editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.nerdtree
|
package com.maddyhome.idea.vim.extension.nerdtree
|
||||||
|
@@ -1,19 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* IdeaVim - Vim emulator for IDEs based on the IntelliJ platform
|
* Copyright 2003-2022 The IdeaVim authors
|
||||||
* Copyright (C) 2003-2022 The IdeaVim authors
|
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* Use of this source code is governed by an MIT-style
|
||||||
* it under the terms of the GNU General Public License as published by
|
* license that can be found in the LICENSE.txt file or at
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* https://opensource.org/licenses/MIT.
|
||||||
* (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.extension.nerdtree
|
package com.maddyhome.idea.vim.extension.nerdtree
|
||||||
@@ -21,8 +11,10 @@ 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.actionSystem.PlatformDataKeys
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||||
@@ -44,18 +36,18 @@ 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.common.CommandAlias
|
import com.maddyhome.idea.vim.common.CommandAlias
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
import com.maddyhome.idea.vim.common.CommandNode
|
|
||||||
import com.maddyhome.idea.vim.common.CommandPartNode
|
|
||||||
import com.maddyhome.idea.vim.common.Node
|
|
||||||
import com.maddyhome.idea.vim.common.RootNode
|
|
||||||
import com.maddyhome.idea.vim.common.addLeafs
|
|
||||||
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
import com.maddyhome.idea.vim.extension.VimExtension
|
||||||
import com.maddyhome.idea.vim.group.KeyGroup
|
import com.maddyhome.idea.vim.group.KeyGroup
|
||||||
import com.maddyhome.idea.vim.helper.MessageHelper
|
import com.maddyhome.idea.vim.helper.MessageHelper
|
||||||
import com.maddyhome.idea.vim.helper.runAfterGotFocus
|
import com.maddyhome.idea.vim.helper.runAfterGotFocus
|
||||||
|
import com.maddyhome.idea.vim.key.CommandNode
|
||||||
|
import com.maddyhome.idea.vim.key.CommandPartNode
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner
|
import com.maddyhome.idea.vim.key.MappingOwner
|
||||||
|
import com.maddyhome.idea.vim.key.Node
|
||||||
import com.maddyhome.idea.vim.key.RequiredShortcut
|
import com.maddyhome.idea.vim.key.RequiredShortcut
|
||||||
|
import com.maddyhome.idea.vim.key.RootNode
|
||||||
|
import com.maddyhome.idea.vim.key.addLeafs
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
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.vimscript.model.datatypes.VimString
|
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
|
||||||
@@ -145,7 +137,7 @@ class NerdTree : VimExtension {
|
|||||||
|
|
||||||
class IjCommandHandler(private val actionId: String) : CommandAliasHandler {
|
class IjCommandHandler(private val actionId: String) : CommandAliasHandler {
|
||||||
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
|
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
|
||||||
callAction(actionId, context)
|
callAction(editor, actionId, context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +148,7 @@ class NerdTree : VimExtension {
|
|||||||
if (toolWindow.isVisible) {
|
if (toolWindow.isVisible) {
|
||||||
toolWindow.hide()
|
toolWindow.hide()
|
||||||
} else {
|
} else {
|
||||||
callAction("ActivateProjectToolWindow", context)
|
callAction(editor, "ActivateProjectToolWindow", context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -172,7 +164,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)
|
||||||
@@ -218,7 +210,7 @@ class NerdTree : VimExtension {
|
|||||||
|
|
||||||
val action = nextNode.actionHolder
|
val action = nextNode.actionHolder
|
||||||
when (action) {
|
when (action) {
|
||||||
is NerdAction.ToIj -> callAction(action.name, e.dataContext.vim)
|
is NerdAction.ToIj -> callAction(null, action.name, e.dataContext.vim)
|
||||||
is NerdAction.Code -> e.project?.let { action.action(it, e.dataContext, e) }
|
is NerdAction.Code -> e.project?.let { action.action(it, e.dataContext, e) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,12 +231,14 @@ class NerdTree : VimExtension {
|
|||||||
e.presentation.isEnabled = false
|
e.presentation.isEnabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.presentation.isEnabled = !speedSearchIsHere(project)
|
e.presentation.isEnabled = !speedSearchIsHere(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun speedSearchIsHere(project: Project): Boolean {
|
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||||
val component = ProjectView.getInstance(project).currentProjectViewPane.tree ?: return false
|
|
||||||
return SpeedSearchSupply.getSupply(component) != null
|
private fun speedSearchIsHere(e: AnActionEvent): Boolean {
|
||||||
|
val searchText = e.getData(PlatformDataKeys.SPEED_SEARCH_TEXT)
|
||||||
|
return !searchText.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -342,7 +336,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,10 +345,10 @@ 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(null, "ActivateProjectToolWindow", context.vim)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
registerCommand(
|
registerCommand(
|
||||||
@@ -363,9 +357,9 @@ 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(null, "ActivateProjectToolWindow", context.vim)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
registerCommand(
|
registerCommand(
|
||||||
@@ -503,20 +497,17 @@ class NerdTree : VimExtension {
|
|||||||
|
|
||||||
private val LOG = logger<NerdTree>()
|
private val LOG = logger<NerdTree>()
|
||||||
|
|
||||||
fun callAction(name: String, context: ExecutionContext) {
|
fun callAction(editor: VimEditor?, name: String, context: ExecutionContext) {
|
||||||
val action = ActionManager.getInstance().getAction(name) ?: run {
|
val action = ActionManager.getInstance().getAction(name) ?: run {
|
||||||
VimPlugin.showMessage(MessageHelper.message("action.not.found.0", name))
|
VimPlugin.showMessage(MessageHelper.message("action.not.found.0", name))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val application = ApplicationManager.getApplication()
|
val application = ApplicationManager.getApplication()
|
||||||
if (application.isUnitTestMode) {
|
if (application.isUnitTestMode) {
|
||||||
injector.actionExecutor.executeAction(action.vim, context)
|
injector.actionExecutor.executeAction(editor, action.vim, context)
|
||||||
} else {
|
} else {
|
||||||
runAfterGotFocus {
|
runAfterGotFocus {
|
||||||
injector.actionExecutor.executeAction(
|
injector.actionExecutor.executeAction(editor, action.vim, context)
|
||||||
action.vim,
|
|
||||||
context,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -560,7 +551,3 @@ class NerdTree : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T> Node<T>.addLeafs(keys: String, actionHolder: T) {
|
|
||||||
addLeafs(injector.parser.parseKeys(keys), actionHolder)
|
|
||||||
}
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user