1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-08-17 16:31:45 +02:00

Compare commits

..

803 Commits

Author SHA1 Message Date
57ddf2083e Set plugin version to chylex-35 2024-06-04 13:26:12 +02:00
aad2287433 Revert "Factor disposable objects on editor opening"
This reverts commit 1fa78935
2024-06-04 13:26:11 +02:00
a348428422 Fix(VIM-3364): Exception with mapped Generate action 2024-06-04 13:26:11 +02:00
c4c66c194a Apply scrolloff after executing native IDEA actions 2024-06-04 13:26:11 +02:00
e065783486 Stay on same line after reindenting 2024-06-04 13:26:11 +02:00
dae5e3a8fd Update search register when using f/t 2024-06-04 13:26:11 +02:00
bb3b67f611 Automatically add unambiguous imports after running a macro 2024-06-04 13:26:11 +02:00
bf69c8b4a6 Fix(VIM-3179): Respect virtual space below editor (imperfectly) 2024-06-04 13:26:11 +02:00
49d1d2d270 Fix(VIM-3178): Workaround to support "Jump to Source" action mapping 2024-06-04 13:26:11 +02:00
96cdf1c26d Add support for count for visual and line motion surround 2024-06-04 13:20:29 +02:00
365bbce9a0 Fix vim-surround not working with multiple cursors
Fixes multiple cursors with vim-surround commands `cs, ds, S` (but not `ys`).
2024-06-04 13:20:29 +02:00
1f8a580b7f Fix(VIM-696) Restore visual mode after undo/redo, and disable incompatible actions 2024-06-04 13:20:27 +02:00
fa9529eaa5 Respect count with <Action> mappings 2024-06-04 13:18:11 +02:00
0b29a4704b Change matchit plugin to use HTML patterns in unrecognized files 2024-06-04 13:18:11 +02:00
92b9046d6c Reset insert mode when switching active editor 2024-06-04 13:18:11 +02:00
f5b120ac01 Remove update checker 2024-06-04 13:18:11 +02:00
70ea63c0ba Set custom plugin version 2024-06-04 13:18:11 +02:00
Matt Ellis
d00bd8bb25 Fix incsearch highlights with operator count
E.g. `2"a3"b4"c5d6/foo` will now highlight the current match correctly
2024-06-03 11:54:48 +03:00
Matt Ellis
a66e44d835 Fix [count]: initial range text in ex field
Fixes regression from changes in ex field handling
2024-06-03 11:54:48 +03:00
Matt Ellis
ce05317634 Maintain Visual when cancelling search entry 2024-06-03 11:54:48 +03:00
Matt Ellis
33d88d55c9 Remove unused branch in SortCommand
Commands are executed in Normal mode, although there may be multiple carets
2024-06-03 11:54:48 +03:00
Matt Ellis
a31a4a8ca7 Share ex entry set up with filter commands 2024-06-03 11:54:48 +03:00
Matt Ellis
c34d000b91 Reintroduce ProcessGroup.startExEntry
We need to share the implementation between starting an Ex command, and starting a filter command, which is just an Ex command with initial text
2024-06-03 11:54:48 +03:00
Matt Ellis
a2bfe950fa Fix move command moving to current line
Removes a workaround that would break moving a range to the current line because it would always move the caret to the start of the range. Now positions the caret to the start of the selection if there is one. This also means we can remove the SAVE_VISUAL flag from JoinLinesCommand

Fixes VIM-2936
2024-06-03 11:54:48 +03:00
Matt Ellis
b44f40acd6 Fix incorrect output for line() in Normal mode 2024-06-03 11:54:48 +03:00
Matt Ellis
5169093bbf Clear ex output after assert and fix tests
This ensures that a failing action doesn't pass due to previous state
2024-06-03 11:54:48 +03:00
Matt Ellis
b15b1cd3f8 Fix range with missing last address
Fixes VIM-992
2024-06-03 11:54:48 +03:00
Matt Ellis
f7b6a97435 Support 0 as part of a range address
Fixes VIM-1137
2024-06-03 11:54:48 +03:00
Matt Ellis
f64c99c406 Support incsearch highlighting for global command
Fixes VIM-2891
2024-06-03 11:54:48 +03:00
Matt Ellis
f552e43c5b Refactor handling of default range
Specify a default range instead of default line for count.
2024-06-03 11:54:48 +03:00
Matt Ellis
4798198e41 Minor refactorings 2024-06-03 11:54:48 +03:00
Matt Ellis
a59de4ce05 Add tests and fixes for yank command
Handles validation for count and ensures correct behaviour for registers.
2024-06-03 11:54:48 +03:00
Matt Ellis
2dea525665 Add tests and fixes for join command
Handles validation for count and positions caret in the correct place. Also handles join with visual multicaret scenarios.
2024-06-03 11:54:48 +03:00
Matt Ellis
8ecb1f7296 Add tests and fixes for print command
Handles validation of count and correctly moves caret to end of range after execution. Also fix issue where the results of :print are accumulated and not cleared.

Fixes VIM-2570
2024-06-03 11:54:48 +03:00
Matt Ellis
9ca9530061 Add tests and fixes for shift commands
Shift left and right now work with counts, validate the counts and move the caret to the correct end position
2024-06-03 11:54:48 +03:00
Matt Ellis
54e27afc3f Simplify getCount functions
Made it explicit to get the count from argument and/or range. Default count is not passed, because it was never used. Added some tests where possible, but hard to test select file and friends
2024-06-03 11:54:48 +03:00
Matt Ellis
5e67032655 Add tests and fixes for delete lines command
Validates register before use and correctly uses register and count
2024-06-03 11:54:48 +03:00
Matt Ellis
cb37f6df63 Add tests and fixes for goto line command
Correctly handles some validation, and also allows going to line zero
2024-06-03 11:54:48 +03:00
Matt Ellis
ca3a18cf37 Add tests for goto character command
Also start to refactor handling of count
2024-06-03 11:54:48 +03:00
Matt Ellis
cac36627aa Support 0 in copy command to copy to top of file 2024-06-03 11:54:48 +03:00
Matt Ellis
6404e1127e Remove incorrect VimBehaviourDiffers annotation 2024-06-03 11:54:48 +03:00
Matt Ellis
e762a3093b Range is already normalised 2024-06-03 11:54:48 +03:00
Matt Ellis
739ac2ae5e Simplify getting address from argument 2024-06-03 11:54:48 +03:00
Matt Ellis
77c364a2d0 Move count handling out of range into command 2024-06-03 11:54:48 +03:00
Matt Ellis
103cd9f5ce Fix off-by-one error in count
Count needs to be one-based, lines must be zero-based. So store addresses as one-based until processed
2024-06-03 11:54:48 +03:00
Matt Ellis
99859fe857 Rename test classes
Also ensure that test derives from VimTestCase so that injector is correctly initialised
2024-06-03 11:54:48 +03:00
Matt Ellis
4778995f3b Remove unnecessary getFirstLine function 2024-06-03 11:54:48 +03:00
Matt Ellis
0a14150840 Extract TextRange from Ex range class 2024-06-03 11:54:48 +03:00
Matt Ellis
e8ffc0313f Remove Range overloads that don't require a caret
Provide caret when calling from Command
2024-06-03 11:54:48 +03:00
Matt Ellis
7dbd3886b1 Introduce addresses for current line and last line
Remove mutation from LineAddress
2024-06-03 11:54:48 +03:00
Matt Ellis
8c83164d76 Remove mutable state from Range
Sometimes we cache things, and other times it's relative to a passed caret. Let's always calculate it
2024-06-03 11:54:48 +03:00
Matt Ellis
076aab1ccf Rename Ranges, and ExRanges.kt 2024-06-03 11:54:48 +03:00
Matt Ellis
751f51c88f Rename Range and related classes to Address
An address evaluates to a line, and a range is a collection of addresses
2024-06-03 11:54:48 +03:00
Filipp Vakhitov
ab7359ffd3 Fix options test for Windows
Thanks @citizenmatt for this patch
2024-05-29 18:48:05 +03:00
Alex Plate
d795d70041 Disable some tests due to VIM-3376 2024-05-29 18:33:31 +03:00
aleksei.plate@jetbrains.com
1320034e7e TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Publish EAP Build from branch' build configuration were updated 2024-05-29 12:45:26 +00:00
Alex Plate
79a216043f Use a ReleasesVcsRoot for the ReleaseEapFromBranch configuration 2024-05-29 15:42:24 +03:00
Alex Plate
c508a3cc32 Add a build configuration that creates a EAP release from the release branch 2024-05-29 15:40:25 +03:00
Alex Plate
d40d8f34c5 Apply patches for TeamCity configs 2024-05-29 15:18:15 +03:00
Alex Pláte
b561a13e7c Merge pull request #893 from JetBrains/fleet
Moving away from Swing TextAction to KeyHandler
2024-05-29 14:16:44 +03:00
aleksei.plate@jetbrains.com
71bcee2a07 TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:40:30 +00:00
aleksei.plate@jetbrains.com
6c490b1baa TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:40:09 +00:00
aleksei.plate@jetbrains.com
4ab6a36aca TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:39:01 +00:00
aleksei.plate@jetbrains.com
c4355841ad TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:38:13 +00:00
aleksei.plate@jetbrains.com
f163946e38 TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:37:43 +00:00
Filipp Vakhitov
7abb1fd630 Finalizing merge 2024-05-28 23:35:31 +03:00
aleksei.plate@jetbrains.com
f78d3387a5 TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:35:10 +00:00
aleksei.plate@jetbrains.com
69e2e3c047 TeamCity change in 'Ideavim' project: 'IdeaVim Releases' VCS root was updated 2024-05-28 20:34:19 +00:00
aleksei.plate@jetbrains.com
52832cbe22 TeamCity change in 'Ideavim' project: 'IdeaVim Releases' VCS root was updated 2024-05-28 20:32:36 +00:00
aleksei.plate@jetbrains.com
82ca2be51c TeamCity change in 'Ideavim' project: 'IdeaVim Releases' VCS root was updated 2024-05-28 20:30:53 +00:00
aleksei.plate@jetbrains.com
8552bb8a17 TeamCity change in 'Ideavim' project: 'IdeaVim Releases' VCS root was updated 2024-05-28 20:30:05 +00:00
Alex Plate
b49a38b6d0 Rename ReleasesVcsRoot 2024-05-28 23:24:03 +03:00
Alex Plate
ad0751677a Add a special VCS root for releases 2024-05-28 23:18:45 +03:00
aleksei.plate@jetbrains.com
dd8bb20ba9 TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'EXP: Print release branch' build configuration were updated 2024-05-28 20:13:24 +00:00
Alex Plate
03f5f27901 Experiment: print release branch in TC 2024-05-28 23:08:02 +03:00
Filipp Vakhitov
9e3ca56afd Merge branch 'refs/heads/master' into fleet
# Conflicts:
#	src/main/java/com/maddyhome/idea/vim/ui/ex/ExEntryPanel.java
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/ex/LeaveCommandLineAction.kt
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryFwdAction.kt
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/action/motion/search/SearchEntryRevAction.kt
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/key/consumers/CommandConsumer.kt
2024-05-28 22:19:17 +03:00
Filipp Vakhitov
5379528e3e Minor post-review PR improvements 2024-05-28 21:52:43 +03:00
Filipp Vakhitov
12201359bc Fix unwanted triggering of IDE actions instead of Vim ones
https://github.com/JetBrains/ideavim/pull/893#pullrequestreview-2082768468
2024-05-28 21:39:14 +03:00
Alex Plate
ba50fcf85e Add ssh agent for the configuration 2024-05-28 19:19:06 +03:00
Alex Plate
24c0db563c Use releases prefix instead of release 2024-05-28 19:10:40 +03:00
Alex Plate
33c4905dcb Add testing TC job for calculating new version of the release 2024-05-28 19:05:37 +03:00
Alex Plate
9296c3f9a0 Bring back tests before the release 2024-05-28 14:50:11 +03:00
Alex Plate
7ecc566169 Temporally skip tests for this release
As this is considered as a VERY bad practice, it makes sense in this particular case. Generally, we need an updated release process so such things don’t happen
2024-05-28 14:31:46 +03:00
Alex Plate
a918da36d3 Bring back the old value of the release constant 2024-05-28 14:27:29 +03:00
Alex Plate
91ff5fdb02 Temporally change the release constant to make the last release based on 2023.3.2 2024-05-28 14:15:49 +03:00
Alex Plate
4481631547 Disable RedrawListener if the plugin is not enabled 2024-05-28 13:55:47 +03:00
Matt Ellis
7865388086 Fix regression when sub string ends with backslash
Fixes VIM-3428
2024-05-28 13:53:13 +03:00
Matt Ellis
26297bc5a9 Fix last line sometimes obscured by scrollbar
Fixes VIM-3028
2024-05-28 13:53:13 +03:00
Matt Ellis
9db5cdd8e3 Fix last line sometimes obscured by ex entry prompt
When performing a substitute command with confirmation, the height of the editor content pane should be reduced by the height of the ex entry panel. IdeaVim would do this correctly when moving a search result to the bottom of the file, but not when the result was on the last line of the file. Because the wrong height was used, IdeaVim would decide that no scrolling was necessary and the result in the last line would be obscured.

Fixes VIM-1560
2024-05-28 13:53:13 +03:00
Matt Ellis
2b17534a08 Fix infinite loop while highlighting in old regex
Fixes VIM-2510
2024-05-28 13:53:13 +03:00
Matt Ellis
4e2db68acf Update selection when searching in Visual mode 2024-05-28 13:53:13 +03:00
Matt Ellis
ddabf8df5e Fix regression finding endpos in new regex engine
Fixes VIM-3344
2024-05-28 13:53:13 +03:00
Matt Ellis
3f28e197ca Clear status bar on scrolling, add/remove lines, etc.
Also implements <C-L> to "redraw" screen and clear status line
2024-05-28 13:53:13 +03:00
Matt Ellis
3a67524e8a Show status bar message when search wraps
Fixes VIM-1043
2024-05-28 13:53:13 +03:00
Matt Ellis
33312d95b0 Remove wrapscan flag for substitute
Substitute always works on a known range
2024-05-28 13:53:13 +03:00
Matt Ellis
f554b21cd9 Support count for search
Fixes VIM-2836
2024-05-28 13:53:13 +03:00
Matt Ellis
d9fa4e4648 Fix end of file atom for old regex engine
Fixes VIM-2888
2024-05-28 13:53:13 +03:00
Matt Ellis
e98a284d40 Fix multiline regex substitution
Fixes VIM-2141
2024-05-28 13:53:13 +03:00
Matt Ellis
38ef8c1053 Fix removing search highlight that crosses newline 2024-05-28 13:53:13 +03:00
Matt Ellis
d3f560a31c Add special case to match newline with end of file 2024-05-28 13:53:13 +03:00
Matt Ellis
e2cb3ff284 Stop subst skipping too far with multiline pattern
Fixes VIM-698
2024-05-28 13:53:13 +03:00
Matt Ellis
0f5a3953e1 Don't break ex field with exceptions from incsearch 2024-05-28 13:53:13 +03:00
Matt Ellis
633667ed7f Fix regression with global not saving used patterns
This is a messy quick fix, as the search group needs a lot of tidying up right now. Perhaps a better implementation would be to move the implementation of the global command into the search group - processGlobalCommand, like we already have processSearchCommand and processSubstituteCommand

Fixes VIM-3348
2024-05-28 13:53:13 +03:00
Matt Ellis
656e975562 Fix reset of last substitution string on use
Fixes VIM-3354
2024-05-28 13:53:13 +03:00
Matt Ellis
f7fbe89de4 Use EnumSet instead of list of enums 2024-05-28 13:53:13 +03:00
Matt Ellis
509829b052 Fix force ignorecase atom in search highlights
Fixes VIM-3391
2024-05-28 13:53:13 +03:00
Matt Ellis
efd61e17f2 Reset CMD_LINE mode when losing focus
Fixes VIM-3293
2024-05-28 13:53:13 +03:00
Matt Ellis
cf2b021d02 Fix search for last search pattern with new offset
Fixes VIM-2356
2024-05-28 13:53:13 +03:00
Matt Ellis
67f10aece5 Fix search motion type when providing offset
Search motion type should be linewise if there's a line offset, or inclusive if the `e` flag is provided. Otherwise, it's exclusive.

Fixes VIM-1940
2024-05-28 13:53:13 +03:00
Matt Ellis
9b5c777fcf Update highlights when editor scheme changes 2024-05-28 13:53:13 +03:00
Matt Ellis
c65e5f8341 Fix highlighting for 'incsearch' and 'nohlsearch'
Setting 'incsearch' and 'nohlsearch' should highlight only the current match in the current editor
2024-05-28 13:53:13 +03:00
Matt Ellis
053bb603cd Fix errors with incsearch and substitute command
Fixes VIM-3325
2024-05-28 13:53:13 +03:00
Matt Ellis
93b07bbb90 Update comments and fix warnings 2024-05-28 13:53:13 +03:00
Matt Ellis
764a115601 Show search highlights in all visible editors
Fixes VIM-2174
2024-05-28 13:53:13 +03:00
Matt Ellis
1adfe53f29 Fix wrong offset returned for current search result
Fixes VIM-2779
2024-05-28 13:53:13 +03:00
Matt Ellis
bfe0f51cb1 Restore current match highlighting for :s command
Regression while migrating to the new regex engine removed the highlights shown when confirming each change
2024-05-28 13:53:13 +03:00
Matt Ellis
ffce61906a Restore search highlights when setting 'hlsearch'
Fixes VIM-3257
2024-05-28 13:53:13 +03:00
Filipp Vakhitov
3843a193cb Deprecate classes related to Swing TextActions 2024-05-26 23:56:27 +03:00
IdeaVim Bot
b2410dab0b Add Egor Nikolaevsky to contributors list 2024-05-25 09:01:49 +00:00
Matt Ellis
f382544101 Fix clearing highlighted yank in modal dialogs
Also fixes a memory leak registering a disposable for each yank, allows config variables to be numbers rather than strings and removes highlights when IdeaVim is disabled

Fixes VIM-2236
2024-05-24 18:05:51 +03:00
Filipp Vakhitov
a81d54eb90 Remove VimCommandLineHelper 2024-05-24 17:18:24 +03:00
Filipp Vakhitov
23519bbdae Refactoring to use interfaces from vim-engine 2024-05-24 16:51:38 +03:00
Alex Plate
73fd25773a Add test for VimIndentObject
For PR https://github.com/JetBrains/ideavim/pull/884
2024-05-24 16:20:36 +03:00
Egor Nikolaevsky
746d483179 Fix indent size calculation 2024-05-24 16:19:50 +03:00
Alex Plate
1a7e90c7d7 Bump the minimal version of IJ to 241
There are a lot of incompatibilities with IdeaVim on 241 if it's built on 233

Also, this time the special branch for the IJ version won't be created. Previously on bumping the version of IJ, we've created the branch to keep the reference to the moment when it happened. However, IJ version bumps are easy to trace anyway by git.
2024-05-24 15:37:05 +03:00
Filipp Vakhitov
8e2fd44f55 Remove unnecessary methods from ProcessGroup 2024-05-24 14:25:51 +03:00
Filipp Vakhitov
1c84917b29 Move LeaveCommandLineAction to its own class 2024-05-24 12:58:04 +03:00
Filipp Vakhitov
c5522ed19d Move ExEntryAction to vim-engine 2024-05-24 12:56:52 +03:00
IdeaVim Bot
33a5480456 Add Eduardo Haesbaert to contributors list 2024-05-24 09:01:57 +00:00
Alex Plate
16cd05fc76 Fix incorrect use of visual position instead of buffer position
We should calculate the line above based on logical position rather than visual position.

This issue was detected thanks to newly introduced soft wraps and proprty tests
2024-05-24 11:39:45 +03:00
Eduardo Haesbaert
4788dacc86 Fix wording
There is one additional `the` before the preview gif, and also, changing the wording from "to" to " for".
2024-05-24 10:10:46 +03:00
Filipp Vakhitov
91e54c8b0d Replace c_CTRL-R swing TextAction implementation with proper Vim engine implementation 2024-05-23 17:31:18 +03:00
Filipp Vakhitov
15ccebfe11 Cleanup 2024-05-23 15:27:18 +03:00
Filipp Vakhitov
5c849c9105 Fix ExEntryAction 2024-05-23 02:24:34 +03:00
Filipp Vakhitov
9e99506223 Move some logic to engine 2024-05-23 01:32:48 +03:00
Filipp Vakhitov
53ea90379f Moved some search related logic to commands to simplify KeyHandler and ProcessGroup 2024-05-23 00:15:46 +03:00
Filipp Vakhitov
2619d7ebb4 Moved some classes to the same file in vim-engine
They will share some logic in future commits
2024-05-22 22:14:54 +03:00
Filipp Vakhitov
8c8a7aceca Moved some classes to the same file in vim-engine
They will share some logic in future commits
2024-05-22 22:12:34 +03:00
Filipp Vakhitov
726b885b60 More obvious processing of ex-commands.
1. Now we have two parallel commandBuilders: for the editor and for the command prompt. It's done for sequence of keys like `d/foo<C-R>"<CR>` where we have two different commands that are built at the same time.
2. We simplified the CommandConsumer and made the logic more straightforward. `/`, `?` and `:` enter the command mode, while pressing final `<CR>` fires the command execution.
2024-05-22 22:04:32 +03:00
Filipp Vakhitov
a6994a09c3 Add support for commands that can be executed either once or for each caret depending on some circumstances
In a future commit, I'm going to make ProcessExEntryAction responsible for processing both search and ex commands. Search commands are motions that are executed for each caret, while ex-commands are executed once. The per-caret code is held internally by the ex commands themselves.

The current solution is definitely not the right one, and the whole ex command subsystem needs to be reviewed and refactored:

1. Some commands can be motions, which is currently not supported.
2. We need to figure out a gentle way of handling multiple carets.
2024-05-22 15:44:12 +03:00
Alex Plate
1616aff5a1 Update version of TC config 2024-05-10 16:06:28 +03:00
Alex Plate
5a82f05be8 Update version of IJ in TC tests 2024-05-10 15:46:31 +03:00
Alex Plate
3020504cdc Rename kotlin TC config to avoid compilation issues 2024-05-10 15:36:41 +03:00
Matt Ellis
d00e802674 Update options documentation 2024-05-10 15:27:24 +03:00
Matt Ellis
c46008dddc Update Vim option even when IdeaVim is disabled 2024-05-10 15:27:24 +03:00
Matt Ellis
755000c376 Reset Vim options when IDE setting changes
Options are not reset if they've been explicitly set by the user (e.g. `:set list` or _View | Active Editor | Show Whitespaces_). They are reset if they were explicitly set in `~/.ideavimrc`.

Also bumps the IDE build number to 233.11799.241 in order to use EditorSettingsExternalizable.PropNames
2024-05-10 15:27:24 +03:00
Matt Ellis
1e4a60bfe6 Fix nullability warning 2024-05-10 15:27:24 +03:00
Matt Ellis
c9ee685956 Codify assumption re global-local external setting 2024-05-10 15:27:24 +03:00
Matt Ellis
c2b1083836 Updated descriptions as per review comments 2024-05-10 15:27:24 +03:00
Matt Ellis
3518528f22 Prevent resetting options when plugin re-enabled 2024-05-10 15:27:24 +03:00
Matt Ellis
9bed8fec79 Map 'scrolloff' and 'sidescrolloff' options
Fixes VIM-3110
2024-05-10 15:27:24 +03:00
Matt Ellis
3ffbea7d42 Match Vim's behaviour for :set[local] {option}<
String and number/toggle options have different and opposite behaviour for `:set {option}<` and `:setlocal {option}<`. This change matches Vim's behaviour.
2024-05-10 15:27:24 +03:00
Matt Ellis
39b42193cb Map 'scrolljump' and 'sidescroll' options
Fixes VIM-3110
2024-05-10 15:27:24 +03:00
Matt Ellis
c69e080b05 Add 'fileencoding' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt Ellis
50b42036d1 Add 'bomb' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt Ellis
340c40ceff Add 'fileformat' option
No tests, as I don't know how to test interaction with saving to disk
2024-05-10 15:27:24 +03:00
Matt Ellis
6aeffe71de Map 'number' and 'relativenumber' options 2024-05-10 15:27:24 +03:00
Matt Ellis
04c33d719e Improve relative line converter for soft wraps
It now shows visual lines relative to the caret's visual line, rather than relative to the caret's logical line. This still isn't correct, and we should be showing the relative count of Vim logical lines (buffer lines + fold lines) but this matches movement so is more helpful
2024-05-10 15:27:24 +03:00
Matt Ellis
07f1d1e8e6 Move number/relativenumber options out of engine
While they are core Vim options, they are implemented by the host, not by the engine. If another host wants to support these options, they can add them in their implementation layer.
2024-05-10 15:27:24 +03:00
Matt Ellis
6c61254c50 Add 'colorcolumn' option to show visual guides
IntelliJ ties the hard wrap right margin guide with the other visual guides, and it's not possible to show one without the other. In Vim, you can show the hard wrap margin by adding "+0" to 'colorcolumn', so in IdeaVim, we automatically add this.
2024-05-10 15:27:24 +03:00
Matt Ellis
c6efea8c34 Add 'textwidth' option
Also supports overriding local-to-buffer options with IDE values, ensuring that changes to the option/IDE value are applied to all editors for the buffer.

Fixes VIM-1310
2024-05-10 15:27:24 +03:00
Matt Ellis
80f43a7c66 Add 'cursorline' option 2024-05-10 15:27:24 +03:00
Matt Ellis
9f5d3a9a28 Add 'list' option to show whitespace
Fixes VIM-267
2024-05-10 15:27:24 +03:00
Matt Ellis
8800a4f70b Add 'breakindent' option
Fixes VIM-2748
2024-05-10 15:27:24 +03:00
Matt Ellis
990254dcac Sort ideavim.dic to make it easier to modify 2024-05-10 15:27:24 +03:00
Matt Ellis
73a1118e78 Extract base implementation for IDE backed options 2024-05-10 15:27:24 +03:00
Matt Ellis
d3bedf26cf Treat IDE value as default for 'wrap' option 2024-05-10 15:27:24 +03:00
Matt Ellis
25b29f429a Track how option value is set 2024-05-10 15:27:24 +03:00
Matt Ellis
363f821962 Introduce 'wrap' option based on IntelliJ setting
Fixes VIM-1265
2024-05-10 15:27:24 +03:00
Alex Plate
8d873c0bf1 Fix(VIM-3418): Restore mappings after plugin disable/enable
There is no need to clean up the requiredShortcuts after turning off the plugin. Also, previously this set was not populated properly and keys that were added by ideavimrc or by user were not restored
2024-05-09 08:57:12 +03:00
Alex Plate
955676ed9e Add comments about structures for testing
Also, there is no need to clear these structures during plugin disabling
2024-05-09 08:30:47 +03:00
Alex Plate
a2439a37e4 Make RequiredShortcut as a data class
This will simplify reading the data during the debug
2024-05-09 08:21:26 +03:00
dependabot[bot]
7b6daa8e4e Bump io.ktor:ktor-serialization-kotlinx-json from 2.3.10 to 2.3.11
Bumps [io.ktor:ktor-serialization-kotlinx-json](https://github.com/ktorio/ktor) from 2.3.10 to 2.3.11.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-serialization-kotlinx-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 19:15:51 +03:00
dependabot[bot]
fcf782296a Bump org.jetbrains.kotlin:kotlin-stdlib from 1.9.23 to 1.9.24
Bumps [org.jetbrains.kotlin:kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.9.23 to 1.9.24.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.23...v1.9.24)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-stdlib
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 19:15:37 +03:00
dependabot[bot]
44889b635c Bump com.google.devtools.ksp:symbol-processing-api
Bumps [com.google.devtools.ksp:symbol-processing-api](https://github.com/google/ksp) from 1.9.23-1.0.20 to 1.9.24-1.0.20.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](https://github.com/google/ksp/compare/1.9.23-1.0.20...1.9.24-1.0.20)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp:symbol-processing-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 19:03:20 +03:00
dependabot[bot]
bc12ba11cd Bump io.ktor:ktor-client-core from 2.3.10 to 2.3.11
Bumps [io.ktor:ktor-client-core](https://github.com/ktorio/ktor) from 2.3.10 to 2.3.11.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 19:01:14 +03:00
dependabot[bot]
9b08db75e3 Bump io.ktor:ktor-client-auth from 2.3.10 to 2.3.11
Bumps [io.ktor:ktor-client-auth](https://github.com/ktorio/ktor) from 2.3.10 to 2.3.11.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-08 19:00:51 +03:00
4c3ad3f263 Add NERDTree action to toggle excluded files 2024-05-08 10:02:10 +03:00
Alex Plate
598bcc7edd Do not notify slack about the new release 2024-05-07 14:18:31 +03:00
Alex Plate
b86ec03dc4 Update UI tests for python. Open tool window by calling API 2024-04-26 19:13:53 +03:00
Alex Plate
ae75498f8a Update the UI test to search for the new name of the copy dialog 2024-04-26 18:44:31 +03:00
Alex Plate
9d0b68b0f8 Use the correct context after executing the ex command
With the incorrect context the action EditorSelectWord didn't make any effect because it worked on the ex-entry panel editor
2024-04-26 18:22:53 +03:00
Alex Plate
eeb5939e59 Use brew to install ffmpeg on GitHub actions
After GitHub updated macos from version 12 to version 14, the existing action stopped working
2024-04-26 17:37:21 +03:00
Alex Plate
ef235a47bf Try to install ffmpeg on GitHub actions using homebrew
After GitHub updated macos from version 12 to version 14, the existing action stopped working
2024-04-26 17:25:54 +03:00
Alex Plate
b66da76880 VIM-3376: Remove usages of the EditorDataContext
EditorDataContext cannot be used because the platform cannot convert it to the async data context. Taking the fact that it's not clear why this custom context exists, I decided to get rid of it at all.

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```

Class EditorDataContext cannot be removed because it's used in github.zgqq.intellij-enhance plugin
2024-04-26 14:52:47 +03:00
Alex Plate
54d6119784 VIM-3376: Working on removing EditorDataContext. Remove it from ReplaceWithRegister
EditorDataContext cannot be used because the platform cannot convert it to the async data context. Taking the fact that it's not clear why this custom context exists, I decided to get rid of it at all.

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```
2024-04-26 14:19:47 +03:00
Alex Plate
0b8c081425 VIM-3376: Working on removing EditorDataContext. Remove it from multiple places
EditorDataContext cannot be used because the platform cannot convert it to the async data context. Taking the fact that it's not clear why this custom context exists, I decided to get rid of it at all.

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```
2024-04-26 14:16:52 +03:00
Alex Plate
209052ffa6 Create a function to get the execution context from the editor
This is a part of VIM-3376. This context will not be a custom EditorDataContext, but some context created by the platform.
In some places we don't have any kind of "current context", but we have to use it for the function. However, such context can be simply retrieved from the editor.
2024-04-26 14:03:37 +03:00
Alex Plate
fe9a6b5cfb Remove context argument when creating a pad for the string
It's unclear why it was needed to get the project from the context, but it's easy to get the project from the existing editor
2024-04-26 13:56:10 +03:00
Alex Plate
9c0f74369f VIM-3376: Working on removing EditorDataContext. Remove from ExEditorKit
This one was added after the implementation of cmap in 5c9faba7f4

EditorDataContext cannot be used because the platform cannot convert it to the async data context. Taking the fact that it's not clear why this custom context exists, I decided to get rid of it at all.

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```
2024-04-26 13:49:59 +03:00
Alex Plate
cd27e5229b VIM-3376: Working on removing EditorDataContext. Remove from CommandLineHelper
EditorDataContext cannot be used because the platform cannot convert it to the async data context. Taking the fact that it's not clear why this custom context exists, I decided to get rid of it at all.

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```
2024-04-26 13:40:18 +03:00
Alex Plate
472732905c VIM-3376: Get rid of IjCaretAndEditorExecutionContext
This context was added long ago, but I wasn't able to find specific reasons for that. Currently, such custom contexts cannot work with the intellij platform and should be refactored or removed. The issues with this context are that it cannot be converted to the async data context by the platform.
Taking the fact that the reason for this context was not found, I decided to get rid of it.

The issue from the platform looks like this

```
Cannot convert to AsyncDataContext at 'keyboard shortcut' DataContextWrapper(CaretSpecificDataContext(com.maddyhome.idea.vim.helper.EditorDataContext)). Please use CustomizedDataContext or its inheritors like SimpleDataContext
```
Here the EditorDataContext is mentioned instead of CaretAndEditorData context, however, I'll clean up both contexts during this refactoring

It was used in the action system for mapping to the `<Action>` keyword and in commit 256f5fcd0e it's mentioned that the EditorActionHandler was not working without this context. However, currently both cases work fine without addition wrapping.
2024-04-26 13:27:56 +03:00
Alex Plate
485d9f81cd VIM-3376: Use SimpleDataContext in tests 2024-04-26 12:25:56 +03:00
Alex Plate
8cf136ce4c Add toString representations for IjNativeAction and ActionEnableStatus 2024-04-26 10:22:50 +03:00
Alex Plate
116a8ac9d2 Reformat test code 2024-04-26 09:58:27 +03:00
Alex Plate
fda310bda6 Create a configuration for 2024.1 tests 2024-04-26 09:44:46 +03:00
dependabot[bot]
e55619ea33 Bump io.ktor:ktor-client-auth from 2.3.9 to 2.3.10
Bumps [io.ktor:ktor-client-auth](https://github.com/ktorio/ktor) from 2.3.9 to 2.3.10.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.10/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.9...2.3.10)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-17 18:57:24 +03:00
dependabot[bot]
b952b20128 Bump io.ktor:ktor-client-content-negotiation from 2.3.9 to 2.3.10
Bumps [io.ktor:ktor-client-content-negotiation](https://github.com/ktorio/ktor) from 2.3.9 to 2.3.10.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.10/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.9...2.3.10)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-content-negotiation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-17 18:43:04 +03:00
dependabot[bot]
62d1f85648 Bump io.ktor:ktor-client-core from 2.3.9 to 2.3.10
Bumps [io.ktor:ktor-client-core](https://github.com/ktorio/ktor) from 2.3.9 to 2.3.10.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.10/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.9...2.3.10)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 19:01:40 +03:00
dependabot[bot]
5e3c8c0e92 Bump io.ktor:ktor-client-cio from 2.3.9 to 2.3.10
Bumps [io.ktor:ktor-client-cio](https://github.com/ktorio/ktor) from 2.3.9 to 2.3.10.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.10/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.9...2.3.10)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-cio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 18:46:53 +03:00
dependabot[bot]
b58dddf2ff Bump com.google.devtools.ksp:symbol-processing-api
Bumps [com.google.devtools.ksp:symbol-processing-api](https://github.com/google/ksp) from 1.9.23-1.0.19 to 1.9.23-1.0.20.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](https://github.com/google/ksp/compare/1.9.23-1.0.19...1.9.23-1.0.20)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp:symbol-processing-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 18:34:54 +03:00
dependabot[bot]
78d351a0b0 Bump org.mockito.kotlin:mockito-kotlin from 5.2.1 to 5.3.1
Bumps [org.mockito.kotlin:mockito-kotlin](https://github.com/mockito/mockito-kotlin) from 5.2.1 to 5.3.1.
- [Release notes](https://github.com/mockito/mockito-kotlin/releases)
- [Commits](https://github.com/mockito/mockito-kotlin/compare/5.2.1...5.3.1)

---
updated-dependencies:
- dependency-name: org.mockito.kotlin:mockito-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 18:33:14 +03:00
dependabot[bot]
61dbc948cc Bump io.ktor:ktor-serialization-kotlinx-json from 2.3.9 to 2.3.10
Bumps [io.ktor:ktor-serialization-kotlinx-json](https://github.com/ktorio/ktor) from 2.3.9 to 2.3.10.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.10/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.9...2.3.10)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-serialization-kotlinx-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-10 18:33:02 +03:00
Alex Plate
c4d92ebe73 VIM-308 In intellij 2024.1+ the caret movement won't be detected as a separate undo action 2024-04-05 17:50:42 +03:00
dependabot[bot]
d0cf827638 Bump org.jetbrains.intellij from 1.17.2 to 1.17.3
Bumps org.jetbrains.intellij from 1.17.2 to 1.17.3.

---
updated-dependencies:
- dependency-name: org.jetbrains.intellij
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-03 16:38:41 +00:00
dependabot[bot]
6a6a92b6b9 Bump com.dorongold.task-tree from 2.1.1 to 3.0.0
Bumps com.dorongold.task-tree from 2.1.1 to 3.0.0.

---
updated-dependencies:
- dependency-name: com.dorongold.task-tree
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-03 16:36:28 +00:00
Alex Plate
9869b8a34e Add new UI tests for the actions
NewElementSamePlace
CopyReferencePopupGroup
2024-04-03 18:01:45 +03:00
Alex Plate
60fbf88322 Add UI test for generate action 2024-04-03 17:36:22 +03:00
Alex Plate
fae3924062 Update a version of IJ for tests 2024-04-02 11:56:59 +03:00
Alex Plate
dc2ce64823 Revert changes in action processing to fix VIM-3351 2024-04-02 11:52:56 +03:00
Alex Plate
d0d86d9178 Print the exceptin in logger.warn instead of just a message 2024-03-29 16:53:22 +02:00
Alex Plate
f417af6148 Specify ActionUpdateThread for FindActionIdAction 2024-03-29 15:38:05 +02:00
Alex Plate
2fe2860a09 Remove Offset and Pointer and switch to the regular Ints
Details on that can be found here: VIM-3368
2024-03-29 15:38:05 +02:00
filipp
cb40426976 Fix(FL-25338): Vim plugin stopped working in 1.31.107 2024-03-29 14:52:52 +02:00
Filipp Vakhitov
423ed390a2 Fix(FL-25087): p in vim mode
Pasting was broken with immutable carets because the old caret was not updated during execution
2024-03-29 14:52:52 +02:00
Filipp Vakhitov
7652b16ca6 Move more MotionGroup methods to its base class 2024-03-29 14:52:52 +02:00
Filipp Vakhitov
618a010c15 Move some MotionGroup methods to its base class 2024-03-29 14:52:52 +02:00
Filipp Vakhitov
d44a34ed9b Remove unnecessary abstract method 2024-03-29 14:52:52 +02:00
Filipp Vakhitov
c84fc996db Move some methods to vim-engine
The more methods we have in the engine, the fewer number of methods we will need to implement in the Fleet
2024-03-29 14:52:52 +02:00
Filipp Vakhitov
43f232543b Replace findBlockRange with newer implementation
The newer implementation is a part of the vim-engine library and uses new methods from the SearchGroup.kt, but it is not fully refactored yet
2024-03-29 14:52:52 +02:00
filipp
3f65d1d99a Revert "Revert changes to SearchGroup"
This reverts commit 00ccddf8cf.
2024-03-29 14:52:52 +02:00
Alex Plate
bfcf706ca7 Change the logic for detecting new dependencies on IdeaVim plugin 2024-03-29 09:27:09 +02:00
Alex Plate
8c1103c461 Add comment about the fix for project leak in tests 2024-03-28 10:30:19 +02:00
Alex Plate
ab75ace8db Fix(VIM-3331): Support custom registers in replaceWithRegister plugin 2024-03-25 09:40:45 +02:00
Alex Plate
4a58e6a282 Add test with custom register for textObjEntire extension 2024-03-25 09:34:58 +02:00
Alex Plate
ac9e4f69b4 Remove affectedRate related automation 2024-03-22 20:04:13 +02:00
Alex Plate
581edba7fd Remove the specification of the plugin verifier
The latest version of the verified was broken at some moment, so I specified the static version. Now these issues are fixed.
2024-03-22 13:53:55 +02:00
Alex Plate
58a8b96c3c Revert "Stop IdeaVim actions flowing into JB Client"
This reverts commit bd192561ae.

This commit reverts the fix for VIM-3283 because it causes VIM-3346 and VIM-3347
2024-03-20 13:08:04 +02:00
dependabot[bot]
0e057ca9ae Bump org.eclipse.jgit:org.eclipse.jgit.ssh.apache
Bumps org.eclipse.jgit:org.eclipse.jgit.ssh.apache from 6.8.0.202311291450-r to 6.9.0.202403050737-r.

---
updated-dependencies:
- dependency-name: org.eclipse.jgit:org.eclipse.jgit.ssh.apache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 16:06:19 +00:00
dependabot[bot]
36bf2639bb Bump io.ktor:ktor-client-cio from 2.3.8 to 2.3.9
Bumps [io.ktor:ktor-client-cio](https://github.com/ktorio/ktor) from 2.3.8 to 2.3.9.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.9/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.8...2.3.9)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-cio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 18:04:55 +02:00
dependabot[bot]
0c1326e689 Bump com.google.devtools.ksp:symbol-processing-api
Bumps [com.google.devtools.ksp:symbol-processing-api](https://github.com/google/ksp) from 1.9.22-1.0.18 to 1.9.23-1.0.19.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](https://github.com/google/ksp/commits/1.9.23-1.0.19)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp:symbol-processing-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 18:04:38 +02:00
dependabot[bot]
dd74438f68 Bump org.jetbrains.kotlin:kotlin-stdlib from 1.9.22 to 1.9.23
Bumps [org.jetbrains.kotlin:kotlin-stdlib](https://github.com/JetBrains/kotlin) from 1.9.22 to 1.9.23.
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/v1.9.23/ChangeLog.md)
- [Commits](https://github.com/JetBrains/kotlin/compare/v1.9.22...v1.9.23)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlin:kotlin-stdlib
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 18:04:26 +02:00
Alex Plate
a9ddfac782 Add test that shows an issue when deleting a line at the end of file 2024-03-12 21:21:15 +02:00
Alex Plate
79437df894 Fix(VIM-3330): Use Z backward visual search in sneak plugin 2024-03-12 20:01:35 +02:00
Alex Plate
b5a04af089 Switch to a stable version of the plugin verifier because the latest version is broken.
Broken version: https://github.com/JetBrains/intellij-plugin-verifier/releases/tag/1.364

Internal discussion: https://jetbrains.slack.com/archives/C03RHGR7J/p1710229884548179
2024-03-12 12:02:21 +02:00
Alex Plate
52372ae3d3 Disable plugin verifier for tests 2024-03-12 09:34:55 +02:00
Alex Plate
65d755d9b2 Bring back the getMappingMode function for binary compatibility with the which-key plugin 2024-03-12 09:31:59 +02:00
Alex Plate
1f1a8f3395 Avoid generation of the huge amount of sets during regex search
The tests shows that the depth of `epsilonVisited` is usually around 0-3, so there is no need to use the set. However, when the set is used, we have to make a new copy everytime we create a new `SimulationStackFrame`.
Now, the previous stack is reused.
2024-03-11 18:51:46 +02:00
Alex Plate
629e4e7053 Fix(VIM-3336): Improve the performance of n in large files
The git history shows that the force update of the search highlights was accidentally enabled during the refactorings
2024-03-11 18:49:38 +02:00
Alex Plate
c50a299cfd Remove the unused import 2024-03-11 18:48:27 +02:00
Alex Plate
4bad129caf Do not register clipboard option change listener for caret registers
Register groups for the caret do not use some fields from the base class, however the listener for these fiels is still registered. Now we don't register this listener.
Generally it looks like a bigger refactoring can be performed in order to separate the common registers logic from caret registers logic.

This change should improve the performance of the IjVimCaret initialization because now we won't register a new disposable on each instance of IjVimCaret

This is a part of VIM-3336
2024-03-11 17:41:54 +02:00
Alex Plate
1ffb28e21b Wait for some checks in UI tests instead of immediate verification 2024-03-11 14:29:08 +02:00
dependabot[bot]
c126243367 Bump io.ktor:ktor-client-auth from 2.3.8 to 2.3.9
Bumps [io.ktor:ktor-client-auth](https://github.com/ktorio/ktor) from 2.3.8 to 2.3.9.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.9/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.8...2.3.9)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-06 18:30:12 +02:00
dependabot[bot]
6da6e461a8 Bump io.ktor:ktor-serialization-kotlinx-json from 2.3.8 to 2.3.9
Bumps [io.ktor:ktor-serialization-kotlinx-json](https://github.com/ktorio/ktor) from 2.3.8 to 2.3.9.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.9/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.8...2.3.9)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-serialization-kotlinx-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-06 18:15:59 +02:00
dependabot[bot]
103101bbcb Bump com.google.devtools.ksp:symbol-processing-api
Bumps [com.google.devtools.ksp:symbol-processing-api](https://github.com/google/ksp) from 1.9.22-1.0.17 to 1.9.22-1.0.18.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](https://github.com/google/ksp/commits)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp:symbol-processing-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-06 18:04:15 +02:00
dependabot[bot]
f737fcba1a Bump io.ktor:ktor-client-core from 2.3.8 to 2.3.9
Bumps [io.ktor:ktor-client-core](https://github.com/ktorio/ktor) from 2.3.8 to 2.3.9.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.9/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.8...2.3.9)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-06 18:03:05 +02:00
dependabot[bot]
c5fa0678b8 Bump io.ktor:ktor-client-content-negotiation from 2.3.8 to 2.3.9
Bumps [io.ktor:ktor-client-content-negotiation](https://github.com/ktorio/ktor) from 2.3.8 to 2.3.9.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/2.3.9/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/compare/2.3.8...2.3.9)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-content-negotiation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-06 18:02:42 +02:00
filipp
00ccddf8cf Revert changes to SearchGroup
Wrong branch. The changes should be merged to master only after review in the Fleet branch
2024-03-03 22:16:19 +02:00
filipp
00cbf188fb Replace findUnmatchedBlock method with a new implementation 2024-03-03 22:05:28 +02:00
filipp
988ea74461 Fix(VIM-3294): %-movement mismatches braces 2024-03-03 22:05:28 +02:00
filipp
0914cda7e5 Better matching for a sequence of single-line comments 2024-03-03 22:05:28 +02:00
filipp
5959e9aaa1 Fix(VIM-1399): Uncommented brackets are matched to commented ones in VIM mode 2024-03-03 22:05:28 +02:00
filipp
434df565ae Migrate % command to work with newer method in SearchGroup.kt 2024-03-03 22:05:28 +02:00
filipp
c8f36504d8 Fix tests for % 2024-03-03 22:05:28 +02:00
filipp
06e1af371e Add SearchGroup.kt
In the future, it should become a container for all the search methods that we have in IdeaVim
At the moment we have a bunch of SearchGroups and SearchHelpers, and it may be confusing.
We also want to avoid using unnecessary OOP.
2024-03-03 22:05:28 +02:00
filipp
d744987ac8 Add VimPsiService
We want to avoid unnecessary OOP and use interfaces only for cases where we will have different implementations for different IDEs
This service will help us in our future refactorings of SearchGroup and SearchHelper
2024-03-03 22:03:58 +02:00
filipp
b4eef17aaa Add StringUtil.kt class
Methods in this file will be helpful in future search refactorings
2024-03-03 22:03:58 +02:00
filipp
5c50e8607c Fix search 2024-03-01 08:50:18 +02:00
Filipp Vakhitov
9a324ab448 Reset KeyHandlerState when switching Editors
Now we have a single state for all the editors, so we should not mix their states
2024-02-29 20:27:46 +02:00
dependabot[bot]
c3978335f5 Bump org.mockito.kotlin:mockito-kotlin from 5.0.0 to 5.2.1
Bumps [org.mockito.kotlin:mockito-kotlin](https://github.com/mockito/mockito-kotlin) from 5.0.0 to 5.2.1.
- [Release notes](https://github.com/mockito/mockito-kotlin/releases)
- [Commits](https://github.com/mockito/mockito-kotlin/compare/5.0.0...5.2.1)

---
updated-dependencies:
- dependency-name: org.mockito.kotlin:mockito-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-28 16:01:23 +00:00
Alex Plate
051296c2aa UI tests: make sure the text appear in the editor before running tests 2024-02-28 09:37:05 +02:00
Alex Plate
90f2d2ff29 Small update of the minimal version of IJ 2024-02-27 14:43:23 +02:00
Alex Plate
4c2edab406 Run optimize imports 2024-02-27 13:17:02 +02:00
Alex Plate
76e8fd69bf Increase timeout in UI tests 2024-02-27 11:30:51 +02:00
IdeaVim Bot
5dd458bcf7 Add lippfi, FilipParker to contributors list 2024-02-24 09:02:05 +00:00
Filipp Vakhitov
a94a8b8539 Fix tests 2024-02-24 01:03:18 +02:00
Filipp Vakhitov
261230b23a Remove experimental showmodewidget option 2024-02-24 00:36:36 +02:00
Filipp Vakhitov
b90317e00e More visible text color for mode widget
Visibility may be unexpected for custom themes with non-obvious colors
2024-02-24 00:27:48 +02:00
Filipp Vakhitov
21c9dc8785 Add statistic collector for mode widget 2024-02-24 00:15:01 +02:00
Alex Plate
31bbc60325 Fix all reports of the inspection that prohibits the use of companion objects
This is a requirement from the platform, as a huge amount of companion objects leads to a higher level of classloading
2024-02-23 18:55:01 +02:00
Alex Plate
fec6e5c189 Remove the last argument in EventLogGroup as the compatibility was fixed on the platform side 2024-02-23 18:35:21 +02:00
Alex Plate
23c1493f17 Fix(VIM-3306): Vim paragraph motion won't make mappings if there is already such mapping defined by user 2024-02-23 18:26:50 +02:00
lippfi
00808af569 Merge pull request #824 from JetBrains/fleet
Asynchronous key processing for Fleet
2024-02-23 17:25:21 +02:00
filipp
3c94091d30 Merge branch 'refs/heads/master' into fleet 2024-02-23 17:24:08 +02:00
filipp
b737362aba Update CaretVisualAttributesListener to use new Editor API 2024-02-23 17:21:18 +02:00
Parker7123
db722fc4e5 VIM-1472 Add support for sorting with pattern 2024-02-23 17:15:21 +02:00
filipp
7d679e68dc Merge branch 'refs/heads/master' into fleet
# Conflicts:
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/api/VimEditorGroup.kt
#	vim-engine/src/main/kotlin/com/maddyhome/idea/vim/impl/state/VimStateMachineImpl.kt
2024-02-23 17:08:01 +02:00
Matt Ellis
bc808403fb Rename localEditors to getEditors
The fact that these methods only return local editors (i.e., editors for the local user while hosting a Code With Me session) is an implementation detail
2024-02-23 17:01:32 +02:00
Matt Ellis
9d6dc317a4 Only notify editors for the current buffer 2024-02-23 17:01:32 +02:00
Matt Ellis
cf29c50f31 Ensure editors are initialised before use
Fixes VIM-3256
2024-02-23 17:01:32 +02:00
Alex Plate
2a3c4cc441 Use a link to changelog 2024-02-23 16:02:38 +02:00
Matt Ellis
bd192561ae Stop IdeaVim actions flowing into JB Client
IdeaVim actions are local only - they control local behaviour and should not be visible in the Client

Fixes VIM-3283
2024-02-23 15:54:20 +02:00
Matt Ellis
66ff56a05e Move document listeners to global listeners
This means we listen to changes in all documents, rather than just the changes in the documents for open local editors. And this means that we correctly update e.g. marks when a non-local editor changes a file that isn't open in a local editor.
2024-02-23 15:54:20 +02:00
Matt Ellis
def86d179e Review disabled editor checks 2024-02-23 15:54:20 +02:00
Matt Ellis
3c9a343f8b Review listeners to only work with local editors
Reviews all IntelliJ listeners to ensure that they only work with supported local editors. Editor creation was initialising IdeaVim for all editors, which meant that behaviour could leak into Code With Me guest editors. E.g. guest editors incorrectly drawing relative line numbers, or the host using the guest's last selected tab when switching to an alternate file.

This leads to a change in behaviour with some local editors. The editor creation listener will now check to see if the editor is local *and supported*. This means it can exclude single line editors, editors in database cells or dialogs, depending on the state of 'ideavimsupport' at creation time. The behaviour at creation time is now more correct, but if 'ideavimsupport' is modified, existing matching editors will not be initialised.

Fixes VIM-3274, fixes VIM-3275
2024-02-23 15:54:20 +02:00
Matt Ellis
10b6b05fab Clear disposable after disposing 2024-02-23 15:54:20 +02:00
Matt Ellis
caa4ef736a Rename method for clarity 2024-02-23 15:54:20 +02:00
Matt Ellis
23702345a9 Fix comments 2024-02-23 15:54:20 +02:00
Matt Ellis
ba89babd10 Move listener to app level
Fixes VIM-2167
2024-02-23 15:54:20 +02:00
Matt Ellis
2ce3fbd677 Use common APIs to get local editors 2024-02-23 15:54:20 +02:00
Matt Ellis
d8de73a06d Use correct APIs to get local only editors
Always ignores non-local, hidden editors opened by remote guests in Code With Me sessions.

Fixes VIM-3268
2024-02-23 15:54:20 +02:00
Alex Plate
8094e6711a Update qodana baseline 2024-02-23 15:38:33 +02:00
Alex Plate
10edccc1d6 Add matchit test for jump from try to catch and to finally
From PR https://github.com/JetBrains/ideavim/pull/802
2024-02-23 15:36:38 +02:00
Alex Plate
247aaed188 Use the property to change the state of the octopus handler 2024-02-23 15:32:35 +02:00
Filipp Vakhitov
1a4333fa1b Move implementations to upper level
It will simplify support of immutable editors in Fleet
2024-02-23 15:09:45 +02:00
Filipp Vakhitov
8eaa6df318 Throw error instead of warning on state conflict
It may indicate some serious issues, and we would like to know if anything goes wrong
2024-02-23 15:09:45 +02:00
Filipp Vakhitov
7523db186f Empty status bar message after each test 2024-02-23 15:09:45 +02:00
filipp
4aac113522 Remove duplicate method 2024-02-23 15:09:45 +02:00
filipp
795abd77a7 Add documentation 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
38bc914504 Avoid using annotation-processors in vim-engine 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
c8113eea83 Commit state after receiving unknown key 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
924b7418e8 Fix DigraphSequence cloning 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
a7dfef61e9 Make LazyVimCommand open 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
db35c979b4 Move some editor methods to the base class 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
2de933c723 Make processKey public 2024-02-23 15:09:45 +02:00
filipp
d3704d602f Cleanup after moving logic to other classes 2024-02-23 15:09:45 +02:00
filipp
ea62f227bf Remove piece of code for handling bad commands
Bad commands are handled in consumers
2024-02-23 15:09:45 +02:00
filipp
23fdadc32e Fix test
Sometimes it's not a plugin error and may indicate that key is propagated for later handling by IDE
But what we know for sure - that for both cases we should reset command builder
2024-02-23 15:09:45 +02:00
filipp
e9bf06686f Add synchronize blocks to minimize risk of concurrent key processing and changing of the KeyHandlerState 2024-02-23 15:09:45 +02:00
filipp
7842b155c1 Move some logic to ModeInputConsumer 2024-02-23 15:09:45 +02:00
filipp
74a8277e10 Move some logic to SelectRegisterConsumer 2024-02-23 15:09:45 +02:00
filipp
ddb1b80463 Move some logic to CommandConsumer 2024-02-23 15:09:45 +02:00
filipp
eea3336934 Move some logic to CommandConsumer 2024-02-23 15:09:45 +02:00
filipp
f801145712 Update MappingInfo to match newer signature 2024-02-23 15:09:45 +02:00
filipp
e033b08535 Move some logic to DigraphConsumer 2024-02-23 15:09:45 +02:00
filipp
1d9514a205 Move some logic to RegisterConsumer 2024-02-23 15:09:45 +02:00
filipp
6741120f19 Move some logic to CharArgumentConsumer 2024-02-23 15:09:45 +02:00
filipp
c501457322 Move some logic to EditorResetConsumer 2024-02-23 15:09:45 +02:00
filipp
46425a24c3 Move some logic to DeleteCommandConsumer 2024-02-23 15:09:45 +02:00
filipp
9826f0a7f0 Move some logic to CommandCountConsumer 2024-02-23 15:09:45 +02:00
filipp
43175061e0 Fix broken digraphSequence
It shouldn't be retested on partial reset
2024-02-23 15:09:45 +02:00
filipp
0ab32cac34 Make MappingProcessor a KeyConsumer 2024-02-23 15:09:45 +02:00
filipp
e3ec9c614b Add KeyConsumer
It will help us to have a more modular KeyHandler in future (chain of different consumers)
2024-02-23 15:09:45 +02:00
filipp
f454d60234 Add MutableBoolean to be able to pass and modify shouldRecord in methods 2024-02-23 15:09:45 +02:00
filipp
19fa00837c Use KeyProcessResultBuilder
It will help us to build the KeyProcessResult that we need for asynchronous key processing
2024-02-23 15:09:45 +02:00
filipp
275c5d28e1 Add KeyProcessResultBuilder 2024-02-23 15:09:45 +02:00
filipp
15ae069f6f Make keyHandlerState argument not null
Applying default values may lead to unexpected results, especially if we sometimes want to use the global state (IJ), and at other times, its clone for asynchronous processing (Fleet).
2024-02-23 15:09:45 +02:00
Filipp Vakhitov
00f5541dc6 Add KeyProcessResult interface 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
02540eb303 Pass KeyHandlerState as a method argument 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
282e581bdb Make state cloneable 2024-02-23 15:09:45 +02:00
Filipp Vakhitov
31e7c49608 Add equals & hashCode 2024-02-23 15:09:45 +02:00
filipp
7966a6dc91 Create KeyHandlerState
We do not need multiple commandBuilder, digraphSequence or mappingState and this class will be a singleton containing them
2024-02-23 15:09:45 +02:00
filipp
5fc2f04224 Remove mappingMode from MappingState
It unnecessarily binds mappingState to mode and thus to editor. And we want to simplify things and have a single MappingState instead of multiple of them
2024-02-23 15:09:45 +02:00
filipp
6edfd8ed22 Remove deprecated showmode status bar text update that does not work with the new UI and will be replaced with widget 2024-02-23 15:09:45 +02:00
filipp
363db05db7 Macro recording state is no longer per editor
It will not only simplify VimStateMachine, but also help us to support multi-editor macros in future
2024-02-23 15:09:45 +02:00
filipp
3738012dd6 Listeners refactoring
1. Listeners now disposed after turning plugin off
2. Change widget listeners to be recreated on plugin toggle
3. Add CaretVisualAttributesListener
2024-02-23 15:09:45 +02:00
filipp
355cfe035d Remove Editor from VimStateMachine
Rationale:
1. A much more experienced developer, whom I highly respect, suggested to empty VimStateMachineImpl constructor in his TODO comment.
2. I aim for VimStateMachine to be a data class rather than being a container for both data and complex logic.
3. From an architectural perspective, it is more correct. Editors do have state (or they may possess a single global state if the corresponding option is set), but a state does not own an editor.
2024-02-23 15:09:44 +02:00
Alex Plate
6d01b5be77 Stop maintaining the changelog file
We have quite a fucntionality to maintain the changelof in actual state
However, since we switched to release from the latest EAP, we can't just update the changelog on master because it will contains also unreleased changes since the latest EAP.
The proper support for such change will require a lot of coding that will take a lot of time to implement and will eventually break.
So, it was decided to keep the changelog on YouTrack only and not to maintain the changes file.

This change still may be reverted, so the code around the changelog is note removed, but only commented out
2024-02-23 14:05:12 +02:00
Alex Plate
4938957483 Add a comment line with LATEST-EAP-SNAPSHOT 2024-02-23 13:37:36 +02:00
Alex Plate
46f4fa7cdd Make tests about join notification more stable
Now we track only new notifications instead of just taking the last one
2024-02-23 11:27:15 +02:00
Alex Plate
f696135f31 Now we execute beforeActionPerformedUpdate instead of lastUpdateAndCheckDumb right before action execution
This is done because of platform changes. Now the `lastUpdateAndCheckDumb` doesn't update an action that supposed to be updated on background.
The problem was detected with commentary tests. The test supposed to use the line comment in case the block comment is not available. However, the since the action was not updated, the presentation was not reset to false and the fallback to line action was not performed.
2024-02-23 11:26:45 +02:00
Alex Plate
52e0fcdc7d Use the custom version of IntIterator.skip because it was removed from the library 2024-02-23 10:29:33 +02:00
Alex Plate
ac17518a23 Update the changelog 2024-02-23 10:19:39 +02:00
6dd924b2b2 Implement motions to go to next/previous misspelled word 2024-02-23 10:17:25 +02:00
Matt Ellis
f439474b73 Fix set command tests
Also hides more feature flags and diagnostic settings from users and unit tests. Shows them when in internal mode.
2024-02-23 10:04:23 +02:00
Matt Ellis
d6cd92e256 Migrate extensions to use operatorfunc option 2024-02-23 10:04:23 +02:00
Matt Ellis
3a294268d9 Introduce operatorfunc option
Allows creating custom operators in script, as shown in JetBrains/ideavim#702
2024-02-23 10:04:23 +02:00
Alex Plate
9b81c7e650 Update junit version 2024-02-23 10:03:30 +02:00
Alex Plate
e229fb3ad7 Add new plugin that depends on IdeaVim 2024-02-23 09:26:46 +02:00
Alex Plate
720eae63fa Fix the incorrect condition in UI tests 2024-02-23 09:23:42 +02:00
Alex Plate
0df96a24bd Add a missing @BeforeEach in tests 2024-02-22 09:19:24 +02:00
Alex Plate
21a1588ede Increase wait timeout for UI tests 2024-02-22 09:02:03 +02:00
Alex Plate
7970006e8c Log the base commit during dev version calculation 2024-02-22 09:02:02 +02:00
dependabot[bot]
418d0cff7f Bump org.junit.jupiter:junit-jupiter from 5.10.1 to 5.10.2
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.1 to 5.10.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:43 +02:00
dependabot[bot]
7284360774 Bump org.jetbrains.intellij from 1.17.0 to 1.17.2
Bumps org.jetbrains.intellij from 1.17.0 to 1.17.2.

---
updated-dependencies:
- dependency-name: org.jetbrains.intellij
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:15 +02:00
dependabot[bot]
9fc3fadee8 Bump org.antlr:antlr4 from 4.10.1 to 4.13.1
Bumps [org.antlr:antlr4](https://github.com/antlr/antlr4) from 4.10.1 to 4.13.1.
- [Release notes](https://github.com/antlr/antlr4/releases)
- [Changelog](https://github.com/antlr/antlr4/blob/dev/CHANGES.txt)
- [Commits](https://github.com/antlr/antlr4/compare/4.10.1...4.13.1)

---
updated-dependencies:
- dependency-name: org.antlr:antlr4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:05 +02:00
Alex Plate
3d2db56f63 Use sets during plugin detection to avoid sorting problems 2024-02-21 10:43:44 +02:00
Alex Plate
e9c7cb8670 Update logic of calculation of dev version 2024-02-21 10:40:20 +02:00
dependabot[bot]
87d19274c5 Bump io.ktor:ktor-client-content-negotiation from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-content-negotiation](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-content-negotiation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 17:10:25 +02:00
dependabot[bot]
3161bf8ffd Bump io.ktor:ktor-client-core from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-core](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 17:10:21 +02:00
Alex Plate
b68865587e Wait up to 5 mins for initialization of PyCharm 2024-02-20 17:06:32 +02:00
dependabot[bot]
7dc0dbe944 Bump io.ktor:ktor-serialization-kotlinx-json from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-serialization-kotlinx-json](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-serialization-kotlinx-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:56:35 +02:00
dependabot[bot]
f50a363525 Bump io.ktor:ktor-client-cio from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-cio](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-cio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:56:16 +02:00
Alex Plate
57ad4c70d1 Do not analyze test fixtures by qodana 2024-02-20 16:46:43 +02:00
Alex Plate
d3d93b898f Unregister NotificationService project service
It's not registered as a light service and doesn't need to be registered in xml files
2024-02-20 16:46:07 +02:00
Alex Plate
7d8973edb2 Add tests for new java matchit functionality
From PR https://github.com/JetBrains/ideavim/pull/802
2024-02-20 16:42:28 +02:00
dependabot[bot]
2302b576b0 Bump io.ktor:ktor-client-auth from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-auth](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:42:07 +02:00
f4782630d4 Add Matchit support for Java statements 2024-02-20 16:41:34 +02:00
IdeaVim Bot
8c1a2a686f Update changelog after merging PR 2024-02-20 14:33:04 +00:00
32d5e1e6fa Enforce LF line separator in project code style 2024-02-20 16:31:36 +02:00
Alex Plate
a381a1cacc Wait till all toolwindows initialziation 2024-02-20 16:19:29 +02:00
Alex Plate
73c3c9f7fe Replace Enum.values() with Enum.entries, as suggested since 1.9 2024-02-20 16:12:34 +02:00
Alex Plate
67ef0a75d5 Update capitalization 2024-02-20 16:12:11 +02:00
Alex Plate
328bc5e95a Convert some services to light services 2024-02-20 16:10:07 +02:00
Alex Plate
7f8021e37e Update the function that waits for smart mode 2024-02-20 15:49:42 +02:00
Alex Plate
9701b7e79b Add test reports to artifacts 2024-02-20 15:10:15 +02:00
Alex Plate
7a52c6fec9 Cleanup tests 2024-02-20 14:51:13 +02:00
Alex Plate
1503639d4b Remove generated lexing from qodana analyze 2024-02-20 14:51:06 +02:00
Alex Plate
e82f19c852 Add test for checking an issue that
was caught by property tests
2024-02-20 13:52:17 +02:00
Alex Plate
edd69c9c25 Apply patch for qodata TC config 2024-02-20 13:12:14 +02:00
Alex Plate
fc61e369fb Fix some deprecated calls 2024-02-20 13:11:10 +02:00
aleksei.plate@jetbrains.com
113586b59b TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 10:53:37 +00:00
Alex Plate
5dbd5e1c89 Update the changelog 2024-02-20 12:47:06 +02:00
IdeaVim Bot
04b7d9e2c3 Preparation to 2.9.0 release 2024-02-20 10:41:06 +00:00
Alex Plate
5f2743176a Update qodana configuration on TC 2024-02-20 12:18:24 +02:00
aleksei.plate@jetbrains.com
3723488617 TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 10:16:06 +00:00
Alex Plate
0cc17a0791 Make a correct service level for VimProjectService 2024-02-20 12:12:50 +02:00
aleksei.plate@jetbrains.com
05a21e6091 TeamCity change in 'Ideavim' project: 'Qodana checks' build configuration settings were updated 2024-02-20 08:58:47 +00:00
Alex Plate
fc06bc7c6f Update the qodana baseline 2024-02-20 10:58:08 +02:00
Alex Plate
1bd005adc1 Fix the name of the compatibility function 2024-02-20 10:39:34 +02:00
Alex Plate
4f208d1577 Add new plugin to the list 2024-02-20 10:37:10 +02:00
aleksei.plate@jetbrains.com
eb6e0557a7 TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 08:23:51 +00:00
Alex Plate
cf09d66be6 Prototype for vimscript inspection 2024-02-20 06:13:26 +02:00
Alex Plate
76cd127a8a Bring back function to fix compatibility 2024-02-20 05:25:22 +02:00
Alex Plate
f6dd2a9968 Do not call for setCaretVisible in tests as this causes project leak 2024-02-20 05:20:05 +02:00
aleksei.plate@jetbrains.com
ae05a33e14 TeamCity change in 'Ideavim' project: general settings of 'Tests for IntelliJ Latest EAP' build configuration were updated 2024-02-19 07:13:35 +00:00
aleksei.plate@jetbrains.com
b38fad323b TeamCity change in 'Ideavim' project: general settings of 'Tests for IntelliJ Latest EAP' build configuration were updated 2024-02-19 07:12:50 +00:00
Alex Plate
c6027fcf0f Add new plugin for compatibility checks 2024-02-19 09:01:10 +02:00
IdeaVim Bot
f4cf06a50e Update changelog. Action id - 7940923443 2024-02-17 10:05:47 +00:00
Alex Plate
86bf8dcc60 Fix the compatibility with platform 2024-02-17 08:56:17 +02:00
Alex Plate
d37898b6d3 Fix(VIM-3234): The space character won't mix in the tab chars after >> and << commands
Because of some reason, the visual position function from the platform starts to return an incorrect column for offsets with tabs. Maybe this is a correct behaviour for the platform, but for IdeaVim it breaks the calculation of the current caret position.

The visual position for calculating the shift was used since 2003, but there is no specific reason to use it and not the buffer (logical) position. So, since it started to cause issues, it's replaced with the buffer position.
2024-02-17 08:54:42 +02:00
Alex Plate
1edd6a9002 Fix the compatibility with the new version of the platform 2024-02-17 08:15:11 +02:00
Alex Plate
f7fa0dcbd1 Update YouTrack query for updating the release status after the release 2024-02-17 08:15:11 +02:00
Alex Plate
4f0a95a803 Bring back setCompletionPhase as this incompatibility was fixed in the latest EAP of the IntelliJ platform 2024-02-17 08:15:11 +02:00
IdeaVim Bot
e443cb0d3c Update changelog. Action id - 7928973613 2024-02-16 10:06:24 +00:00
Alex Plate
6fa228ee08 Fix(VIM-3291): Remove sync of editor selection between different opened editors
This is an old feature implemented by Rick Maddy in 2004, taken from Vim.
 c294063223

 If several buffers for the same file are opened, the selection is synchronized between buffers.
This doesn't happen in IJ natively and I don't see a reason to keep it like that.
This behaviour is removed because it causes issues now, but if we'll figure out the usage, we can bring it back.
2024-02-15 20:34:57 +02:00
Alex Plate
fb9bfbaeeb Do not check the compatibility of the sneak plugin 2024-02-14 18:05:56 +02:00
Alex Plate
09668f4fcb Update gradle wrapper to version 8.6 2024-02-14 17:07:20 +02:00
Alex Plate
4c7a6165ed Fix incorrect logs location in UI tests 2024-02-13 19:26:58 +02:00
Alex Plate
12d0d2613f Allow sneak plugin to be registered with the original mappings from the sneak plugin 2024-02-13 19:20:41 +02:00
Alex Plate
42ee78cd3d Disable runIde task for test subprojects 2024-02-13 19:18:18 +02:00
Alex Plate
58d308c1ed Fix the logging reporting for UI tests 2024-02-13 18:02:55 +02:00
Alex Plate
29e1bcc53d Wait longer for the python console to intialize 2024-02-13 14:56:14 +02:00
Alex Plate
3531574e5e Remove intellij plugin dependency for UI tests 2024-02-13 12:59:13 +02:00
Alex Plate
b9721218ab Enable PyCharm for python UI tests 2024-02-13 12:42:33 +02:00
Alex Plate
a119ea6a29 Fix octopus UI test 2024-02-13 12:34:56 +02:00
Alex Plate
95ef5f5f32 Fix incorrect configuration for UI tests 2024-02-13 08:43:12 +02:00
Alex Plate
b81b18645b Disable publishPlugin task for tests 2024-02-13 08:34:51 +02:00
Alex Plate
ce591f1b43 Configure UI robot for the root project 2024-02-12 14:49:38 +02:00
Alex Plate
28afa4b3ce Change the gradle config for UI tests 2024-02-12 13:37:10 +02:00
IdeaVim Bot
89a24d71a6 Update changelog after merging PR 2024-02-10 18:07:26 +00:00
f69630b668 VIM-3238 Fix recording a macro that replays another macro 2024-02-10 20:05:47 +02:00
Alex Plate
a2d34a883b Fix verifyPlugin task 2024-02-09 16:45:57 +02:00
Alex Plate
5c79b887d8 Do not ask for license for py tests 2024-02-09 16:31:25 +02:00
Alex Plate
d0475bf659 Explicitly specify jupyter version 2024-02-09 16:27:22 +02:00
Alex Plate
85c9576699 Extract common UI test fixtures 2024-02-09 16:22:22 +02:00
Alex Plate
2483450a1f Rename ui tests for better consistency 2024-02-09 16:11:14 +02:00
Alex Plate
519d5eed06 Set up PyCharm UI test 2024-02-09 16:03:31 +02:00
Alex Plate
d87965775a Update version of robot 2024-02-08 16:48:03 +02:00
Alex Plate
8c6f81aa00 Fix incorrect location of the video 2024-02-08 16:46:03 +02:00
Alex Plate
6ea0ab0968 Print if neovim testing is enabled or not 2024-02-08 15:22:54 +02:00
Alex Plate
70ab3ecdbe Make a custom expand function for UI tests 2024-02-08 15:10:47 +02:00
Alex Plate
a24ae616df Fix the creation of the video for the UI tests 2024-02-08 15:10:36 +02:00
Alex Plate
cc838f614f Remove the testWithNeovim task
Now you can just run `gradlew test -Dnvim`
2024-02-08 14:53:43 +02:00
Alex Plate
ae62a9f378 Fix the incorrect test 2024-02-08 14:35:52 +02:00
Alex Plate
1b5778a58c Remove configurations for UI tests 2024-02-08 14:33:02 +02:00
Alex Plate
27a689e7b8 Extract UI tests into the separate module 2024-02-08 14:21:09 +02:00
Alex Plate
8e6c490c62 Reformat the config file 2024-02-08 09:50:13 +02:00
Alex Plate
ccda70fe53 Remove mentions of ktlint 2024-02-08 09:49:17 +02:00
Alex Plate
26c42e4f0d Turn off fixes for the gradle release with test search issues 2024-02-08 09:48:38 +02:00
Alex Plate
3244dd52eb The line with compilation error is disabled
In 2024.1 EAP this line causes compilation error due to platform conversion from java to kotlin
The fix is landed in the platform and it should work fine with the new EAP.
However, since our tests are fail now, I'll comment out this line and bring it back in one week.
2024-02-08 09:39:54 +02:00
Alex Plate
4c6807a0c2 Extract long running tests into a separate module 2024-02-08 09:28:26 +02:00
Alex Plate
03a6a2749a Clean up build.gradle.kts 2024-02-08 09:16:16 +02:00
Alex Plate
82f69456e9 Exclude propery tests into a separate project 2024-02-08 09:14:52 +02:00
filipp.vakhitov
6beda371fb TeamCity change in 'Ideavim / IdeaVim releases' project: VCS roots of 'Publish vim-engine' build configuration were updated 2024-02-07 19:42:16 +00:00
Alex Plate
5b9cb2efc5 Explicitly specify java version for java IDE tests 2024-02-07 16:18:54 +02:00
Alex Plate
733968723c Explicitly specify an IDE type in the configuration 2024-02-07 16:07:35 +02:00
Alex Plate
63c81d67f2 Extract java tests for IdeaVim to a separate gradle subproject 2024-02-07 16:04:10 +02:00
Alex Plate
ad8ba1dd24 Move @VimBehaviourDiffers into a correct package of testFixtures 2024-02-07 10:07:16 +02:00
Alex Plate
04f821e3e1 Create a testFixtures for the project
This will be needed for extracting the java tests into a separate subproject
Also, cleaned up the ordering of dependencies in build.gradle.kts
2024-02-07 10:05:56 +02:00
Alex Plate
4937985e2c Bump kotlin version from 1.8.21 to 1.9.22
One of the reasons for that is that 1.9.22 allows internal classes to be available in testFixtures from java KT-34901.
2024-02-07 09:29:15 +02:00
Alex Plate
5fd7d83a70 Apply patches to TeamCity configurations 2024-02-07 08:22:42 +02:00
aleksei.plate@jetbrains.com
699a19d202 TeamCity change in 'Ideavim / IdeaVim releases' project: parameters of 'Publish EAP Build' build configuration were updated 2024-02-07 06:12:25 +00:00
Alex Plate
0b42938197 New testing of the eap release job 2024-02-07 08:05:02 +02:00
Alex Plate
1e2bfb6216 Trying to figure out how to get the youtrack token 2024-02-06 19:25:19 +02:00
Alex Plate
f755a4b23f Trying to figure out how to get the youtrack token 2024-02-06 19:20:38 +02:00
Alex Plate
4f58e12fca Trying to figure out how to get the youtrack token 2024-02-06 19:15:14 +02:00
Alex Plate
588cf89531 Rename the youtrackToken for the EAP release 2024-02-06 19:02:58 +02:00
Alex Plate
4fe2dd2706 Add a clearer error message about the missing youtrack token 2024-02-06 18:31:48 +02:00
Alex Plate
11ad605cd6 Add YouTrack token to the EAP release job 2024-02-06 18:28:57 +02:00
Alex Plate
fa9f160bd1 Fix incorrect names in EAP release jobs 2024-02-06 18:21:05 +02:00
Alex Plate
dae1fad54e Add commenting on YouTrack tickets as a part of EAP release process 2024-02-06 18:08:16 +02:00
IdeaVim Bot
52200188d4 Add Emanuel Gestosa to contributors list 2024-02-06 09:02:35 +00:00
Alex Plate
0d74b9ef0b Fix tag pushing in the release branch 2024-02-06 10:41:14 +02:00
Alex Plate
549163d274 Comment out everything for pycharm tests because it fails on GitHub 2024-02-06 10:32:58 +02:00
Alex Plate
755018c783 Update release jobs 2024-02-06 10:09:53 +02:00
Filipp Vakhitov
2a1c4b3a1c Better widget order 2024-02-06 00:32:25 +02:00
Alex Plate
aae0d825e7 Move the ideavim-sneak plugin into IdeaVim
The author of the original plugin announced the deprecation of the plugin.
However, we've got an approval to move the sources into IdeaVim and continue the development.

Original repo: https://github.com/Mishkun/ideavim-sneak
Approval: https://twitter.com/ideavim/status/1754512214344478939
2024-02-05 19:28:36 +02:00
Alex Plate
855dbfab16 Fix issues with enter in python console
VIM-3287
2024-02-05 18:31:43 +02:00
IdeaVim Bot
f3a357c559 Update changelog after merging PR 2024-02-05 14:31:53 +00:00
Filipp Vakhitov
63995e8c61 Support e flag for search 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
7062d9b8f8 Enable new regex engine by default 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
ede62f5c75 Fix compilation 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
6386770ff3 Move more tests to src 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
b4e831a81f Fix VisualAreaMatcher & TextRange 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
9b283360ce Minor improvements 2024-02-05 16:29:49 +02:00
Filipp Vakhitov
fabbd4d156 Better SelectionInfo implementation 2024-02-05 16:29:49 +02:00
filipp
9bea5bf5f7 Remove deprecated code 2024-02-05 16:29:49 +02:00
filipp
9fbc990493 Fix visual matching 2024-02-05 16:29:49 +02:00
filipp
b05fdaaa73 Fix tests 2024-02-05 16:29:49 +02:00
filipp
52d5d4d64c Fix Keyword token 2024-02-05 16:29:49 +02:00
filipp
6ec712466c Fix StartOfWordMatcher & EndOfWordMatcher 2024-02-05 16:29:49 +02:00
filipp
6616b8dc07 Simplify MarkMatchers 2024-02-05 16:29:49 +02:00
filipp
807457c718 Hide method and add Deprecated annotation 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
13d2a40903 removing print 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
022b196d6a adding comments and small refactors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7a64216830 getting rid of usages of deprecated classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bf7d2bd465 marking classes as deprecated 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6e97b591de fixing some error messages 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fc7c470966 fixing nohlsearch command 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
51492ca121 moving seach methods back to VimSearchGroup base 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ce1df84330 creating new IjVimSearchGroup class 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9b43e2a715 working on kotlin implementation of SearchGroup class 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
732cabd6aa working on processSearchCommand 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7c14801d5c deprecating most of SearchHelper 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
66df09c065 use injector for IjVimSearchHelper calls 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
8fd6985316 deprecating SearchHelper find and findAll 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
feac001499 substitute command working with new engine 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4c47e3a8eb integrating new regex into global command 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7773b625a5 \c token can't get overrided by \C 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
abe1abec72 test for \c token always taking priority 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
023838a96b working on implicit DFA algorithm optimization 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f4e743acc5 VimRegex uses wrapscan option 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
06d58cbda5 integrating options into the main module 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d199dea204 using options in findPrevious 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5722060ed9 testing VimRegex with smartcase set 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d4f7e727c1 VimRegex methods now receive options 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ba9afc3f8e adding usenewregex option to set command tests
rebasing
2024-02-05 16:29:49 +02:00
Emanuel Gestosa
39897bd012 allow findAll to have a max index 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
575d563154 show pattern not found error message 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
2bf46ce2f3 fixing findPrevious not wraping around in some cases 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b49a185efc using the count parameter in find() 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e305ebd1ed fixing patterns with just a AND operator 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6f5c9826f4 fixing patterns with single ^ or $ 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6025eaaca9 showing pattern not found error 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b2441c3cca throwing and catching VimRegexException 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a73599e9ee use non-exact nfas for slightly faster matches 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
58398f40fa using useNewRegex option 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
43f5d5a8e8 integrating findAll 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b20cbd3558 fix findNext getting stuck at line ends 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7f835a407c fix findPrevious not finding matches that start at end-of-line 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9859974db7 integrating findNext and findPrevious 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6c24ddd1a0 adding useNewEngine option 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bd92ef08ec use explicit stack instead of recursion for backtracking 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
8de6107a17 getting rid of handleTransition method 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e639f03ac7 stop using non-exact start nfas 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f9aac442c1 findAll returns List instead of Sequence 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5fdf675168 rename NFATest to VimRegexEngineTest 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
232f81ff48 commenting new classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1c4a6b2274 refactoring nfa simulation logic to its own class 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
deb71f8efc cleaning comments 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4596596d9f new findPrevious API method 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bbb6d42f8d changing find to findNext 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
01efd0f9f0 trying to get antlr to report vim errors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
2d7597d206 clearing some TODOS in VimRegex 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
221741c891 assuring that cursor line and column tokens belong to the same cursor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9f69beb450 test for pattern with multiple cursors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e843d9e9c3 assuring that visual selection tokens belong to the same cursor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
008b3d94fb assuring that all cursor and mark tokens belong to the same cursor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6756d83c55 test for tokens belonging to the same cursor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b52072a2e3 visitors for mark related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3afb00d563 tests for mark related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a30c94fd2f mock mark related methods for regex testing 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f50c29a285 matchers for mark related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f238b0f138 parsing more mark registers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d0a8c98040 parsing mark related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b3d161ad97 fix tests not detecting visual area selection properly 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fce9cf2077 visitor for visual area token 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
efd0e56697 visual area matcher 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b94a9bb9d9 nfa tests for matching inside visual area 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c153cc5a29 mock visual selection 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a680e9a25a visual columns matching 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3c18c4ef22 fixing parsing of optionally matched sequence 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c4e11b5976 visitor for optionally matched sequence 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
65be51dd48 tests for optionally matched sequence 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9684103f97 parsing optionally matched atoms tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f4c647d430 new doTest method for VimRegexTest 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f1eab3b9c1 dividing regex api tests into seperate classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
545d52bd93 dividing regex tests into internal and public api tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4e42198c09 using multi line strings in VimRegexTest 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
44736a51b9 new NFA doTest method 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e675ffd623 cleaning multiline strings in tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1f14e06bd3 refactoring editor mock methods 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9871078269 tests receive caret indexes in the text 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5e7a7f4d62 fixing cursor line and column matchers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7d690c6809 visitors for cursor line and column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6edb4266d5 nfa tests for cursor line and column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
799e82d501 matchers for cursor line anc column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a2370bff68 parsing cursor column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c72f3bcd12 parsing cursor line tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
295964a74d mocking VimEditor.offsetToBuffer position and fixing visitors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d77cda0fae visitors for line and column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6da072d47d matchers for line and column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
471a5a1b3e tests for line and column tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cd5da2d237 parsing column related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
62f67cd626 parsing line related tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
70db96d9e5 allow larger decimal codes inside collections 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
98470111fb fixing octal codes larger than 0o377 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
557a3bb01f fixing mixing % in match character by code tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
dee70acdcb tests for match character by code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
862b16879c visitors for character codes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ed7249558e parsing match character by code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4f6c6f4d10 fixing rebase problems 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
650d02d9b3 using TextRange instead of IntRange 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e4041a2f69 adding comments 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4c284a6d13 visitor for negative limited lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e14fc801bd fix lookbehinds matches not ending where they were supposed to 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
0478d468e0 adding tests for limited lookbehinds 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4ac98710fb implement limit lookbehinds 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f256f6417e parsing limited lookbehinds 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ca94d55b62 implementing negative lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c11c061113 add tests for negative lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c15c3eb802 implementing positive lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
0ce102b782 visitor for positive lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cc48207a99 adding tests for positive lookbehind 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
353ea5fc5d reworking nfa to ignore input until first match 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
64138310cc add more complex \& tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1c4538af72 implementing \& operator 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
755b47ef19 adding nfa tests for \& operator 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c78a5d3cab allow for a state to have multiple assertitions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b9b8d30f3b fixing collections with only char class expressions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9be93212c3 fname class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
89973809af keyword class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e324af356d ident class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f51fc6ed47 return, tab, escape, backspace class visitors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ecce98289a xdigit class 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
23c14aa2e4 upper class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
678d04c5db space class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
691ba75372 punct class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d2d7bbc632 print class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b3b1a6bdb9 lower class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
310125ea01 graph class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
208d1cbba2 digit class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e94154ba80 cntrl class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
582fbdd9e7 blank class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
dd175912f4 alnum class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a6a0ae7a51 alpha class visitor 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
8cdac91a01 base code for char classes expressions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4c89f41daa adding nfa tests for collection char classes expressions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
512e826a42 adding new parser tests for collection char classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bc0d277a21 parsing collection char class expressions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
169fe5fc5b parse visual \%V token 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
30867702a4 parsing lookbehind tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6131f92ae6 parsing ~ token 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
823a52583c documenting regex code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e2c6c0539f add more lookahead tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f7f1c0e90d making nested lookahead tests pass 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
eca12607dd pattern visitor is now a singleton 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
006e3e11f9 parser class is now a singleton 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a9982cbdca refactoring temporary field out of parser class 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
0fa9c5a2a2 moving all parsing logic to VimRegexParser class
rebasing
2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cdcc9729d3 add more failing lookahead tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4acf651aa7 adding tests for nested lookahead tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4bba791c65 adding comments and small cleanups 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
662688d3b9 refactoring inappropriate intimacy between nfa and nfaassertion classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
21a3e8fdc4 extract methods refactor in nfa simulation code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3815a1d538 add more lookahead tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cbe0c5cfec implementing negative lookahead 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
15db9b30e1 add tests for negative lookahead 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
e891294c0f parsing negative lookahead 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f6b9e7cc26 implementing positive lookahead 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
052fd7162f parsing positive lookahead 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
189acb73f5 dealing with atomic groups in a different way 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ec7c1677b4 allow special escape characters in collections \e \t \r \b \n 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a9474c8e67 allow character codes inside collections \d \o \x \u \U 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3a70dfc5f3 implementing collections with EOL \_[] 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
669177d803 implementing and testing start and end of word tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b1f43b061c parsing start and end of word tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7ff3c84deb commenting new atomic groups code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ee642b63ce adding explanatory comment on wierd atomic group test 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
17315e5096 implementing atomic groups 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4e9d52fc62 placeholder for atomic groups 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d7e87f8fc8 rename MultiBoundary to RangeBoundary 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3efe11f393 refactoring visitors to prepare for different types of multis 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
26c6c464d8 adding tests for atomic groups 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4db654e653 parsing atomic groups 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
048759d374 implement and test start and end of line anywhere in pattern 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
db2424057f parsing start and end line anywhere in pattern 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
472a53e3b9 start and end of line anchors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9e15d91900 adding tests for empty editors 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d5cff281c0 adding comments on new Matchers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
57b6c4dffb collection matcher uses set instead of list 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
908a2d1d8c start and end of file 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
69bdea9273 character classes never ignore case 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5b21a653ee add test for case insensitive matching 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cfddcf1630 ignore case tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f009687ddf matchesAt API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6ddfe29465 matches API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
715c51f673 matchEntire API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b443e8f06a fix quantified capture groups not updating properly 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
0bd0466c9c cleaning adding transitions to states 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ad5db3c9e5 fix capturing groups not updating properly 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fa3182cb5e adding failing backreferences test 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
3f44bed66e adding comments to Matchers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
2a70530d0f matchAt API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7c542d5fc7 implementing character classes with EOL 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
638dfb7777 parsing character classes with new line 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1323536a63 testing and implementing backreferences 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
419212e2d4 parsing backreferences 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5f1c234a7d refactor Matcher to return number of consumed characters 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
db1e8301cd implementing and testing lazy quantifiers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bf94a3c68d parsing lazy quantifiers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
96baa4ffc6 all named character classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
7d472afe61 set match start and end \zs \ze 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f32a4d33a7 support unicode escape sequence in collections 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
0722991955 add test for collection with not special escaped character 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
bcc740cdbc implementing custom collections 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5cf46097f7 ascii character classes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
61dc189f8b char classes and collections base code 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
23c2b008c9 implementing cursor and using mockito to mock editor
rebasing
2024-02-05 16:29:49 +02:00
Emanuel Gestosa
db14afdf3a dot with and without newline 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b7927336d1 implementing dot 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ee23a3d4cd commenting findAll 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
63c0112ffb findAll API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
db08d7d280 find API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
9892525fbc containsMatchIn API function 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
34b87ff6bf adding comments 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
241ad68bd5 fix nfa looping in epsilon transitions 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
a0ec18921b more correct way of handling quantifiers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
45e17eb0b2 fixing quantifiers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
59f0e9ae67 add test for updating capture group 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
af24611c73 capture group submatch 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d4502dda3f VimMatchResult stores matched string value 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c0efa8af5d use IntRange for match range 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1c06a3fc89 add test for empty group 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
c19fb38d1c implementing grouping 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
5dc1de9daf add nfa test for escaped character 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6774301938 updating comments 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4ef6cf0428 implementing quantifiers 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
ca5f8e4b44 skeleton for NFA testing 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
1907f03abe nfa simulation uses VimEditor instead of String 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
6351a4e4f3 initial nfa 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fa34c3937f initial nfa definition 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cdac97ebf5 adding some zero-width tokens 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fe958d28b8 lexer fixing what chars are taken literally 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f71982e1d5 support unicode in collections 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
cb2bfcea53 unicode chars in all lexer modes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
4a9d5bbceb lexer support for unicode characters 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
10809eade6 regex very magic and very nomagic modes 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
43d63527f8 adding comments to parser grammar 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
df51eb54ed using antlr token types 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
b47109ab4d grammar add EOF at end of pattern 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
15b2b68940 making new collection tests pass 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
62a239f6fe add tests for collections 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
d89bc95a0a altering antlr error handling 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
2a76f21b31 regex range basic tests 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
f07e22d742 delete duplicate files 2024-02-05 16:29:49 +02:00
Emanuel Gestosa
058ab7a1ea gradle generate antlr files
rebasing
2024-02-05 16:29:49 +02:00
Emanuel Gestosa
fae3baa640 initial regex grammar 2024-02-05 16:29:49 +02:00
IdeaVim Bot
2c4da9c634 Update changelog. Action id - 7766144293 2024-02-03 10:06:57 +00:00
Alex Plate
8de0313aca Preparing the UI tests for the PyCharm 2024-02-02 20:16:47 +02:00
Alex Plate
143c5b17f9 Fix(VIM-3055): Fix the issue with double deleting after dot 2024-02-02 19:30:58 +02:00
Alex Plate
ec32fde60d Release job: Update version of kotlin dsl 2024-02-02 09:16:49 +02:00
Alex Plate
f2ac5d4995 Release job: Do not make slack notification for the patch version 2024-02-02 09:07:17 +02:00
Alex Plate
716962af03 Release job: Use the command line runner to start the tests
TC detects tests and report them in the release job. I just want to have a "Success" word when everything done.
You cannot disable the tests detection on TC, but the detection doesn't work if the tests were started from the command line
2024-02-02 08:57:28 +02:00
Alex Plate
156efde6b9 Release job: Do not make a commit if there are no changes 2024-02-02 08:50:47 +02:00
IdeaVim Bot
a9b7716dfe Preparation to 2.8.2 release 2024-02-01 09:47:48 +00:00
Alex Plate
76a67a6715 Do not add an update entry if missing 2024-02-01 11:43:16 +02:00
Filipp Vakhitov
c3defdcda4 Add sources and JavaDoc to vim-engine jar 2024-02-01 11:07:28 +02:00
filipp.vakhitov
d8092aa916 TeamCity change in 'Ideavim / IdeaVim releases' project: parameters of 'Publish vim-engine' build configuration were updated 2024-02-01 08:15:00 +00:00
filipp.vakhitov
8b5a3d31aa TeamCity change in 'Ideavim / IdeaVim releases' project: parameters of 'Publish vim-engine' build configuration were updated 2024-02-01 08:14:45 +00:00
Filipp Vakhitov
11761b66b2 Revert "Fix(VIM-3183): Execute .ideavimrc on pooled thread"
This reverts commit 1d7796805c.
2024-01-31 20:10:32 +02:00
Filipp Vakhitov
f83f107bd1 Revert "Support triggering option listeners outside EDT"
This reverts commit 5a6f54c96c.
2024-01-31 20:10:18 +02:00
Filipp Vakhitov
f1b90857ff Revert "Fix code in execute requiring EDT or write actions"
This reverts commit e7236beedd.
2024-01-31 20:10:15 +02:00
Filipp Vakhitov
5aea4cdd65 Revert "Avoiding slow operations on EDT"
This reverts commit 00fb5bc6cf.
2024-01-31 20:09:55 +02:00
Filipp Vakhitov
1822a59c70 Revert "Fix(VIM-3273): Config file stopped working"
This reverts commit 04230fdd9c.
2024-01-31 20:09:31 +02:00
Filipp Vakhitov
37c6934802 Revert "Update changelog. Action id - 7724318708"
This reverts commit 434511658b.
2024-01-31 20:09:27 +02:00
Filipp Vakhitov
90c7f747a4 Revert "Fix(VIM-3278) Relative number is broken in 2.8.0"
This reverts commit a1646a7a88.
2024-01-31 20:09:23 +02:00
Filipp Vakhitov
b7efa3dcd6 Revert "Add EDT where it is needed"
This reverts commit 3e9706e6ce.
2024-01-31 20:09:19 +02:00
Filipp Vakhitov
da80f537ac Revert "Avoid concurrent VimScript execution"
This reverts commit 0e03151505.
2024-01-31 20:09:15 +02:00
Filipp Vakhitov
0119912318 Revert "Add readActions & EDT"
This reverts commit 45a2eadc58.
2024-01-31 20:09:08 +02:00
Alex Plate
5e0b1d0161 Update the way the changelog is updated for the patch release 2024-01-31 19:24:27 +02:00
Alex Plate
35145d100b Update the release jobs to make releases only from the release branch
In this way, we'll avoid the problem that some breaking commits may be added between the last EAP and master branch
2024-01-31 18:50:26 +02:00
Alex Plate
584dd0ba89 Run tests before releasing IdeaVim 2024-01-31 18:21:03 +02:00
Alex Plate
e5f5dc56c9 Remove the obsolete gradle scripts 2024-01-31 18:21:03 +02:00
Alex Plate
880efb012a Fix compilation issues for the latest EAP 2024-01-31 17:58:19 +02:00
Alex Plate
b95308ac24 Migrate CopilotKeymapCorrector to the new API 2024-01-31 17:42:08 +02:00
aleksei.plate@jetbrains.com
3b192ad357 TeamCity change in 'Ideavim / IdeaVim releases' project: parameters of 'Publish vim-engine' build configuration were updated 2024-01-31 15:01:37 +00:00
aleksei.plate@jetbrains.com
b04938ac5e TeamCity change in 'Ideavim / IdeaVim releases' project: parameters of 'Publish vim-engine' build configuration were updated 2024-01-31 13:37:25 +00:00
Alex Plate
56410ac1f2 Make some classes public because they're used in EasyMotion plugin tests 2024-01-31 15:25:33 +02:00
Filipp Vakhitov
45a2eadc58 Add readActions & EDT 2024-01-31 14:43:23 +02:00
Filipp Vakhitov
0e03151505 Avoid concurrent VimScript execution 2024-01-31 14:42:58 +02:00
Filipp Vakhitov
3e9706e6ce Add EDT where it is needed 2024-01-31 14:09:06 +02:00
Filipp Vakhitov
a1646a7a88 Fix(VIM-3278) Relative number is broken in 2.8.0
Proper options initialization order
2024-01-31 13:34:33 +02:00
IdeaVim Bot
434511658b Update changelog. Action id - 7724318708 2024-01-31 10:06:47 +00:00
Filipp Vakhitov
04230fdd9c Fix(VIM-3273): Config file stopped working 2024-01-31 09:12:23 +02:00
Filipp Vakhitov
2e16ad8a2a Revert "Downgrade ktor dependencies to check if "Publish vim-engine" fails because of them"
This reverts commit 7fb59b0fa9.
2024-01-30 20:13:36 +02:00
Filipp Vakhitov
7fb59b0fa9 Downgrade ktor dependencies to check if "Publish vim-engine" fails because of them 2024-01-30 20:05:45 +02:00
Filipp Vakhitov
24e044bcda Remove deprecated ComplicatedKeysAction.kt 2024-01-30 18:56:38 +02:00
IdeaVim Bot
1093656ec5 Preparation to 2.8.0 release 2024-01-30 10:46:04 +00:00
Alex Plate
674e997060 Fix the condition for the release branch reset step 2024-01-30 12:33:28 +02:00
Alex Plate
37fd124f56 Use bash to reset the branch 2024-01-30 11:34:25 +02:00
Alex Plate
7df2e67312 Re-request commit message 2024-01-30 10:00:08 +02:00
Alex Plate
8ea1f0796c Add logs to release job 2024-01-30 09:53:51 +02:00
Filipp Vakhitov
00fb5bc6cf Avoiding slow operations on EDT 2024-01-29 13:30:41 +02:00
Filipp Vakhitov
5e01f726d3 Revert "Remove deprecated VimScriptGlobalEnvironment.java"
This reverts commit 5c64ebf1cc.
2024-01-29 12:58:46 +02:00
Filipp Vakhitov
e87290aeea Simplify storing global variables 2024-01-29 12:58:31 +02:00
Filipp Vakhitov
e7236beedd Fix code in execute requiring EDT or write actions 2024-01-29 10:00:55 +02:00
Filipp Vakhitov
5a6f54c96c Support triggering option listeners outside EDT 2024-01-28 14:00:36 +02:00
filipp
7769985439 Merge remote-tracking branch 'origin/master' 2024-01-28 13:37:58 +02:00
IdeaVim Bot
f4afdb21b2 Update changelog. Action id - 7677896605 2024-01-27 10:06:55 +00:00
Alex Plate
cc1b9e0a50 Expand all works a way worse 2024-01-27 07:43:28 +02:00
Alex Plate
2c58740cbb Expand the full tree in UI tests 2024-01-26 21:49:49 +02:00
Alex Plate
808533b110 Fix(VIM-3260): Processing the offsets at the file end 2024-01-26 17:49:44 +02:00
Alex Plate
e04a15bb99 Add new plugin to check plugin dependencies 2024-01-26 17:23:55 +02:00
Alex Plate
26d4074a61 [VIM-2974] Adopt other parts of key handling to the octopus handler switcher 2024-01-26 16:40:34 +02:00
filipp
0137de5ca2 Add Term widget theme 2024-01-26 15:52:07 +02:00
Alex Plate
b0a1b2edba Do not make cd in tests 2024-01-26 15:47:13 +02:00
Alex Plate
355c560ddc Add UI test with disabled octopus handler 2024-01-26 15:32:30 +02:00
Alex Plate
72f286d9c6 Add UI test for multicaret enter in select mode 2024-01-26 15:32:30 +02:00
Alex Plate
db6786414a [VIM-2974] WIP: Bringing back the octopus handler switch 2024-01-26 15:32:29 +02:00
filipp
f8f046f193 Fix plugin.xml 2024-01-26 14:00:07 +02:00
filipp
6c9ad4ded2 Remove deprecated xml-related code 2024-01-26 13:45:46 +02:00
filipp
32cae8ca11 Remove more deprecated things 2024-01-26 13:05:48 +02:00
filipp
0cb65279d9 Remove deprecated mark-related methods 2024-01-26 13:02:23 +02:00
filipp
412da06554 Remove deprecated ToggleOption.kt 2024-01-26 12:47:06 +02:00
filipp
247f8a2778 Remove deprecated OptionsManager.kt 2024-01-26 12:45:46 +02:00
filipp
017c9a6a70 Remove deprecated OptionService.kt 2024-01-26 12:43:06 +02:00
filipp
eccb2430b5 Remove deprecated MarkGroup.java 2024-01-26 12:39:30 +02:00
filipp
5c64ebf1cc Remove deprecated VimScriptGlobalEnvironment.java 2024-01-26 12:38:28 +02:00
filipp
1d7796805c Fix(VIM-3183): Execute .ideavimrc on pooled thread 2024-01-26 12:27:03 +02:00
dependabot[bot]
3479aaf6f6 Bump org.jetbrains.intellij from 1.16.1 to 1.17.0
Bumps org.jetbrains.intellij from 1.16.1 to 1.17.0.

---
updated-dependencies:
- dependency-name: org.jetbrains.intellij
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:02:11 +04:00
dependabot[bot]
d2071cf05c Bump com.google.devtools.ksp:symbol-processing-api
Bumps [com.google.devtools.ksp:symbol-processing-api](https://github.com/google/ksp) from 1.9.22-1.0.16 to 1.9.22-1.0.17.
- [Release notes](https://github.com/google/ksp/releases)
- [Commits](https://github.com/google/ksp/compare/1.9.22-1.0.16...1.9.22-1.0.17)

---
updated-dependencies:
- dependency-name: com.google.devtools.ksp:symbol-processing-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-24 20:02:01 +04:00
730 changed files with 97330 additions and 46125 deletions

View File

@@ -11,7 +11,7 @@ on:
jobs:
build:
if: github.event.pull_request.merged == true && github.repository == 'JetBrains/ideavim'
if: false
runs-on: ubuntu-latest
steps:

81
.github/workflows/runUiOctopusTests.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Run Non Octopus UI Tests
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * *'
jobs:
build-for-ui-test-mac-os:
if: github.repository == 'JetBrains/ideavim'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Setup FFmpeg
run: brew install ffmpeg
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- name: Build Plugin
run: gradle :buildPlugin
- name: Run Idea
run: |
mkdir -p build/reports
gradle runIdeForUiTests -Doctopus.handler=false > build/reports/idea.log &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@v3
with:
url: http://127.0.0.1:8082
max-attempts: 20
retry-delay: 10s
- name: Tests
run: gradle :tests:ui-ij-tests:testUi
- name: Move video
if: always()
run: mv tests/ui-ij-tests/video build/reports
- name: Move sandbox logs
if: always()
run: mv build/idea-sandbox/system/log sandbox-idea-log
- name: Save report
if: always()
uses: actions/upload-artifact@v4
with:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-ij-tests/build/reports
sandbox-idea-log
# build-for-ui-test-linux:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup Java
# uses: actions/setup-java@v2.1.0
# with:
# distribution: zulu
# java-version: 11
# - name: Build Plugin
# run: gradle :buildPlugin
# - name: Run Idea
# run: |
# export DISPLAY=:99.0
# Xvfb -ac :99 -screen 0 1920x1080x16 &
# mkdir -p build/reports
# gradle :runIdeForUiTests #> build/reports/idea.log
# - name: Wait for Idea started
# uses: jtalk/url-health-check-action@1.5
# with:
# url: http://127.0.0.1:8082
# max-attempts: 15
# retry-delay: 30s
# - name: Tests
# run: gradle :testUi
# - name: Save fails report
# if: ${{ failure() }}
# uses: actions/upload-artifact@v2
# with:
# name: ui-test-fails-report-linux
# path: |
# ui-test-example/build/reports

52
.github/workflows/runUiPyTests.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: Run UI PyCharm Tests
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * *'
jobs:
build-for-ui-test-mac-os:
if: github.repository == 'JetBrains/ideavim'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup FFmpeg
run: brew install ffmpeg
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- name: Build Plugin
run: gradle :buildPlugin
- name: Run Idea
run: |
mkdir -p build/reports
gradle :runIdeForUiTests -PideaType=PC > build/reports/idea.log &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@v3
with:
url: http://127.0.0.1:8082
max-attempts: 20
retry-delay: 10s
- name: Tests
run: gradle :tests:ui-py-tests:testUi
- name: Move video
if: always()
run: mv tests/ui-py-tests/video build/reports
- name: Move sandbox logs
if: always()
run: mv build/idea-sandbox/system/log sandbox-idea-log
- name: Save report
if: always()
uses: actions/upload-artifact@v4
with:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-py-tests/build/reports
sandbox-idea-log

View File

@@ -13,13 +13,9 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11
java-version: 17
- name: Setup FFmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
with:
# Not strictly necessary, but it may prevent rate limit
# errors especially on GitHub-hosted macos machines.
github-token: ${{ secrets.GITHUB_TOKEN }}
run: brew install ffmpeg
- name: Setup Gradle
uses: gradle/gradle-build-action@v2.4.2
- name: Build Plugin
@@ -27,7 +23,7 @@ jobs:
- name: Run Idea
run: |
mkdir -p build/reports
gradle :runIdeForUiTests > build/reports/idea.log &
gradle runIdeForUiTests > build/reports/idea.log &
- name: Wait for Idea started
uses: jtalk/url-health-check-action@v3
with:
@@ -35,10 +31,10 @@ jobs:
max-attempts: 20
retry-delay: 10s
- name: Tests
run: gradle :testUi
run: gradle :tests:ui-ij-tests:testUi
- name: Move video
if: always()
run: mv video build/reports
run: mv tests/ui-ij-tests/video build/reports
- name: Move sandbox logs
if: always()
run: mv build/idea-sandbox/system/log sandbox-idea-log
@@ -49,6 +45,7 @@ jobs:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-ij-tests/build/reports
sandbox-idea-log
# build-for-ui-test-linux:
# runs-on: ubuntu-latest

View File

@@ -1,34 +0,0 @@
# 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: Update Affected Rate field on YouTrack
on:
workflow_dispatch:
schedule:
- cron: '0 8 * * *'
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'JetBrains/ideavim'
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: Update YouTrack
run: ./gradlew scripts:updateAffectedRates
env:
YOUTRACK_TOKEN: ${{ secrets.YOUTRACK_TOKEN }}

View File

@@ -7,15 +7,12 @@ on:
workflow_dispatch:
schedule:
- cron: '0 10 * * *'
# Workflow run on push is disabled to avoid conflicts when merging PR
# push:
# branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'JetBrains/ideavim'
if: false
steps:
- uses: actions/checkout@v3

1
.gitignore vendored
View File

@@ -23,6 +23,7 @@
# Generated by gradle task "generateGrammarSource"
src/main/java/com/maddyhome/idea/vim/vimscript/parser/generated
vim-engine/src/main/java/com/maddyhome/idea/vim/regexp/parser/generated
# Generated JSONs for lazy classloading
/vim-engine/src/main/resources/ksp-generated
/src/main/resources/ksp-generated

2
.idea/vcs.xml generated
View File

@@ -11,6 +11,6 @@
</option>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -5,13 +5,13 @@ object Constants {
const val EAP_CHANNEL = "eap"
const val DEV_CHANNEL = "Dev"
const val GITHUB_TESTS = "2023.3.2"
const val NVIM_TESTS = "2023.3.2"
const val PROPERTY_TESTS = "2023.3.2"
const val LONG_RUNNING_TESTS = "2023.3.2"
const val QODANA_TESTS = "2023.3.2"
const val RELEASE = "2023.3.2"
const val GITHUB_TESTS = "2024.1.1"
const val NVIM_TESTS = "2024.1.1"
const val PROPERTY_TESTS = "2024.1.1"
const val LONG_RUNNING_TESTS = "2024.1.1"
const val QODANA_TESTS = "2024.1.1"
const val RELEASE = "2024.1.1"
const val RELEASE_DEV = "2023.3.2"
const val RELEASE_EAP = "2023.3.2"
const val RELEASE_DEV = "2024.1.1"
const val RELEASE_EAP = "2024.1.1"
}

View File

@@ -11,20 +11,22 @@ import _Self.subprojects.GitHub
import _Self.subprojects.OldTests
import _Self.subprojects.Releases
import _Self.vcsRoots.GitHubPullRequest
import _Self.vcsRoots.ReleasesVcsRoot
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
object Project : Project({
description = "Vim engine for IDEs based on the IntelliJ platform"
description = "Vim engine for JetBrains IDEs"
subProjects(Releases, OldTests, GitHub)
// VCS roots
vcsRoot(GitHubPullRequest)
vcsRoot(ReleasesVcsRoot)
// Active tests
buildType(TestingBuildType("Latest EAP", "<default>", version = "LATEST-EAP-SNAPSHOT"))
buildType(TestingBuildType("2023.3", "<default>", version = "2023.3"))
buildType(TestingBuildType("2024.1.1", "<default>"))
buildType(TestingBuildType("Latest EAP With Xorg", "<default>", version = "LATEST-EAP-SNAPSHOT"))
buildType(PropertyBased)

View File

@@ -34,7 +34,6 @@ object Compatibility : IdeaVimBuildType({
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

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2003-2024 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 _Self.buildTypes
import _Self.IdeaVimBuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.sshAgent
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
object CreateNewReleaseBranchFromMaster : IdeaVimBuildType({
name = "EXP: Create new release branch from master"
vcs {
root(DslContext.settingsRoot)
branchFilter = "+:<default>"
checkoutMode = CheckoutMode.AUTO
}
steps {
script {
name = "Calculate next potential release version"
scriptContent = """
#!/bin/bash
# Fetch all remote branches
git fetch --all
# Get a list of all branches matching the pattern releases/x.y.z
branches=${'$'}(git branch -r | grep -oE 'releases/[0-9]+\.[0-9]+\.x')
# If no matching branches are found, print a message and exit
if [[ -z "${'$'}branches" ]]; then
echo "No release branches found"
exit 1
fi
# Find the largest release version
largest_release=${'$'}(echo "${'$'}branches" | sort -V | tail -n 1)
# Print the largest release
echo "Largest release branch: ${'$'}largest_release"
echo "##teamcity[setParameter name='env.POTENTIAL_VERSION' value='${'$'}largest_release']"
""".trimIndent()
}
script {
name = "Show potential release version"
scriptContent = """
#!/bin/bash
echo "Calculated or user-provided parameter value is: %env.POTENTIAL_VERSION%"
""".trimIndent()
}
}
params {
param("env.POTENTIAL_VERSION", "")
}
features {
sshAgent {
teamcitySshKey = "IdeaVim ssh keys"
}
}
})

View File

@@ -25,7 +25,7 @@ object LongRunning : IdeaVimBuildType({
steps {
gradle {
tasks = "clean testLongRunning"
tasks = "clean :tests:long-running-tests:testLongRunning"
buildFile = ""
enableStacktrace = true
}

View File

@@ -39,7 +39,7 @@ object Nvim : IdeaVimBuildType({
""".trimIndent()
}
gradle {
tasks = "clean testWithNeovim"
tasks = "clean test -Dnvim"
buildFile = ""
enableStacktrace = true
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2003-2024 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 _Self.buildTypes
import _Self.IdeaVimBuildType
import _Self.vcsRoots.ReleasesVcsRoot
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.sshAgent
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
object PrintReleaseBranch : IdeaVimBuildType({
name = "EXP: Print release branch"
vcs {
root(ReleasesVcsRoot)
branchFilter = "+:heads/releases/*"
checkoutMode = CheckoutMode.AUTO
}
steps {
script {
name = "Print current branch"
scriptContent = """
echo "Current branch is: %teamcity.build.branch%"
""".trimIndent()
}
}
features {
sshAgent {
teamcitySshKey = "IdeaVim ssh keys"
}
}
})

View File

@@ -24,7 +24,7 @@ object PropertyBased : IdeaVimBuildType({
steps {
gradle {
tasks = "clean testPropertyBased"
tasks = "clean :tests:property-tests:testPropertyBased"
buildFile = ""
enableStacktrace = true
}

View File

@@ -20,13 +20,13 @@ object PublishVimEngine : IdeaVimBuildType({
params {
param("env.ORG_GRADLE_PROJECT_engineVersion", "%build.number%")
param("env.ORG_GRADLE_PROJECT_uploadUrl", "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
password("env.ORG_GRADLE_PROJECT_spacePassword", "credentialsJSON:790b4e43-ee83-4184-b81b-678afab60409", display = ParameterDisplay.HIDDEN)
param("env.ORG_GRADLE_PROJECT_spaceUsername", "Aleksei.Plate")
password("env.ORG_GRADLE_PROJECT_spacePassword", "credentialsJSON:5ea56f8c-efe7-4e1e-83de-0c02bcc39d0b", display = ParameterDisplay.HIDDEN)
param("env.ORG_GRADLE_PROJECT_spaceUsername", "a121c67e-39ac-40e6-bf82-649855ec27b6")
}
vcs {
root(DslContext.settingsRoot)
branchFilter = "+:<default>"
branchFilter = "+:fleet"
checkoutMode = CheckoutMode.AUTO
}

View File

@@ -46,8 +46,8 @@ object Qodana : IdeaVimBuildType({
version = Qodana.JVMVersion.LATEST
}
reportAsTests = true
additionalDockerArguments = "-e QODANA_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzUFZrQSIsInByb2plY3QiOiIzN1FlQSIsInRva2VuIjoiM0t2bXoifQ.uohp81tM7iAfvvB6k8faarfpV-OjusAaEbWQ8iNrOgs"
additionalQodanaArguments = "--baseline qodana.sarif.json"
cloudToken = "credentialsJSON:6b79412e-9198-4862-9223-c5019488f903"
}
}
@@ -63,7 +63,6 @@ object Qodana : IdeaVimBuildType({
timezone = "SERVER"
}
param("dayOfWeek", "Sunday")
enabled = false
}
}

View File

@@ -5,6 +5,7 @@ import _Self.Constants.RELEASE_EAP
import _Self.IdeaVimBuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2019_2.DslContext
import jetbrains.buildServer.configs.kotlin.v2019_2.ParameterDisplay
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.sshAgent
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
@@ -30,6 +31,11 @@ object ReleaseEap : IdeaVimBuildType({
"credentialsJSON:a8ab8150-e6f8-4eaf-987c-bcd65eac50b5",
label = "Slack Token"
)
password(
"env.YOUTRACK_TOKEN",
"credentialsJSON:2479995b-7b60-4fbb-b095-f0bafae7f622",
display = ParameterDisplay.HIDDEN
)
}
vcs {
@@ -61,13 +67,9 @@ object ReleaseEap : IdeaVimBuildType({
tasks = "scripts:addReleaseTag"
}
gradle {
name = "Publish plugin"
tasks = "publishPlugin"
}
// Same as the script below. However, jgit can't find ssh keys on TeamCity
// gradle {
// name = "Push changes to the repo"
// tasks = "scripts:pushChanges"
// }
script {
name = "Push changes to the repo"
scriptContent = """
@@ -81,6 +83,10 @@ object ReleaseEap : IdeaVimBuildType({
git push origin %build.number%
""".trimIndent()
}
gradle {
name = "YouTrack post release actions"
tasks = "scripts:eapReleaseActions"
}
}
features {

View File

@@ -0,0 +1,106 @@
package _Self.buildTypes
import _Self.Constants.EAP_CHANNEL
import _Self.Constants.RELEASE_EAP
import _Self.IdeaVimBuildType
import _Self.vcsRoots.ReleasesVcsRoot
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
import jetbrains.buildServer.configs.kotlin.v2019_2.ParameterDisplay
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.sshAgent
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric
import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange
object ReleaseEapFromBranch : IdeaVimBuildType({
name = "EXP: Publish EAP Build from branch"
description = "Build and publish EAP of IdeaVim plugin"
artifactRules = "build/distributions/*"
params {
param("env.ORG_GRADLE_PROJECT_ideaVersion", RELEASE_EAP)
password(
"env.ORG_GRADLE_PROJECT_publishToken",
"credentialsJSON:61a36031-4da1-4226-a876-b8148bf32bde",
label = "Password"
)
param("env.ORG_GRADLE_PROJECT_publishChannels", EAP_CHANNEL)
password(
"env.ORG_GRADLE_PROJECT_slackUrl",
"credentialsJSON:a8ab8150-e6f8-4eaf-987c-bcd65eac50b5",
label = "Slack Token"
)
password(
"env.YOUTRACK_TOKEN",
"credentialsJSON:2479995b-7b60-4fbb-b095-f0bafae7f622",
display = ParameterDisplay.HIDDEN
)
}
vcs {
root(ReleasesVcsRoot)
branchFilter = """
+:heads/(releases/*)
""".trimIndent()
checkoutMode = CheckoutMode.AUTO
}
steps {
script {
name = "Pull git tags"
scriptContent = "git fetch --tags origin"
}
script {
name = "Pull git history"
scriptContent = "git fetch --unshallow"
}
gradle {
name = "Calculate new eap version from branch"
tasks = "scripts:calculateNewEapVersionFromBranch"
}
gradle {
name = "Set TeamCity build number"
tasks = "scripts:setTeamCityBuildNumber"
}
gradle {
name = "Add release tag"
tasks = "scripts:addReleaseTag"
}
gradle {
name = "Publish plugin"
tasks = "publishPlugin"
}
script {
name = "Push changes to the repo"
scriptContent = """
branch=$(git branch --show-current)
echo current branch is ${'$'}branch
git push origin %build.number%
""".trimIndent()
}
gradle {
name = "YouTrack post release actions"
tasks = "scripts:eapReleaseActions"
}
}
features {
sshAgent {
teamcitySshKey = "IdeaVim ssh keys"
}
}
failureConditions {
failOnMetricChange {
metric = BuildFailureOnMetric.MetricType.ARTIFACT_SIZE
threshold = 5
units = BuildFailureOnMetric.MetricUnit.PERCENTS
comparison = BuildFailureOnMetric.MetricComparison.DIFF
compareTo = build {
buildRule = lastSuccessful()
}
}
}
})

View File

@@ -45,7 +45,11 @@ sealed class ReleasePlugin(private val releaseType: String) : IdeaVimBuildType({
"credentialsJSON:a8ab8150-e6f8-4eaf-987c-bcd65eac50b5",
label = "Slack Token"
)
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:3cd3e867-282c-451f-b958-bc95d56a8450", display = ParameterDisplay.HIDDEN)
password(
"env.ORG_GRADLE_PROJECT_youtrackToken",
"credentialsJSON:7bc0eb3a-b86a-4ebd-b622-d4ef12d7e1d3",
display = ParameterDisplay.HIDDEN
)
param("env.ORG_GRADLE_PROJECT_releaseType", releaseType)
}
@@ -65,9 +69,25 @@ sealed class ReleasePlugin(private val releaseType: String) : IdeaVimBuildType({
name = "Pull git history"
scriptContent = "git fetch --unshallow"
}
gradle {
name = "Select branch"
tasks = "scripts:selectBranch"
script {
name = "Reset release branch"
scriptContent = """
if [ "major" = "$releaseType" ] || [ "minor" = "$releaseType" ]
then
echo Resetting the release branch because the release type is $releaseType
git checkout master
latest_eap=${'$'}(git describe --tags --match="[0-9].[0-9]*.[0-9]-eap.[0-9]*" --abbrev=0 HEAD)
echo Latest EAP: ${'$'}latest_eap
commit_of_latest_eap=${'$'}(git rev-list -n 1 ${'$'}latest_eap)
echo Commit of latest EAP: ${'$'}commit_of_latest_eap
git checkout release
git reset --hard ${'$'}commit_of_latest_eap
else
git checkout release
echo Do not reset the release branch because the release type is $releaseType
fi
echo Checked out release branch
""".trimIndent()
}
gradle {
name = "Calculate new version"
@@ -77,63 +97,60 @@ sealed class ReleasePlugin(private val releaseType: String) : IdeaVimBuildType({
name = "Set TeamCity build number"
tasks = "scripts:setTeamCityBuildNumber"
}
gradle {
name = "Update change log"
tasks = "scripts:changelogUpdateUnreleased"
}
gradle {
name = "Commit preparation changes"
tasks = "scripts:commitChanges"
}
// gradle {
// name = "Update change log"
// tasks = "scripts:changelogUpdateUnreleased"
// }
// gradle {
// name = "Commit preparation changes"
// tasks = "scripts:commitChanges"
// }
gradle {
name = "Add release tag"
tasks = "scripts:addReleaseTag"
}
gradle {
name = "Reset release branch"
tasks = "scripts:resetReleaseBranch"
script {
name = "Run tests"
scriptContent = "./gradlew test"
}
gradle {
name = "Publish release"
tasks = "publishPlugin"
}
// script {
// name = "Checkout master branch"
// scriptContent = """
// echo Checkout master
// git checkout master
// """.trimIndent()
// }
// gradle {
// name = "Push changes to the repo"
// tasks = "scripts:pushChangesWithReleaseBranch"
// name = "Update change log in master"
// tasks = "scripts:changelogUpdateUnreleased"
// }
// gradle {
// name = "Commit preparation changes in master"
// tasks = "scripts:commitChanges"
// }
script {
name = "Push changes to the repo"
scriptContent = """
branch=$(git branch --show-current)
echo current branch is ${'$'}branch
if [ "master" != "${'$'}branch" ];
then
git checkout master
fi
git push origin --tags
git push origin
if [ "patch" != $releaseType ];
then
git checkout release
echo checkout release branch
git branch --set-upstream-to=origin/release release
git push --tags
git push origin --force
fi
git checkout ${'$'}branch
# Push tag
git push origin %build.number%
""".trimIndent()
}
gradle {
name = "Run Integrations"
tasks = "releaseActions"
}
gradle {
name = "Slack Notification"
tasks = "slackNotification"
}
// gradle {
// name = "Slack Notification"
// tasks = "slackNotification"
// }
}
features {

View File

@@ -16,10 +16,10 @@ object GitHub : Project({
name = "Pull Requests checks"
description = "Automatic checking of GitHub Pull Requests"
buildType(Github("clean test", "Tests"))
buildType(GithubBuildType("clean test", "Tests"))
})
class Github(command: String, desc: String) : IdeaVimBuildType({
class GithubBuildType(command: String, desc: String) : IdeaVimBuildType({
name = "GitHub Pull Requests $desc"
description = "Test GitHub pull requests $desc"

View File

@@ -1,8 +1,11 @@
package _Self.subprojects
import _Self.buildTypes.CreateNewReleaseBranchFromMaster
import _Self.buildTypes.PrintReleaseBranch
import _Self.buildTypes.PublishVimEngine
import _Self.buildTypes.ReleaseDev
import _Self.buildTypes.ReleaseEap
import _Self.buildTypes.ReleaseEapFromBranch
import _Self.buildTypes.ReleaseMajor
import _Self.buildTypes.ReleaseMinor
import _Self.buildTypes.ReleasePatch
@@ -38,4 +41,8 @@ object Releases : Project({
buildType(ReleaseEap)
buildType(ReleaseDev)
buildType(PublishVimEngine)
buildType(CreateNewReleaseBranchFromMaster)
buildType(PrintReleaseBranch)
buildType(ReleaseEapFromBranch)
})

13
.teamcity/_Self/vcsRoots/Releases.kt vendored Normal file
View File

@@ -0,0 +1,13 @@
package _Self.vcsRoots
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot
object ReleasesVcsRoot : GitVcsRoot({
name = "IdeaVim Releases"
url = "git@github.com:JetBrains/ideavim.git"
branch = "refs/heads/master"
branchSpec = "+:refs/(*)"
authMethod = uploadedKey {
uploadedKey = "IdeaVim ssh keys"
}
})

View File

@@ -1,11 +1,9 @@
package patches.buildTypes
import jetbrains.buildServer.configs.kotlin.v2019_2.RelativeId
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.changeBuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.expectSteps
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.update
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
/*
This patch script was generated by TeamCity on settings change in UI.
@@ -13,6 +11,18 @@ To apply the patch, change the buildType with id = 'IdeaVimTests_Latest_EAP'
accordingly, and delete the patch script.
*/
changeBuildType(RelativeId("IdeaVimTests_Latest_EAP")) {
check(artifactRules == """
+:build/reports => build/reports
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
""".trimIndent()) {
"Unexpected option value: artifactRules = $artifactRules"
}
artifactRules = """
+:build/reports => build/reports
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
+:tests/java-tests/build/reports => tests/java-tests/build/reports
""".trimIndent()
expectSteps {
gradle {
tasks = "clean test"

View File

@@ -0,0 +1,19 @@
package patches.buildTypes
import jetbrains.buildServer.configs.kotlin.v2019_2.*
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 = 'ReleaseEapFromBranch'
accordingly, and delete the patch script.
*/
changeBuildType(RelativeId("ReleaseEapFromBranch")) {
vcs {
check(branchFilter == "+:heads/(releases/*)") {
"Unexpected option value: branchFilter = $branchFilter"
}
branchFilter = "heads/releases/*"
}
}

View File

@@ -1,20 +0,0 @@
package patches.buildTypes
import jetbrains.buildServer.configs.kotlin.v2019_2.*
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 = 'ReleaseMinor'
accordingly, and delete the patch script.
*/
changeBuildType(RelativeId("ReleaseMinor")) {
params {
expect {
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:3cd3e867-282c-451f-b958-bc95d56a8450", display = ParameterDisplay.HIDDEN)
}
update {
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:7bc0eb3a-b86a-4ebd-b622-d4ef12d7e1d3", display = ParameterDisplay.HIDDEN)
}
}
}

View File

@@ -1,20 +0,0 @@
package patches.buildTypes
import jetbrains.buildServer.configs.kotlin.v2019_2.*
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 = 'ReleasePatch'
accordingly, and delete the patch script.
*/
changeBuildType(RelativeId("ReleasePatch")) {
params {
expect {
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:3cd3e867-282c-451f-b958-bc95d56a8450", display = ParameterDisplay.HIDDEN)
}
update {
password("env.ORG_GRADLE_PROJECT_youtrackToken", "credentialsJSON:7bc0eb3a-b86a-4ebd-b622-d4ef12d7e1d3", display = ParameterDisplay.HIDDEN)
}
}
}

View File

@@ -1,17 +0,0 @@
package patches.projects
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.Project
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) {
check(description == "Vim engine for IDEs based on the IntelliJ platform") {
"Unexpected description: '$description'"
}
description = "Vim engine for JetBrains IDEs"
}

View File

@@ -30,5 +30,5 @@ node (Plugins -> teamcity-configs -> teamcity-configs:generate),
the 'Debug' option is available in the context menu for the task.
*/
version = "2023.05"
version = "2024.03"
project(_Self.Project)

View File

@@ -491,6 +491,26 @@ Contributors:
[![icon][github]](https://github.com/Infonautica)
&nbsp;
Leonid Danilov
* [![icon][mail]](mailto:emanuel-367@hotmail.com)
[![icon][github]](https://github.com/emanuelgestosa)
&nbsp;
Emanuel Gestosa
* [![icon][mail]](mailto:81118900+lippfi@users.noreply.github.com)
[![icon][github]](https://github.com/lippfi)
&nbsp;
lippfi,
* [![icon][mail]](mailto:fillipser143@gmail.com)
[![icon][github]](https://github.com/Parker7123)
&nbsp;
FilipParker
* [![icon][mail]](mailto:7138209+duhaesbaert@users.noreply.github.com)
[![icon][github]](https://github.com/duhaesbaert)
&nbsp;
Eduardo Haesbaert
* [![icon][mail]](mailto:nikolaevsky.egor@gmail.com)
[![icon][github]](https://github.com/Aisper)
&nbsp;
Egor Nikolaevsky
Previous contributors:

View File

@@ -23,7 +23,22 @@ It is important to distinguish EAP from traditional pre-release software.
Please note that the quality of EAP versions may at times be way below even
usual beta standards.
## To Be Released
## End of changelog file maintenance
Since version 2.9.0, the changelog can be found on YouTrack
To Be Released: https://youtrack.jetbrains.com/issues/VIM?q=%23%7BReady%20To%20Release%7D%20
Latest Fixes: https://youtrack.jetbrains.com/issues/VIM?q=State:%20Fixed%20sort%20by:%20updated%20
## 2.9.0, 2024-02-20
### Fixes:
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
### Merged PRs:
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
## 2.8.0, 2024-01-30
### Fixes:
* [VIM-3130](https://youtrack.jetbrains.com/issue/VIM-3130) Change the build version to 2023.1.2
@@ -44,6 +59,8 @@ usual beta standards.
* [VIM-3206](https://youtrack.jetbrains.com/issue/VIM-3206) Disable both copilot suggestion and insert mode on a single escape
* [VIM-3090](https://youtrack.jetbrains.com/issue/VIM-3090) Cmd line mode saves the visual mode
* [VIM-3085](https://youtrack.jetbrains.com/issue/VIM-3085) Open access to VimTypedActionHandler and VimShortcutKeyAction
* [VIM-3260](https://youtrack.jetbrains.com/issue/VIM-3260) Processing the offsets at the file end
* [VIM-3183](https://youtrack.jetbrains.com/issue/VIM-3183) Execute .ideavimrc on pooled thread
### Merged PRs:
* [763](https://github.com/JetBrains/ideavim/pull/763) by [Sam Ng](https://github.com/samabcde): Fix(VIM-3176) add test for restore selection after pasting in/below s…

View File

@@ -84,3 +84,8 @@ IV) It is not allowed to remove this license from the distribution of the Vim
license for previous Vim releases instead of the license that they came
with, at your option.
```
---
File [sneakIcon.png](doc/images/sneakIcon.svg), which is originally an icon of the ideavim-sneak plugin,
is merged icons of IdeaVim plugin and a random sneaker by FreePic from flaticon.com.

View File

@@ -8,7 +8,7 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "1.8.21"
kotlin("plugin.serialization") version "1.9.22"
}
val kotlinxSerializationVersion: String by project
@@ -21,7 +21,7 @@ repositories {
}
dependencies {
compileOnly("com.google.devtools.ksp:symbol-processing-api:1.9.22-1.0.16")
compileOnly("com.google.devtools.ksp:symbol-processing-api:1.9.24-1.0.20")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:$kotlinxSerializationVersion") {
// kotlin stdlib is provided by IJ, so there is no need to include it into the distribution
exclude("org.jetbrains.kotlin", "kotlin-stdlib")

View File

@@ -32,7 +32,6 @@ import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib.RepositoryBuilder
import org.intellij.markdown.ast.getTextInNode
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.exceptions.MissingVersionException
import org.kohsuke.github.GHUser
import java.net.HttpURLConnection
import java.net.URL
@@ -44,19 +43,19 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
classpath("com.github.AlexPl292:mark-down-to-slack:1.1.2")
classpath("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
// This is needed for jgit to connect to ssh
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.9.0.202403050737-r")
classpath("org.kohsuke:github-api:1.305")
classpath("io.ktor:ktor-client-core:2.3.7")
classpath("io.ktor:ktor-client-cio:2.3.7")
classpath("io.ktor:ktor-client-auth:2.3.7")
classpath("io.ktor:ktor-client-content-negotiation:2.3.7")
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
classpath("io.ktor:ktor-client-core:2.3.11")
classpath("io.ktor:ktor-client-cio:2.3.10")
classpath("io.ktor:ktor-client-auth:2.3.11")
classpath("io.ktor:ktor-client-content-negotiation:2.3.10")
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.11")
// This comes from the changelog plugin
// classpath("org.jetbrains:markdown:0.3.1")
@@ -66,19 +65,17 @@ buildscript {
plugins {
antlr
java
kotlin("jvm") version "1.8.21"
kotlin("jvm") version "1.9.22"
application
id("java-test-fixtures")
id("org.jetbrains.intellij") version "1.16.1"
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.changelog") version "2.2.0"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
// id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
id("com.dorongold.task-tree") version "2.1.1"
id("com.dorongold.task-tree") version "3.0.0"
id("com.google.devtools.ksp") version "1.8.21-1.0.11"
id("com.google.devtools.ksp") version "1.9.22-1.0.17"
}
ksp {
@@ -91,6 +88,8 @@ ksp {
afterEvaluate {
// tasks.named("kspKotlin").configure { dependsOn("clean") }
tasks.named("kspKotlin").configure { dependsOn("generateGrammarSource") }
tasks.named("kspTestFixturesKotlin").configure { enabled = false }
tasks.named("kspTestFixturesKotlin").configure { enabled = false }
tasks.named("kspTestKotlin").configure { enabled = false }
}
@@ -98,10 +97,11 @@ afterEvaluate {
val javaVersion: String by project
val kotlinVersion: String by project
val ideaVersion: String by project
val ideaType: String by project
val downloadIdeaSources: String by project
val instrumentPluginCode: String by project
val remoteRobotVersion: String by project
val antlrVersion: String by project
val remoteRobotVersion: String by project
val publishChannels: String by project
val publishToken: String by project
@@ -115,35 +115,40 @@ repositories {
}
dependencies {
api(project(":vim-engine"))
ksp(project(":annotation-processors"))
implementation(project(":annotation-processors"))
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
compileOnly("org.jetbrains:annotations:24.1.0")
runtimeOnly("org.antlr:antlr4-runtime:$antlrVersion")
antlr("org.antlr:antlr4:$antlrVersion")
// --------- Test dependencies ----------
testImplementation(testFixtures(project(":")))
testApi("com.squareup.okhttp3:okhttp:4.12.0")
// https://mvnrepository.com/artifact/com.ensarsarajcic.neovim.java/neovim-api
testImplementation("com.ensarsarajcic.neovim.java:neovim-api:0.2.3")
testImplementation("com.ensarsarajcic.neovim.java:core-rpc:0.2.3")
testFixturesImplementation("com.ensarsarajcic.neovim.java:neovim-api:0.2.3")
testFixturesImplementation("com.ensarsarajcic.neovim.java:core-rpc:0.2.3")
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-test
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
testFixturesImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.3.1")
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
testImplementation("com.automation-remarks:video-recorder-junit5:2.0")
runtimeOnly("org.antlr:antlr4-runtime:$antlrVersion")
antlr("org.antlr:antlr4:$antlrVersion")
api(project(":vim-engine"))
ksp(project(":annotation-processors"))
implementation(project(":annotation-processors"))
testApi("com.squareup.okhttp3:okhttp:4.12.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
}
configurations {
@@ -152,74 +157,17 @@ configurations {
}
}
// --- Compilation
// This can be moved to other test registration when issue with tests in gradle will be fixed
tasks.register<Test>("testWithNeovim") {
group = "verification"
systemProperty("ideavim.nvim.test", "true")
exclude("/ui/**")
exclude("**/longrunning/**")
exclude("**/propertybased/**")
useJUnitPlatform()
}
tasks.register<Test>("testPropertyBased") {
group = "verification"
// include("**/propertybased/**")
useJUnitPlatform()
}
tasks.register<Test>("testLongRunning") {
group = "verification"
// include("**/longrunning/**")
useJUnitPlatform()
}
tasks {
// Issue in gradle 7.3
val test by getting(Test::class) {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/*Test.class")
include("**/*test.class")
include("**/*Tests.class")
exclude("**/ParserTest.class")
test {
// Set teamcity env variable locally to run additional tests for leaks.
// By default, this test runs on TC only, but this test doesn't take a lot of time,
// so we can turn it on for local development
if (environment["TEAMCITY_VERSION"] == null) {
println("Set env TEAMCITY_VERSION to X")
println("Set env TEAMCITY_VERSION to X to enable project leak checks from the platform")
environment("TEAMCITY_VERSION" to "X")
}
}
val testWithNeovim by getting(Test::class) {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/*Test.class")
include("**/*test.class")
include("**/*Tests.class")
exclude("**/ParserTest.class")
exclude("**/longrunning/**")
exclude("**/propertybased/**")
}
val testPropertyBased by getting(Test::class) {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/propertybased/*Test.class")
include("**/propertybased/*test.class")
include("**/propertybased/*Tests.class")
}
val testLongRunning by getting(Test::class) {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
include("**/longrunning/**/*Test.class")
include("**/longrunning/**/*test.class")
include("**/longrunning/**/*Tests.class")
exclude("**/longrunning/**/ParserTest.class")
systemProperty("ideavim.nvim.test", System.getProperty("nvim") ?: false)
}
compileJava {
@@ -232,18 +180,38 @@ tasks {
compileKotlin {
kotlinOptions {
jvmTarget = javaVersion
apiVersion = "1.6"
// See https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
// For the list of bundled versions
apiVersion = "1.9"
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
// allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = javaVersion
apiVersion = "1.6"
apiVersion = "1.9"
// allWarningsAsErrors = true
}
}
downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
systemProperty("ide.show.tips.on.startup.default.value", "false")
systemProperty("octopus.handler", System.getProperty("octopus.handler") ?: true)
}
runIde {
systemProperty("octopus.handler", System.getProperty("octopus.handler") ?: true)
}
}
java {
@@ -270,6 +238,7 @@ gradle.projectsEvaluated {
intellij {
version.set(ideaVersion)
type.set(ideaType)
pluginName.set("IdeaVim")
updateSinceUntilBuild.set(false)
@@ -277,15 +246,10 @@ intellij {
downloadSources.set(downloadIdeaSources.toBoolean())
instrumentCode.set(instrumentPluginCode.toBoolean())
intellijRepository.set("https://www.jetbrains.com/intellij-repository")
// Yaml is only used for testing. It's part of the IdeaIC distribution, but needs to be included as a reference
plugins.set(listOf("java", "AceJump:3.8.11", "yaml"/*, "Pythonid:231.8109.2", "com.intellij.clion-swift:231.8109.4"*/))
plugins.set(listOf("AceJump:3.8.11"))
}
tasks {
downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}
publishPlugin {
channels.set(publishChannels.split(","))
token.set(publishToken)
@@ -297,18 +261,9 @@ tasks {
password.set(providers.environmentVariable("PRIVATE_KEY_PASSWORD"))
}
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
systemProperty("ide.show.tips.on.startup.default.value", "false")
}
runPluginVerifier {
downloadDir.set("${project.buildDir}/pluginVerifier/ides")
teamCityOutputFormat.set(true)
// ideVersions.set(listOf("IC-2021.3.4"))
}
generateGrammarSource {
@@ -323,6 +278,9 @@ tasks {
named("compileTestKotlin") {
dependsOn("generateTestGrammarSource")
}
named("compileTestFixturesKotlin") {
dependsOn("generateTestFixturesGrammarSource")
}
// Add plugin open API sources to the plugin ZIP
val createOpenApiSourceJar by registering(Jar::class) {
@@ -350,51 +308,24 @@ tasks {
from(createOpenApiSourceJar) { into("lib/src") }
}
val pluginVersion = version
// Don't forget to update plugin.xml
patchPluginXml {
// Get the latest available change notes from the changelog file
// Don't forget to update plugin.xml
sinceBuild.set("241.15989.150")
changeNotes.set(
provider {
with(changelog) {
val log = try {
getUnreleased()
} catch (e: MissingVersionException) {
getOrNull(pluginVersion.toString()) ?: getLatest()
}
renderItem(
log,
org.jetbrains.changelog.Changelog.OutputType.HTML,
)
}
},
"""<a href="https://youtrack.jetbrains.com/issues/VIM?q=State:%20Fixed%20Fix%20versions:%20${version.get()}">Changelog</a>"""
)
}
}
// --- Linting
//ktlint {
// version.set("0.48.2")
//}
// --- Tests
tasks {
test {
useJUnitPlatform()
exclude("**/propertybased/**")
exclude("**/longrunning/**")
exclude("/ui/**")
}
}
tasks.register<Test>("testUi") {
group = "verification"
useJUnitPlatform()
include("/ui/**")
}
// --- Changelog
changelog {
@@ -413,20 +344,11 @@ 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
tasks.register("slackNotification") {
doLast {
if (version.toString().last() != '0') return@doLast
if (slackUrl.isBlank()) {
println("Slack Url is not defined")
return@doLast
@@ -498,12 +420,14 @@ val prId: String by project
tasks.register("updateMergedPr") {
doLast {
if (project.hasProperty("prId")) {
println("Got pr id: $prId")
updateMergedPr(prId.toInt())
} else {
error("Cannot get prId")
}
val x = changelog.getUnreleased()
println("x")
// if (project.hasProperty("prId")) {
// println("Got pr id: $prId")
// updateMergedPr(prId.toInt())
// } else {
// error("Cannot get prId")
// }
}
}
@@ -527,7 +451,7 @@ val fixVersionsElementType = "VersionBundleElement"
tasks.register("releaseActions") {
group = "other"
doLast {
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D")
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D%20and%20tag:%20%7BIdeaVim%20Released%20In%20EAP%7D%20")
if (tickets.isNotEmpty()) {
println("Updating statuses for tickets: $tickets")
setYoutrackStatus(tickets, "Fixed")
@@ -615,7 +539,8 @@ fun addReleaseToYoutrack(name: String): String {
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") {
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 {
@@ -632,7 +557,8 @@ fun getVersionIdByName(name: String): String? {
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")
val response =
client.get("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name&query=$name")
response.body<JsonArray>().singleOrNull()?.jsonObject?.get("id")?.jsonPrimitive?.content
}
}
@@ -670,7 +596,8 @@ fun setYoutrackStatus(tickets: Collection<String>, status: String) {
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))") {
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 {
@@ -709,7 +636,8 @@ fun setYoutrackFixVersion(tickets: Collection<String>, version: String) {
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))") {
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 {
@@ -747,7 +675,8 @@ 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)")
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
}
}

View File

@@ -45,15 +45,20 @@ All commands with the mappings are supported. See the [full list of supported co
<details>
<summary><h2>sneak</h2></summary>
<img src="images/sneakIcon.svg" width="80" height="80" alt="icon"/>
By [Mikhail Levchenko](https://github.com/Mishkun)
Original repository with the plugin: https://github.com/Mishkun/ideavim-sneak
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`
- Add the following command to `~/.ideavimrc`: `Plug 'justinmk/vim-sneak'`
### Instructions
See the [docs](https://github.com/Mishkun/ideavim-sneak#usage)
* Type `s` and two chars to start sneaking in forward direction
* Type `S` and two chars to start sneaking in backward direction
* Type `;` or `,` to proceed with sneaking just as if you were using `f` or `t` commands
</details>

View File

@@ -27,7 +27,7 @@ Plug 'nerdtree'
### Preview
<details>
<summary>Click to the the preview</summary>
<summary>Click for the preview</summary>
<img src="images/nerdtree.gif" alt="NERDTree example"/>
</details>

28
doc/images/sneakIcon.svg Normal file
View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="386.498 234 32 32" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="ideavim_plugin-a" x1="-6.748%" x2="47.286%" y1="33.61%" y2="85.907%">
<stop offset="0" stop-color="#3BEA62"/>
<stop offset="1" stop-color="#087CFA"/>
</linearGradient>
</defs>
<g transform="matrix(1.238978, 0.90017, -0.90017, 1.238978, 131.776901, -422.953003)" style="">
<path d="M 399.962 247.648 C 399.207 246.894 399.147 246.318 399.692 245.453 C 400.237 244.588 401.955 245.886 401.955 245.886 L 401.955 250.737" style="fill: rgb(248, 245, 231);"/>
<path d="M 413.846 253.602 C 413.846 255.077 411.827 256.134 409.392 256.134 L 396.381 256.134 C 395.211 256.134 394.232 256.003 393.433 255.817 C 391.496 255.367 390.613 254.596 390.613 254.596 L 391.478 252.513 L 393.607 252.617 Z M 413.846 253.602" fill="#cce6f6" style=""/>
<path d="M 413.846 253.602 C 413.846 253.602 411.475 254.468 408.27 254.468 C 405.94 254.468 398.116 253.433 394.023 252.869 C 392.488 252.658 391.478 252.512 391.478 252.512 C 390.864 251.662 392.078 248.741 392.758 247.263 C 393.118 246.484 393.85 245.929 394.703 245.83 C 394.782 245.82 394.861 245.815 394.939 245.815 C 395.369 245.815 395.645 246.532 396.059 247.225 C 396.446 247.877 396.955 248.507 397.823 248.507 C 399.617 248.507 401.955 245.886 401.955 245.886 C 406.544 249.03 410.097 250.43 410.097 250.43 C 410.097 250.43 413.061 250.446 413.782 251.167 C 414.503 251.888 414.422 253.218 413.846 253.602 Z M 413.846 253.602" style="fill: rgb(8, 124, 250);"/>
<path d="M 394.023 252.869 L 393.433 255.817 C 391.496 255.367 390.613 254.596 390.613 254.596 L 391.478 252.513 L 393.607 252.617 Z M 394.023 252.869" fill="#9dcae0" style=""/>
<path d="M 396.059 247.225 C 395.073 245.986 393.193 250.255 394.023 252.869 C 392.488 252.658 391.478 252.513 391.478 252.513 C 390.864 251.662 392.078 248.741 392.758 247.263 C 393.118 246.484 393.85 245.929 394.703 245.83 C 394.782 245.82 394.861 245.815 394.939 245.815 C 395.369 245.815 395.645 246.532 396.059 247.225 Z M 396.059 247.225" style="fill: rgb(14, 112, 142);"/>
<path d="M 403.527 246.924 L 399.174 251.768 C 397.7 250.892 395.578 250.174 394.016 249.717 C 392.843 249.372 391.985 249.174 391.959 249.168 C 392.108 248.769 392.268 248.379 392.421 248.022 L 394.341 248.65 L 394.884 248.827 C 395.509 249.031 396.192 248.95 396.753 248.608 L 397.153 248.363 C 397.35 248.454 397.572 248.507 397.823 248.507 C 399.617 248.507 401.955 245.886 401.955 245.886 C 402.494 246.256 403.02 246.601 403.527 246.924 Z M 403.527 246.924" style="fill: rgb(59, 234, 98);"/>
<path d="M 413.847 253.602 C 413.847 253.602 411.475 254.468 408.27 254.468 C 407.586 254.468 406.426 254.378 405.025 254.238 L 405.025 254.237 C 405.025 253.495 406.924 251.743 408.366 251.616 C 408.623 252.865 410.097 252.512 411.219 252.128 C 412.341 251.743 413.783 251.167 413.783 251.167 C 414.503 251.888 414.422 253.218 413.847 253.602 Z M 413.847 253.602" style="fill: rgb(8, 124, 250);"/>
<path d="M 394.341 248.65 C 394.214 248.978 394.103 249.339 394.016 249.717 C 392.843 249.372 391.985 249.174 391.959 249.168 C 392.108 248.769 392.268 248.379 392.421 248.022 Z M 394.341 248.65" style="fill: rgb(37, 187, 163);"/>
<path d="M 408.366 251.616 C 406.924 251.743 405.025 253.495 405.025 254.237 L 405.025 254.238 C 403.784 254.113 402.355 253.948 400.899 253.77 C 400.899 253.051 400.191 252.372 399.174 251.768 L 399.174 251.768 L 403.528 246.924 C 407.331 249.34 410.097 250.43 410.097 250.43 C 410.77 251.102 409.809 251.487 408.366 251.616 Z M 408.366 251.616" style="fill: rgb(248, 245, 231);"/>
<polygon fill="url(#ideavim_plugin-a)" fill-rule="evenodd" points="406.356 248.463 403.261 252.616 402.183 248.212 400.984 249.899 401.999 254.236 403.927 254.176 407.639 249.062" style="" transform="matrix(0.994522, 0.104529, -0.104529, 0.994522, 28.475005, -40.88594)"/>
<g fill="#fb6572" transform="matrix(0.046265, 0, 0, 0.046265, 390.612823, 245.155533)" style="">
<path d="m288.839844 72.65625c-2.007813 0-4.011719-.761719-5.542969-2.292969-3.058594-3.0625-3.058594-8.023437 0-11.082031l20.089844-20.089844c3.0625-3.058594 8.023437-3.058594 11.082031 0 3.058594 3.0625 3.0625 8.023438 0 11.082032l-20.089844 20.089843c-1.527344 1.53125-3.535156 2.292969-5.539062 2.292969zm0 0" style="fill: rgb(56, 228, 105);"/>
<path d="m314.589844 87.082031c-2.007813 0-4.011719-.765625-5.542969-2.296875-3.0625-3.058594-3.0625-8.019531 0-11.082031l20.089844-20.085937c3.0625-3.058594 8.023437-3.058594 11.082031 0 3.058594 3.0625 3.058594 8.023437 0 11.082031l-20.089844 20.085937c-1.527344 1.53125-3.535156 2.296875-5.539062 2.296875zm0 0" style="fill: rgb(59, 233, 100);"/>
<path d="m340.339844 101.507812c-2.007813 0-4.011719-.765624-5.542969-2.296874-3.058594-3.058594-3.058594-8.023438 0-11.082032l20.089844-20.085937c3.0625-3.0625 8.023437-3.0625 11.082031 0 3.058594 3.058593 3.0625 8.023437 0 11.082031l-20.089844 20.085938c-1.527344 1.53125-3.535156 2.296874-5.539062 2.296874zm0 0" style="fill: rgb(59, 233, 100);"/>
<path d="m366.089844 115.929688c-2.003906 0-4.011719-.761719-5.539063-2.292969-3.0625-3.0625-3.0625-8.023438 0-11.082031l20.085938-20.089844c3.0625-3.058594 8.023437-3.058594 11.082031 0 3.0625 3.0625 3.0625 8.023437 0 11.082031l-20.085938 20.089844c-1.53125 1.53125-3.535156 2.292969-5.542968 2.292969zm0 0" style="fill: rgb(59, 233, 100);"/>
</g>
<path d="M 401.925 247.748 C 401.761 247.748 401.611 247.629 401.573 247.469 C 401.536 247.312 401.611 247.144 401.753 247.067 C 402 246.933 402.318 247.147 402.286 247.426 C 402.265 247.606 402.107 247.748 401.925 247.748 Z M 401.925 247.748" fill="#1e2628" style=""/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -1,140 +1,268 @@
List of Supported Set Commands
==============================
List of Supported Options
=========================
The following `:set` commands can appear in `~/.ideavimrc` or be set manually in the command mode:
The following options can be set with the `:set`, `:setglobal` and `:setlocal` commands.
They can be added to the `~/.ideavimrc` file, or set manually in Command-line mode.
For more details of each option, please see the Vim documentation.
Every effort is made to make these options compatible with Vim behaviour.
However, some differences are inevitable.
'clipboard' 'cb' clipboard options
Standard clipboard options plus
`ideaput` (default on) - IdeaVim ONLY
enable native idea paste action for put operations
'digraph' 'dg' enable the entering of digraphs in Insert mode
'gdefault' 'gd' the ":substitute" flag 'g' is by default
'history' 'hi' number of command-lines that are remembered
'hlsearch' 'hls' highlight matches with the last search pattern
'ignorecase' 'ic' ignore case in search patterns
'iskeyword' 'isk' defines keywords for commands like 'w', '*', etc.
'incsearch' 'is' show where search pattern typed so far matches
`keymodel` `km` String (default "continueselect,stopselect")
```
'clipboard' 'cb' Defines clipboard behavioue
A comma-separated list of words to control clipboard behaviour:
unnamed The clipboard register '*' is used instead of the
unnamed register
unnamedplus The clipboard register '+' is used instead of the
unnamed register
ideaput Uses the IDEs own paste implementation for put
operations rather than simply inserting the text
'digraph' 'dg' Enable using <BS> to enter digraphs in Insert mode
'gdefault' 'gd' The ":substitute" flag 'g' is by default
'guicursor' 'gcr' Controls the shape of the cursor for different modes
'history' 'hi' Number of command-lines that are remembered
'hlsearch' 'hls' Highlight matches with the last search pattern
'ignorecase' 'ic' Ignore case in search patterns
'incsearch' 'is' Show where search pattern typed so far matches
'iskeyword' 'isk' Defines keywords for commands like 'w', '*', etc.
'keymodel' 'km' Controls selection behaviour with special keys
List of comma separated words, which enable special things that keys
can do. These values can be used:
startsel Using a shifted special[1] key starts selection (either
startsel Using a shifted special key starts selection (either
Select mode or Visual mode, depending on "key" being
present in 'selectmode').
stopsel Using a NOT-shifted special[1] key stops selection.
present in 'selectmode')
stopsel Using a NOT-shifted special key stops selection.
Automatically enables `stopselect` and `stopvisual`
stopselect Using a NOT-shifted special[1] key stops - IdeaVim ONLY
select mode and removes selection.
stopvisual Using a NOT-shifted special[1] key stops - IdeaVim ONLY
visual mode and removes selection.
continueselect Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in select mode
acts like startsel is enabled
continuevisual Using a shifted arrow key doesn't - IdeaVim ONLY
start selection, but in visual mode
acts like startsel is enabled
stopselect Using a NOT-shifted special key stops select mode
and removes selection - IdeaVim ONLY
stopvisual Using a NOT-shifted special key stops visual mode
and removes selection - IdeaVim ONLY
continueselect Using a shifted arrow key doesn't start selection,
but in select mode acts like startsel is enabled
- IdeaVim ONLY
continuevisual Using a shifted arrow key doesn't start selection,
but in visual mode acts like startsel is enabled
- IdeaVim ONLY
'matchpairs' 'mps' pairs of characters that "%" can match
'maxmapdepth' 'mmd' Maximum depth of mappings
'more' 'more' When on, listings pause when the whole screen is filled.
'nrformats' 'nf' number formats recognized for CTRL-A command
'number' 'nu' print the line number in front of each line
'relativenumber' 'rnu' show the line number relative to the line with
the cursor
'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D
'scrolljump' 'sj' minimum number of lines to scroll
'scrolloff' 'so' minimum number of lines above and below the cursor
'selection' 'sel' what type of selection to use
Special keys in this context are the cursor keys, <End>, <Home>,
<PageUp> and <PageDown>.
`selectmode` `slm` String (default "")
'matchpairs' 'mps' Pairs of characters that "%" can match
'maxmapdepth' 'mmd' Maximum depth of mappings
'more' 'more' When on, listings pause when the whole screen is filled
'nrformats' 'nf' Number formats recognized for CTRL-A command
'operatorfunc' 'opfunc' Name of a function to call with the g@ operator
'scroll' 'scr' Number of lines to scroll with CTRL-U and CTRL-D
'selection' 'sel' What type of selection to use
'selectmode' 'slm' Controls when to start Select mode instead of Visual
This is a comma-separated list of words:
This is a comma-separated list of words, which specify when to start
Select mode instead of Visual mode, when a selection is started.
Possible values:
mouse when using the mouse
key when using shifted special[1] keys
cmd when using "v", "V", or <C-V>
ideaselection when IDE sets a selection - IdeaVim ONLY
(examples: extend selection, wrap with while, etc.)
mouse When using the mouse
key When using shifted special[1] keys
cmd When using "v", "V", or <C-V>
ideaselection When IDE sets a selection - IdeaVim ONLY
(e.g.: extend selection, wrap with while, etc.)
`startofline` `sol` When "on" some commands move the cursor to the first non-blank of the line.
When off the cursor is kept in the same column (if possible).
'shell' 'sh' The shell to use to execute commands with ! and :!
'shellcmdflag' 'shcf' The command flag passed to the shell
'shellxescape' 'sxe' The characters to be escaped when calling a shell
'shellxquote' 'sxq' The quote character to use in a shell command
'showcmd' 'sc' Show (partial) command in the status bar
'showmode' 'smd' Show the current mode in the status bar
'smartcase' 'scs' Use case sensitive search if any character in the
pattern is uppercase
'startofline' 'sol' When on, some commands move the cursor to the first
non-blank of the line
When off, the cursor is kept in the same column
(if possible)
'timeout' 'to' Use timeout for mapped key sequences
'timeoutlen' 'tm' Timeout duration for a mapped key sequence
'viminfo' 'vi' Information to remember after restart
'virtualedit' 've' Placement of the cursor where there is no actual text
A comma-separated list of these words:
block Allow virtual editing in Visual mode (not supported)
insert Allow virtual editing in Insert mode (not supported)
all Allow virtual editing in all modes (not supported)
onemore Allow the cursor to move just past the end of the line
'showmode' 'smd' message on the status line to show current mode
'showcmd' 'sc' show (partial) command in the status bar
'sidescroll' 'ss' minimum number of columns to scroll horizontally
'sidescrolloff' 'siso' min. number of columns to left and right of cursor
'smartcase' 'scs' no ignore case when pattern is uppercase
'timeout' 'to' use timeout for mapped key sequences
'timeoutlen' 'tm' timeout duration for a mapped key sequence
'undolevels' 'ul' maximum number of changes that can be undone
'viminfo' 'vi' information to remember after restart
'visualbell' 'vb' use visual bell instead of beeping
'wrapscan' 'ws' searches wrap around the end of file
'visualbell' 'vb' When on, prevents beeping on error
'whichwrap' 'ww' Which keys that move the cursor left/right can wrap to
other lines
A comma-separated list of these flags:
char key modes
b <BS> Normal and Visual
s <Space> Normal and Visual
h "h" Normal and Visual
l "l" Normal and Visual
< <Left> Normal and Visual
> <Right> Normal and Visual
~ "~" Normal
[ <Left> Insert and Replace
] <Right> Insert and Replace
'wrapscan' 'ws' Search will wrap around the end of file
```
## IdeaVim options mapped to IntelliJ-based IDE settings
IdeaVim only commands:
IdeaVim provides its own implementation for handling scroll jump and offset, even though IntelliJ-based IDEs have similar functionality (there are differences in behaviour).
When IdeaVim is hosted in an IntelliJ-based IDE (but not JetBrains Fleet), the following options map to the equivalent IDE settings:
`ideamarks` `ideamarks` Boolean (default true)
```
'scrolljump' 'sj' Minimal number of lines to scroll
'scrolloff' 'so' Minimal number of lines above and below the cursor
'sidescroll' 'ss' Minimal number of columns to scroll horizontally
'sidescrolloff' 'siso' Minimal number of columns to left and right of cursor
```
If true, creation of global mark will trigger creation of IDE's bookmark
and vice versa.
## IdeaVim options for IntelliJ-based IDE features
`idearefactormode` `idearefactormode` String(default "select")
Some Vim features cannot be implemented by IdeaVim, and must be implemented by the host IDE, such as showing whitespace and line numbers, and enabling soft-wrap.
The following options modify equivalent settings and features implemented by IntelliJ-based IDEs.
Define the mode that would be enabled during
the refactoring (renaming, live template, introduce variable, etc)
There is some mismatch when trying to map Vim options, most of which are local options, to IDE settings, which are mostly global-local.
The Vim option will always reflect the effective value of the IDE setting for the current editor, and modifying the Vim option will update the local value of the IDE setting.
The default value of the Vim option set during startup is not passed to the IDE setting.
Use one of the following values:
- keep - keep the mode that was enabled before starting a refactoring
- select - start refactoring in select mode
- visual - start refactoring in visual mode
If the IDE setting has a way to modify the local value, such as entries in the _View | Active Editor_ menu, then changing this will update the current editor and be reflected in the Vim option value.
If the IDE setting can only modify its global setting in the main _Settings_ dialog, this change does not always update the current editor (because the local IDE setting has been modified and takes precedence).
This option has effect if you are in normal, insert or replace mode before refactoring start.
Visual or select mode are not changed.
IdeaVim tries to make this work more naturally by updating the editor and local Vim option when a global value changes unless the Vim option has been explicitly set in Command-line mode.
In other words, if the local Vim value is explicitly set for a window or buffer, interactively, then it should not be reset.
If the Vim option was explicitly set in `~/.ideavimrc` however, then the value will be reset, because this can be viewed as a "global" value - set once and applied to subsequently opened windows.
(This should not be confused with Vim's concept of global options, which are mainly used to initialise new windows.)
`ideajoin` `ideajoin` Boolean (default false)
The local Vim option can always be reset to the global IDE setting value by resetting the Vim option to default with the `:set {option}&` syntax.
If true, join command will be performed via IDE
See wiki/`ideajoin` examples
```
'bomb' 'bomb' Add or remove a byte order mark (BOM) to the
current file. Unlike Vim, the file is modified
immediately, and not when saved
'breakindent' 'bri' Indent soft wrapped lines to match the first
line's indent
'colorcolumn' 'cc' Maps to IntelliJ's visual guide columns
'cursorline' 'cul' Highlight the line containing the cursor
'fileencoding' 'fenc' Change the encoding of the current file. The file
is modified and written immediately, rather than
waiting to be saved
Note that the names of the encoding might not
match Vim's known names
'fileformat' 'ff' Change the file format - dos, unix or mac
The file is modified immediately, rather than
when saved
'list' 'list' Show whitespace. Maps to the editor's local
setting in the View | Active Editor menu
'number' 'nu' Show line numbers. Maps to the editor's local
setting in the View | Active Editor menu
'relativenumber' 'rnu' Show line numbers relative to the current line
'textwidth' 'tw' Set the column at which text is automatically
wrapped
'wrap' 'wrap' Enable soft-wraps. Maps to the editor's local
setting in the View | Active Editor menu
```
`ideastatusicon` `ideastatusicon` String(default "enabled")
## IdeaVim only options
Define the behavior of IdeaVim icon in the status bar.
These options are IdeaVim only, and not supported by Vim.
They control integration with the host IDE.
Unless otherwise stated, these options do not have abbreviations.
Use one of the following values:
- enabled - icon is shown in the status bar
- gray - use the gray version of the icon
- disabled - hide the icon
```
'ideacopypreprocess' boolean (default off)
global or local to buffer
When enabled, the IDE will run custom copy pre-processors over text
copied to registers. These pre-processors can perform transformations
on the text, such as converting escape characters in a string literal
into the actual control characters in a Java file.
`ideawrite` `ideawrite` String (default "all")
"file" or "all". Defines the behaviour of ":w" command.
Value "all" enables execution of ":wa" (save all) command on ":w" (save).
This feature exists because some IJ options like "Prettier on save" or "ESlint on save"
work only with "save all" action. If this option is set to "all", these actions work
also with ":w" command.
This is not usually the expected behaviour, so this option's default
value is off. The equivalent processing for paste is controlled by the
"ideaput" value to the 'clipboard' option.
`lookupkeys` `lookupkeys` List of strings
'ideaglobalmode' boolean (default off)
global
This option will cause IdeaVim to share a single mode across all open
windows. In other words, entering Insert mode in one window will
enable Insert mode in all windows.
List of keys that should be processed by the IDE during the active lookup (autocompletion).
For example, <Tab> and <Enter> are used by the IDE to finish the lookup,
but <C-W> should be passed to IdeaVim.
Default value:
"<Tab>", "<Down>", "<Up>", "<Enter>", "<Left>", "<Right>",
"<C-Down>", "<C-Up>", "<PageUp>", "<PageDown>",
"<C-J>", "<C-Q>"
'ideajoin' boolean (default off)
global or local to buffer
When enabled, join commands will be handled by the IDE's "smart join"
feature. The IDE can change syntax when joining lines, such as merging
string literals or if statements. See the wiki for more examples. Not
all languages support smart join functionality.
`ideavimsupport` `ideavimsupport` List of strings (default "dialog")
'ideamarks' boolean (default on)
global
Maps Vim's global marks to IDE bookmarks.
Define the list of additional buffers where IdeaVim is enabled.
'idearefactormode' string (default "select")
global or local to buffer
Specifies the mode to be used when a refactoring selects text to be
edited (e.g. renaming, live template fields, introduce variable, etc):
keep Keep the current mode
select Switch to Select mode
visual Switch to Visual mode
- dialog - enable IdeaVim in dialogs
- singleline - enable IdeaVim in single line editors (not suggested)
This option is only used when the refactoring is started in Normal,
Insert or Replace mode. Visual or Select modes are not changed.
----------
[1] - cursor keys, <End>, <Home>, <PageUp> and <PageDown>
'ideastatusicon' string (default "enabled")
global
This option controls the behaviour and appearance of the IdeaVim icon
in the status bar:
enabled Show the icon in the status bar
gray Show the gray version of the icon
disabled Hide the icon
'ideavimsupport' string (default "dialog")
global
A comma-separated list of additional buffers or locations where
IdeaVim should be enabled:
dialog Enable IdeaVim in editors hosted in dialogs
singleline Enable IdeaVim in single line editors (not recommended)
The IDE's editor component can be used in many places, such as VCS
commit tool window, or inside dialogs, and even as single line fields.
'ideawrite' string (default "all")
global
This option defines the behaviour of the :w command:
file Save the current file only
all The :w command works like :wa and invokes the Save All
IDE action. This allows options such as "Prettier on
save" or "ESlint on save" to work with the :w command,
but means all files are saved.
'lookupkeys' string (default "<Tab>,<Down>,<Up>,<Enter>,
<Left>,<Right>,<C-Down>,<C-Up>,
<PageUp>,<PageDown>, <C-J>,<C-Q>")
global
Comma-separated list of keys that should be processed by the IDE while
a code completion lookup popup is active. For example, <Tab> and
<Enter> are used by the IDE to complete the lookup and insert text,
but <C-W> should be passed IdeaVim to continue editing the text.
'trackactionids' boolean (default off)
global
When on, IdeaVim will try to track the current IDE action and display
the action name in a notification. This action ID can then be used in
a mapping to the action in the form <Action>(...).
'visualdelay' number (default 100)
global
This option specifies the delay, in milliseconds before converting an
IDE selection into Visual mode.
Some IDE features make a selection to help modify text (e.g. backspace
in Python or Yaml selects an indent and invokes the "remove selection"
action). IdeaVim listens for changes in selection to switch to Visual
mode, and will return to Normal mode when the selection is removed,
even if originally in Insert mode.
By waiting before converting to Visual mode, temporary selections can
be ignored and the current Vim mode maintained.
It is not expected that this value will need to be changed.
```

View File

@@ -8,25 +8,28 @@
# suppress inspection "UnusedProperty" for whole file
ideaVersion=2023.3.2
#ideaVersion=LATEST-EAP-SNAPSHOT
ideaVersion=2024.1.1
# Values for type: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
ideaType=IC
downloadIdeaSources=true
instrumentPluginCode=true
version=chylex-25
version=chylex-35
javaVersion=17
remoteRobotVersion=0.11.21
remoteRobotVersion=0.11.22
antlrVersion=4.10.1
kotlin.incremental.useClasspathSnapshot=false
# Please don't forget to update kotlin version in buildscript section
# Also update kotlinxSerializationVersion version
kotlinVersion=1.8.21
kotlinVersion=1.9.22
publishToken=token
publishChannels=eap
# Kotlinx serialization also uses some version of kotlin stdlib under the hood. However,
# we exclude this version from the dependency and use our own version of kotlin that is specified above
kotlinxSerializationVersion=1.5.1
kotlinxSerializationVersion=1.6.2
slackUrl=
youtrackToken=

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

5
gradlew vendored
View File

@@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.

File diff suppressed because one or more lines are too long

View File

@@ -21,6 +21,9 @@ exclude:
- src/test/java/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
- vim-engine/src/main/java/com/maddyhome/idea/vim/regexp/parser/generated
- src/main/java/com/maddyhome/idea/vim/group/SearchGroup.java
- tests/ui-fixtures
dependencyIgnores:
- name: "acejump"
- name: "icu4j"

View File

@@ -20,17 +20,17 @@ repositories {
}
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.24")
implementation("io.ktor:ktor-client-core:2.3.7")
implementation("io.ktor:ktor-client-cio:2.3.7")
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
implementation("io.ktor:ktor-client-auth:2.3.7")
implementation("io.ktor:ktor-client-core:2.3.11")
implementation("io.ktor:ktor-client-cio:2.3.10")
implementation("io.ktor:ktor-client-content-negotiation:2.3.10")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.11")
implementation("io.ktor:ktor-client-auth:2.3.11")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
// This is needed for jgit to connect to ssh
implementation("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
implementation("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.9.0.202403050737-r")
implementation("com.vdurmont:semver4j:3.1.0")
}
@@ -58,13 +58,6 @@ tasks.register("checkNewPluginDependencies", JavaExec::class) {
classpath = sourceSets["main"].runtimeClasspath
}
tasks.register("updateAffectedRates", JavaExec::class) {
group = "verification"
description = "This job updates Affected Rate field on YouTrack"
mainClass.set("scripts.YouTrackUsersAffectedKt")
classpath = sourceSets["main"].runtimeClasspath
}
tasks.register("calculateNewVersion", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.CalculateNewVersionKt")
@@ -93,25 +86,6 @@ tasks.register("addReleaseTag", JavaExec::class) {
args = listOf(project.version.toString(), rootProject.rootDir.toString(), releaseType ?: "")
}
tasks.register("resetReleaseBranch", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.ResetReleaseBranchKt")
classpath = sourceSets["main"].runtimeClasspath
args = listOf(project.version.toString(), rootProject.rootDir.toString(), releaseType ?: "")
}
tasks.register("pushChanges", JavaExec::class) {
mainClass.set("scripts.PushChangesKt")
classpath = sourceSets["main"].runtimeClasspath
args = listOf(rootProject.rootDir.toString())
}
tasks.register("pushChangesWithReleaseBranch", JavaExec::class) {
mainClass.set("scripts.PushChangesWithReleaseBranchKt")
classpath = sourceSets["main"].runtimeClasspath
args = listOf(rootProject.rootDir.toString(), releaseType ?: "")
}
tasks.register("selectBranch", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.SelectBranchKt")
@@ -119,6 +93,13 @@ tasks.register("selectBranch", JavaExec::class) {
args = listOf(project.version.toString(), rootProject.rootDir.toString(), releaseType ?: "")
}
tasks.register("eapReleaseActions", JavaExec::class) {
group = "release"
mainClass.set("scripts.releaseEap.EapReleaseActionsKt")
classpath = sourceSets["main"].runtimeClasspath
args = listOf(project.version.toString(), rootProject.rootDir.toString(), releaseType ?: "")
}
tasks.register("calculateNewEapVersion", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.CalculateNewEapVersionKt")
@@ -126,6 +107,13 @@ tasks.register("calculateNewEapVersion", JavaExec::class) {
args = listOf("${rootProject.rootDir}")
}
tasks.register("calculateNewEapVersionFromBranch", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.CalculateNewEapVersionFromBranchKt")
classpath = sourceSets["main"].runtimeClasspath
args = listOf("${rootProject.rootDir}")
}
tasks.register("calculateNewDevVersion", JavaExec::class) {
group = "release"
mainClass.set("scripts.release.CalculateNewDevVersionKt")

View File

@@ -22,7 +22,7 @@ import kotlinx.serialization.json.jsonPrimitive
*/
@Suppress("SpellCheckingInspection")
val knownPlugins = listOf(
val knownPlugins = setOf(
"IdeaVimExtension",
"github.zgqq.intellij-enhance",
"org.jetbrains.IdeaVim-EasyMotion",
@@ -31,7 +31,13 @@ val knownPlugins = listOf(
"com.github.copilot",
"com.github.dankinsoid.multicursor",
"com.joshestein.ideavim-quickscope",
"ca.alexgirard.HarpoonIJ",
"me.kyren223.harpoonforjb", // https://plugins.jetbrains.com/plugin/23771-harpoonforjb
"com.github.erotourtes.harpoon", // https://plugins.jetbrains.com/plugin/21796-harpooner
"me.kyren223.trident", // https://plugins.jetbrains.com/plugin/23818-trident
"com.protoseo.input-source-auto-converter",
// "cc.implicated.intellij.plugins.bunny", // I don't want to include this plugin in the list of IdeaVim plugins as I don't understand what this is for
)
@@ -41,19 +47,15 @@ suspend fun main() {
parameter("dependency", "IdeaVIM")
parameter("includeOptional", true)
}
val output = response.body<List<String>>()
val output = response.body<List<String>>().toSet()
println(output)
if (knownPlugins != output) {
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
val removedPlugins = (knownPlugins - output.toSet()).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
if (newPlugins.isNotEmpty()) {
// val removedPlugins = (knownPlugins - output.toSet()).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
error(
"""
Unregistered plugins:
${if (newPlugins.isNotEmpty()) newPlugins.joinToString(separator = "\n") { it.first + "(" + it.second + ")" } else "No unregistered plugins"}
Removed plugins:
${if (removedPlugins.isNotEmpty()) removedPlugins.joinToString(separator = "\n") { it.first + "(" + it.second + ")" } else "No removed plugins"}
${newPlugins.joinToString(separator = "\n") { it.first + "(" + it.second + ")" }}
""".trimIndent()
)
}

View File

@@ -32,7 +32,7 @@ fun httpClient(): HttpClient {
install(Auth) {
bearer {
loadTokens {
val accessToken = System.getenv("YOUTRACK_TOKEN")!!
val accessToken = System.getenv("YOUTRACK_TOKEN") ?: error("Missing YOUTRACK_TOKEN")
BearerTokens(accessToken, "")
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2003-2023 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 scripts.release.checkoutBranch
import scripts.release.withGit
import scripts.release.withRepo
fun main(args: Array<String>) {
val rootDir = args[0]
println("root dir: $rootDir")
val currentBranch = withRepo(rootDir) { it.branch }
println("Current branch is $currentBranch")
withGit(rootDir) { git ->
if (currentBranch != "master") {
git.checkoutBranch("master")
println("Check out master branch")
}
git.push()
.setPushTags()
.call()
println("Master pushed with tags")
git.checkoutBranch(currentBranch)
println("Checked out $currentBranch branch")
}
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright 2003-2023 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 scripts.release.checkoutBranch
import scripts.release.withGit
import scripts.release.withRepo
fun main(args: Array<String>) {
val rootDir = args[0]
val releaseType = args[1]
println("root dir: $rootDir")
println("releaseType: $releaseType")
val currentBranch = withRepo(rootDir) { it.branch }
println("Current branch is $currentBranch")
withGit(rootDir) { git ->
if (currentBranch != "master") {
git.checkoutBranch("master")
println("Check out master branch")
}
git.push()
.setPushTags()
.call()
println("Master pushed with tags")
if (releaseType != "patch") {
git.checkoutBranch("release")
println("Checked out release")
git
.push()
.setForce(true)
.setPushTags()
.call()
println("Pushed release branch with tags")
}
else {
println("Do not push release branch because type of release is $releaseType")
}
git.checkoutBranch(currentBranch)
println("Checked out $currentBranch branch")
}
}

View File

@@ -8,6 +8,12 @@
package scripts.release
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.revwalk.filter.RevFilter
fun main(args: Array<String>) {
println("HI!")
val projectDir = args[0]
@@ -19,10 +25,12 @@ fun main(args: Array<String>) {
check(branch == "master") {
"We should be on master branch"
}
val mergeBaseCommit = getMergeBaseWithMaster(projectDir, objectId)
println("Base commit $mergeBaseCommit")
withGit(projectDir) { git ->
val log = git.log().setMaxCount(500).call().toList()
println("First commit hash in log: " + log.first().name + " log size: ${log.size}")
val logDiff = log.takeWhile { it.id.name != objectId.name }
val logDiff = log.takeWhile { it.id.name != mergeBaseCommit }
val numCommits = logDiff.size
println("Log diff size is $numCommits")
check(numCommits < 450) {
@@ -35,3 +43,18 @@ fun main(args: Array<String>) {
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
}
}
private fun getMergeBaseWithMaster(projectDir: String, tag: ObjectId): String {
withRepo(projectDir) { repo ->
val master = repo.resolve("master")
RevWalk(repo).use { walk ->
val tagRevCommit = walk.parseCommit(tag)
val masterRevCommit = walk.parseCommit(master)
walk.setRevFilter(RevFilter.MERGE_BASE)
walk.markStart(tagRevCommit)
walk.markStart(masterRevCommit)
val mergeBase: RevCommit = walk.next()
return mergeBase.name
}
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2003-2023 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.release
fun main(args: Array<String> ) {
val projectDir = args[0]
println("Working directory: $projectDir")
val branch = withRepo(projectDir) { it.branch }
val (majorBranchVersion, minorBranchVersion) = versions(branch)
val versions = getVersionsExistingVersionsFor(majorBranchVersion, minorBranchVersion, projectDir)
val maxExistingVersion = versions.keys.maxOrNull()
val nextVersion = if (maxExistingVersion != null) {
if (maxExistingVersion.suffixTokens.isEmpty()) {
maxExistingVersion.nextPatch().withSuffix("eap.1").value
}
else {
check(maxExistingVersion.suffixTokens.size == 2) {
"We should have exactly two suffix tokens. Current tokens: ${maxExistingVersion.suffixTokens.toList()}"
}
check(maxExistingVersion.suffixTokens[0] == "eap") {
"First suffix token must be eap. Current tokens: ${maxExistingVersion.suffixTokens.toList()}"
}
val newEapNumber = maxExistingVersion.suffixTokens[1].toInt().inc()
maxExistingVersion.withSuffix("eap.$newEapNumber").value
}
} else {
"$majorBranchVersion.$minorBranchVersion.0-eap.1"
}
println("Next eap version: $nextVersion")
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
}
private val regex = "releases/(\\d+)\\.(\\d+)\\.x".toRegex()
private fun versions(branchName: String): Pair<Int, Int> {
val match = regex.matchEntire(branchName) ?: error("Cannot match branch: $branchName")
val major = match.groups[1]
val minor = match.groups[2]
return major!!.value.toInt() to minor!!.value.toInt()
}

View File

@@ -8,28 +8,45 @@
package scripts.release
import com.vdurmont.semver4j.Semver
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import kotlin.io.path.Path
import kotlin.io.path.readText
import kotlin.io.path.writeText
private const val toBeReleased = "## To Be Released"
fun main(args: Array<String>) {
println("Start updating unreleased section")
val (newVersion, rootDir, releaseType) = readArgs(args)
checkReleaseType(releaseType)
if (releaseType == "patch") {
println("Skip updating the changelog because release type is 'patch'")
return
}
val currentDate = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)
val newItem = "## $newVersion, $currentDate"
val changelogPath = Path("$rootDir/CHANGES.md")
val changelog = changelogPath.readText()
val newChangelog = changelog.replace("## To Be Released", newItem)
val newChangelog = if (releaseType == "patch") {
val decreasedVersion = Semver(newVersion).withIncPatch(-1)
val firstEntry = changelog.indexOf("## $decreasedVersion")
if (firstEntry != -1) {
val newLog = StringBuilder(changelog)
newLog.insert(firstEntry, newItem + "\n")
newLog.toString()
} else {
changelog
}
} else {
if (toBeReleased in changelog) {
changelog.replace(toBeReleased, newItem)
} else {
val firstEntry = changelog.indexOf("##")
val newLog = StringBuilder(changelog)
newLog.insert(firstEntry, newItem + "\n")
newLog.toString()
}
}
changelogPath.writeText(newChangelog)
}

View File

@@ -13,12 +13,8 @@ fun main(args: Array<String>) {
checkReleaseType(releaseType)
if (releaseType == "patch") {
println("Skip committing changes because release type is 'patch'")
return
}
withGit(rootDir) { git ->
if (git.diff().call().isNotEmpty()) {
git
.commit()
.setAll(true)
@@ -29,5 +25,8 @@ fun main(args: Array<String>) {
val lastGitMessage = git.log().call().first().shortMessage
println("Changes committed. Last gitlog message: $lastGitMessage")
} else {
println("No Changes")
}
}
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright 2003-2023 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.release
fun main(args: Array<String>) {
val (_, rootDir, releaseType) = readArgs(args)
checkReleaseType(releaseType)
checkBranch(rootDir, releaseType)
if (releaseType == "patch") {
println("Skip release branch reset because release type is 'patch'")
return
}
withGit(rootDir) { git ->
val currentCommit = git.log().setMaxCount(1).call().first()
println("Current commit id: ${currentCommit.id.name}")
git.checkoutBranch("release")
println("Checked out release branch")
git.reset()
.setRef(currentCommit.id.name)
.call()
println("release branch reset")
git.checkoutBranch("master")
println("Checked out master branch")
}
}

View File

@@ -15,8 +15,7 @@ fun main(args: Array<String>) {
withGit(rootDir) { git ->
val branchName = when (releaseType) {
"major", "minor" -> "master"
"patch" -> "release"
"major", "minor", "patch" -> "release"
else -> error("Unsupported release type: $releaseType")
}

View File

@@ -64,6 +64,31 @@ enum class ReleaseType {
STABLE_NO_PATCH, // Version that ends on 0. Like 2.5.0
}
internal fun getVersionsExistingVersionsFor(
majorVersion: Int,
minorVersion: Int,
projectDir: String,
): Map<Semver, ObjectId> {
val repository = RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
val git = Git(repository)
println(git.log().call().first())
println(git.tagList().call().first())
return git.tagList().call().mapNotNull { ref ->
runCatching {
// Git has two types of tags: light and annotated. This code detect hash of the commit for both types of tags
val revWalk = RevWalk(repository)
val tag = revWalk.parseAny(ref.objectId)
val commitHash = revWalk.peel(tag).id
val semver = Semver(ref.name.removePrefix("refs/tags/"))
if (semver.major == majorVersion && semver.minor == minorVersion) {
semver to commitHash
} else null
}.getOrNull()
}
.toMap()
}
internal fun getVersion(projectDir: String, releaseType: ReleaseType): Pair<Semver, ObjectId> {
val repository = RepositoryBuilder().setGitDir(File("$projectDir/.git")).build()
val git = Git(repository)

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2003-2024 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.releaseEap
import kotlinx.coroutines.runBlocking
import scripts.addComment
import scripts.getYoutrackTicketsByQuery
import scripts.release.readArgs
import scripts.releasedInEapTagId
import scripts.setTag
fun main(args: Array<String>) {
runBlocking {
val (newVersion, _, _) = readArgs(args)
// Search for Ready to release, but without "IdeaVim Released In EAP" tag
val ticketsToUpdate =
getYoutrackTicketsByQuery("%23%7BReady%20To%20Release%7D%20tag:%20-%7BIdeaVim%20Released%20In%20EAP%7D%20")
println("Have to update the following tickets: $ticketsToUpdate")
ticketsToUpdate.forEach { ticketId ->
setTag(ticketId, releasedInEapTagId)
addComment(
ticketId, """
The fix is available in the IdeaVim $newVersion. See https://jb.gg/ideavim-eap for the instructions on how to get EAP builds as updates within the IDE. You can also wait till the next stable release with this fix, youll get it automatically.
""".trimIndent()
)
}
}
}

View File

@@ -1,62 +0,0 @@
/*
* Copyright 2003-2023 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.call.*
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.put
val areaWeights = setOf(
Triple("118-53212", "Plugins", 50),
Triple("118-53220", "Vim Script", 30),
Triple("118-54084", "Esc", 100),
)
suspend fun updateRates() {
println("Updating rates of the issues")
areaWeights.forEach { (id, name, weight) ->
val unmappedIssues = unmappedIssues(name)
println("Got ${unmappedIssues.size} for $name area")
unmappedIssues.forEach { issueId ->
print("Trying to update issue $issueId: ")
val response = updateCustomField(issueId) {
put("name", "Affected Rate")
put("\$type", "SimpleIssueCustomField")
put("value", weight)
}
println(response)
}
}
}
private suspend fun unmappedIssues(area: String): List<String> {
val areaProcessed = if (" " in area) "{$area}" else area
val res = issuesQuery(
query = "project: VIM Affected Rate: {No affected rate} Area: $areaProcessed #Unresolved",
fields = "id,idReadable"
)
return res.body<JsonArray>().map { it.jsonObject }.map { it["idReadable"]!!.jsonPrimitive.content }
}
suspend fun getAreasWithoutWeight(): Set<Pair<String, String>> {
val allAreas = getAreaValues()
return allAreas
.filterNot { it.key in areaWeights.map { it.first }.toSet() }
.entries
.map { it.key to it.value }
.toSet()
}
suspend fun main() {
updateRates()
}

View File

@@ -11,6 +11,8 @@ package scripts
import io.ktor.client.call.*
import io.ktor.client.request.*
import io.ktor.http.*
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.addJsonObject
import kotlinx.serialization.json.buildJsonObject
@@ -21,6 +23,10 @@ import kotlinx.serialization.json.put
import kotlinx.serialization.json.putJsonArray
import kotlinx.serialization.json.putJsonObject
// YouTrack tag "IdeaVim Released In EAP"
const val releasedInEapTagId = "68-385032"
suspend fun setYoutrackStatus(tickets: Collection<String>, status: String) {
val client = httpClient()
@@ -59,3 +65,59 @@ suspend fun setYoutrackStatus(tickets: Collection<String>, status: String) {
}
}
}
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 }
}
}
/**
* 68-385032
* [issueHumanId] is like VIM-123
* [tagId] is like "145-23"
*/
suspend fun setTag(issueHumanId: String, tagId: String) {
val client = httpClient()
println("Try to add tag $tagId to $issueHumanId")
val response =
// I've updated default url in client, so this may be broken now
client.post("https://youtrack.jetbrains.com/api/issues/$issueHumanId/tags?fields=customFields(id,name,value(id,name))") {
contentType(ContentType.Application.Json)
accept(ContentType.Application.Json)
val request = buildJsonObject {
put("id", tagId)
}
setBody(request)
}
println(response)
println(response.body<String>())
if (!response.status.isSuccess()) {
error("Request failed. $issueHumanId, ${response.body<String>()}")
}
}
suspend fun addComment(issueHumanId: String, text: String) {
val client = httpClient()
println("Try to add comment to $issueHumanId")
val response =
// I've updated default url in client, so this may be broken now
client.post("https://youtrack.jetbrains.com/api/issues/$issueHumanId/comments?fields=customFields(id,name,value(id,name))") {
contentType(ContentType.Application.Json)
accept(ContentType.Application.Json)
val request = buildJsonObject {
put("text", text)
}
setBody(request)
}
println(response)
println(response.body<String>())
if (!response.status.isSuccess()) {
error("Request failed. $issueHumanId, ${response.body<String>()}")
}
}

View File

@@ -12,4 +12,9 @@ rootProject.name = 'IdeaVIM'
include 'vim-engine'
include 'scripts'
include 'annotation-processors'
include 'tests:java-tests'
include 'tests:property-tests'
include 'tests:long-running-tests'
include 'tests:ui-ij-tests'
include 'tests:ui-py-tests'
include 'tests:ui-fixtures'

View File

@@ -101,10 +101,14 @@ command:
(WS | COLON)* range? (WS | COLON)* EXECUTE WS* (expr WS*)* (NEW_LINE | BAR)+
#ExecuteCommand|
(WS | COLON)* range? (WS | COLON)* lShift (WS* commandArgument = ~(NEW_LINE | BAR)+)? ((inline_comment NEW_LINE+) | (NEW_LINE | BAR)+)
(WS | COLON)* range? (WS | COLON)* lShift
WS* ((commandArgumentWithoutBars? inline_comment NEW_LINE) | (commandArgumentWithoutBars? NEW_LINE) | (commandArgumentWithoutBars? BAR))
(NEW_LINE | BAR)*
#ShiftLeftCommand|
(WS | COLON)* range? (WS | COLON)* rShift (WS* commandArgument = ~(NEW_LINE | BAR)+)? ((inline_comment NEW_LINE+) | (NEW_LINE | BAR)+)
(WS | COLON)* range? (WS | COLON)* rShift
WS* ((commandArgumentWithoutBars? inline_comment NEW_LINE) | (commandArgumentWithoutBars? NEW_LINE) | (commandArgumentWithoutBars? BAR))
(NEW_LINE | BAR)*
#ShiftRightCommand|
(WS | COLON)* range? (WS | COLON)*

View File

@@ -11,7 +11,6 @@ package com.maddyhome.idea.vim;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.actionSystem.TypedAction;
@@ -80,14 +79,6 @@ public class EventFacade {
action.unregisterCustomShortcutSet(component);
}
public void addDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
document.addDocumentListener(listener);
}
public void removeDocumentListener(@NotNull Document document, @NotNull DocumentListener listener) {
document.removeDocumentListener(listener);
}
public void addEditorFactoryListener(@NotNull EditorFactoryListener listener, @NotNull Disposable parentDisposable) {
EditorFactory.getInstance().addEditorFactoryListener(listener, parentDisposable);
}
@@ -98,20 +89,12 @@ public class EventFacade {
editor.getCaretModel().addCaretListener(listener, disposable);
}
public void removeCaretListener(@NotNull Editor editor, @NotNull CaretListener 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) {
editor.removeEditorMouseListener(listener);
}
public void addComponentMouseListener(@NotNull Component component,
@NotNull MouseListener mouseListener,
@NotNull Disposable disposable) {
@@ -119,30 +102,18 @@ public class EventFacade {
Disposer.register(disposable, () -> component.removeMouseListener(mouseListener));
}
public void removeComponentMouseListener(@NotNull Component component, @NotNull MouseListener mouseListener) {
component.removeMouseListener(mouseListener);
}
public void addEditorMouseMotionListener(@NotNull Editor editor,
@NotNull EditorMouseMotionListener listener,
@NotNull Disposable disposable) {
editor.addEditorMouseMotionListener(listener, disposable);
}
public void removeEditorMouseMotionListener(@NotNull Editor editor, @NotNull EditorMouseMotionListener listener) {
editor.removeEditorMouseMotionListener(listener);
}
public void addEditorSelectionListener(@NotNull Editor editor,
@NotNull SelectionListener listener,
@NotNull Disposable disposable) {
editor.getSelectionModel().addSelectionListener(listener, disposable);
}
public void removeEditorSelectionListener(@NotNull Editor editor, @NotNull SelectionListener listener) {
editor.getSelectionModel().removeSelectionListener(listener);
}
private @NotNull TypedAction getTypedAction() {
return TypedAction.getInstance();
}

View File

@@ -14,7 +14,7 @@ import com.intellij.openapi.project.ProjectManagerListener
import com.intellij.openapi.startup.ProjectActivity
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.newapi.IjVimEditor
import com.maddyhome.idea.vim.newapi.globalIjOptions
/**
@@ -36,8 +36,10 @@ internal class PluginStartup : ProjectActivity/*, LightEditCompatible*/ {
// This is a temporal workaround for VIM-2487
internal class PyNotebooksCloseWorkaround : ProjectManagerListener {
override fun projectClosingBeforeSave(project: Project) {
// TODO: Confirm context in CWM scenario
if (injector.globalIjOptions().closenotebooks) {
localEditors().forEach { editor ->
injector.editorGroup.getEditors().forEach { vimEditor ->
val editor = (vimEditor as IjVimEditor).editor
val virtualFile = EditorHelper.getVirtualFile(editor)
if (virtualFile?.extension == "ipynb") {
val fileEditorManager = FileEditorManagerEx.getInstanceEx(project)

View File

@@ -7,56 +7,27 @@
*/
package com.maddyhome.idea.vim
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.extensions.ExtensionPointName
import com.maddyhome.idea.vim.action.EngineCommandProvider
import com.maddyhome.idea.vim.action.IntellijCommandProvider
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.handler.ActionBeanClass
import com.maddyhome.idea.vim.handler.EditorActionHandlerBase
import com.maddyhome.idea.vim.key.MappingOwner
import com.maddyhome.idea.vim.newapi.IjVimActionsInitiator
import com.maddyhome.idea.vim.newapi.globalIjOptions
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
public object RegisterActions {
@Deprecated("Please use @CommandOrMotion annotation instead")
internal val VIM_ACTIONS_EP: ExtensionPointName<ActionBeanClass> = ExtensionPointName.create("IdeaVIM.vimAction")
/**
* Register all the key/action mappings for the plugin.
*/
@JvmStatic
public fun registerActions() {
registerVimCommandActions()
if (!injector.globalIjOptions().commandOrMotionAnnotation) {
registerEmptyShortcuts()
registerEpListener()
}
}
@Deprecated("Moving to annotations approach instead of xml")
private fun registerEpListener() {
// IdeaVim doesn't support contribution to VIM_ACTIONS_EP extension point, so technically we can skip this update,
// but let's support dynamic plugins in a more classic way and reload actions on every EP change.
VIM_ACTIONS_EP.addChangeListener({
unregisterActions()
registerActions()
}, VimPlugin.getInstance())
registerShortcutsWithoutActions()
}
public fun findAction(id: String): EditorActionHandlerBase? {
if (injector.globalIjOptions().commandOrMotionAnnotation) {
val commandBean = EngineCommandProvider.getCommands().firstOrNull { it.actionId == id }
?: IntellijCommandProvider.getCommands().firstOrNull { it.actionId == id } ?: return null
return commandBean.instance
} else {
return VIM_ACTIONS_EP.getExtensionList(ApplicationManager.getApplication()).stream()
.filter { vimActionBean: ActionBeanClass -> vimActionBean.actionId == id }
.findFirst().map { obj: ActionBeanClass -> obj.instance }
.orElse(null)
}
}
public fun findActionOrDie(id: String): EditorActionHandlerBase {
@@ -71,30 +42,15 @@ public object RegisterActions {
private fun registerVimCommandActions() {
val parser = VimPlugin.getKey()
if (injector.globalIjOptions().commandOrMotionAnnotation) {
EngineCommandProvider.getCommands().forEach { parser.registerCommandAction(it) }
IntellijCommandProvider.getCommands().forEach { parser.registerCommandAction(it) }
} else {
VIM_ACTIONS_EP.getExtensionList(ApplicationManager.getApplication()).stream().map { bean: ActionBeanClass? ->
IjVimActionsInitiator(
bean!!
)
}
.forEach { actionHolder: IjVimActionsInitiator? ->
parser.registerCommandAction(
actionHolder!!
)
}
}
}
// todo do we really need this?
private fun registerEmptyShortcuts() {
private fun registerShortcutsWithoutActions() {
val parser = VimPlugin.getKey()
// The {char1} <BS> {char2} shortcut is handled directly by KeyHandler#handleKey, so doesn't have an action. But we
// still need to register the shortcut, to make sure the editor doesn't swallow it.
parser
.registerShortcutWithoutAction(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), MappingOwner.IdeaVim.System)
parser.registerShortcutWithoutAction(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), MappingOwner.IdeaVim.System)
}
}

View File

@@ -39,11 +39,9 @@ import com.maddyhome.idea.vim.listener.VimListenerManager;
import com.maddyhome.idea.vim.newapi.IjVimInjector;
import com.maddyhome.idea.vim.ui.StatusBarIconFactory;
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel;
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.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -117,12 +115,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
return ApplicationManager.getApplication().getService(CommandGroup.class);
}
@Deprecated // "Please use `injector.markService` instead"
@ApiStatus.ScheduledForRemoval(inVersion = "2.3")
public static @NotNull MarkGroup getMark() {
return ApplicationManager.getApplication().getService(MarkGroup.class);
}
public static @NotNull RegisterGroup getRegister() {
return ((RegisterGroup)VimInjectorKt.getInjector().getRegisterGroup());
}
@@ -195,13 +187,6 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
return VimInjectorKt.getInjector().getOptionGroup();
}
/** Deprecated: Use getOptionGroup */
@Deprecated
// Used by which-key 0.8.0, IdeaVimExtension 1.6.5 + 1.6.8
public static @NotNull OptionService getOptionService() {
return VimInjectorKt.getInjector().getOptionService();
}
private static @NotNull NotificationService getNotifications() {
return getNotifications(null);
}
@@ -226,22 +211,22 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
public static void setEnabled(final boolean enabled) {
if (isEnabled() == enabled) return;
if (!enabled) {
getInstance().turnOffPlugin(true);
}
getInstance().enabled = enabled;
if (enabled) {
getInstance().turnOnPlugin();
}
if (enabled) {
VimInjectorKt.getInjector().getListenersNotifier().notifyPluginTurnedOn();
} else {
VimInjectorKt.getInjector().getListenersNotifier().notifyPluginTurnedOff();
}
if (!enabled) {
getInstance().turnOffPlugin(true);
}
if (enabled) {
getInstance().turnOnPlugin();
}
StatusBarIconFactory.Util.INSTANCE.updateIcon();
}
@@ -297,8 +282,14 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
ideavimrcRegistered = true;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
try {
VimInjectorKt.injector.getOptionGroup().startInitVimRc();
executeIdeaVimRc(editor);
}
finally {
VimInjectorKt.injector.getOptionGroup().endInitVimRc();
}
}
}
/**
@@ -368,6 +359,7 @@ public class VimPlugin implements PersistentStateComponent<Element>, Disposable
if (onOffDisposable != null) {
Disposer.dispose(onOffDisposable);
onOffDisposable = null;
}
}

View File

@@ -14,7 +14,7 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.maddyhome.idea.vim.group.EditorHolderService
@Service
@Service(Service.Level.PROJECT)
internal class VimProjectService(val project: Project) : Disposable {
override fun dispose() {
// Not sure if this is a best solution

View File

@@ -77,7 +77,7 @@ public class VimTypedActionHandler(origHandler: TypedActionHandler) : TypedActio
val modifiers = if (charTyped == ' ' && VimKeyListener.isSpaceShift) KeyEvent.SHIFT_DOWN_MASK else 0
val keyStroke = KeyStroke.getKeyStroke(charTyped, modifiers)
val startTime = if (traceTime) System.currentTimeMillis() else null
handler.handleKey(editor.vim, keyStroke, injector.executionContextManager.onEditor(editor.vim, context.vim))
handler.handleKey(editor.vim, keyStroke, context.vim, handler.keyHandlerState)
if (startTime != null) {
val duration = System.currentTimeMillis() - startTime
LOG.info("VimTypedAction '$charTyped': $duration ms")

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2003-2024 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.action
import com.intellij.vim.annotations.CommandOrMotion
import com.intellij.vim.annotations.Mode
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.handler.VimActionHandler
/**
* Clear and redraw the screen
*
* Typically, an IDE does not need to redraw the screen - it's editor handles scrolling, etc. However, it can be
* necessary to clear the status line.
*/
@CommandOrMotion(keys = ["<C-L>"], modes = [Mode.NORMAL])
internal class RedrawAction : VimActionHandler.SingleExecution() {
override val type: Command.Type = Command.Type.OTHER_READONLY
override fun execute(
editor: VimEditor,
context: ExecutionContext,
cmd: Command,
operatorArguments: OperatorArguments,
): Boolean {
injector.redrawService.redraw()
return true
}
}

View File

@@ -26,8 +26,10 @@ import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.EditorHolderService
import com.maddyhome.idea.vim.group.IjOptionConstants
import com.maddyhome.idea.vim.group.IjOptions
import com.maddyhome.idea.vim.handler.enableOctopus
import com.maddyhome.idea.vim.handler.isOctopusEnabled
import com.maddyhome.idea.vim.helper.EditorHelper
import com.maddyhome.idea.vim.helper.HandlerInjector
@@ -43,7 +45,7 @@ import com.maddyhome.idea.vim.listener.AceJumpService
import com.maddyhome.idea.vim.listener.AppCodeTemplates.appCodeTemplateCaptured
import com.maddyhome.idea.vim.newapi.globalIjOptions
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.ui.ex.ExTextField
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
import java.awt.event.InputEvent
import java.awt.event.KeyEvent
@@ -78,11 +80,8 @@ public class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible
// Should we use HelperKt.getTopLevelEditor(editor) here, as we did in former EditorKeyHandler?
try {
val start = if (traceTime) System.currentTimeMillis() else null
KeyHandler.getInstance().handleKey(
editor.vim,
keyStroke,
injector.executionContextManager.onEditor(editor.vim, e.dataContext.vim),
)
val keyHandler = KeyHandler.getInstance()
keyHandler.handleKey(editor.vim, keyStroke, e.dataContext.vim, keyHandler.keyHandlerState)
if (start != null) {
val duration = System.currentTimeMillis() - start
LOG.info("VimShortcut update '$keyStroke': $duration ms")
@@ -116,12 +115,14 @@ public class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible
if (VimPlugin.isNotEnabled()) return ActionEnableStatus.no("IdeaVim is disabled", LogLevel.DEBUG)
val editor = getEditor(e)
if (editor != null && keyStroke != null) {
if (enableOctopus) {
if (isOctopusEnabled(keyStroke, editor)) {
return ActionEnableStatus.no(
"Processing VimShortcutKeyAction for the key that is used in the octopus handler",
LogLevel.ERROR
)
}
}
if (editor.isIdeaVimDisabledHere) {
return ActionEnableStatus.no("IdeaVim is disabled in this place", LogLevel.INFO)
}
@@ -253,7 +254,14 @@ public class VimShortcutKeyAction : AnAction(), DumbAware/*, LightEditCompatible
return null
}
private fun getEditor(e: AnActionEvent): Editor? = e.getData(PlatformDataKeys.EDITOR)
private fun getEditor(e: AnActionEvent): Editor? {
return e.getData(PlatformDataKeys.EDITOR)
?: if (e.getData(PlatformDataKeys.CONTEXT_COMPONENT) is ExTextField) {
EditorHolderService.getInstance().editor
} else {
null
}
}
/**
* Every time the key pressed with an active lookup, there is a decision:
@@ -377,6 +385,10 @@ private class ActionEnableStatus(
}
}
override fun toString(): String {
return "ActionEnableStatus(isEnabled=$isEnabled, message='$message', logLevel=$logLevel)"
}
companion object {
private val LOG = logger<ActionEnableStatus>()

View File

@@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.Argument
@@ -21,6 +22,7 @@ import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.common.argumentCaptured
import com.maddyhome.idea.vim.ex.ExException
import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VimActionHandler
@@ -29,21 +31,67 @@ import com.maddyhome.idea.vim.helper.MessageHelper
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.vimscript.model.CommandLineVimLContext
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimFuncref
import com.maddyhome.idea.vim.vimscript.model.expressions.FunctionCallExpression
import com.maddyhome.idea.vim.vimscript.model.expressions.SimpleExpression
// todo make it multicaret
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
val operatorFunction = injector.keyGroup.operatorFunction
if (operatorFunction == null) {
val func = injector.globalOptions().operatorfunc
if (func.isEmpty()) {
VimPlugin.showMessage(MessageHelper.message("E774"))
return false
}
val scriptContext = CommandLineVimLContext
// The option value is either a function name, which should have a handler, or it might be a lambda expression, or a
// `function` or `funcref` call expression, all of which will return a funcref (with a handler)
var handler = injector.functionService.getFunctionHandlerOrNull(null, func, scriptContext)
if (handler == null) {
val expression = injector.vimscriptParser.parseExpression(func)
if (expression != null) {
try {
val value = expression.evaluate(editor, context, scriptContext)
if (value is VimFuncref) {
handler = value.handler
}
} catch (ex: ExException) {
// Get the argument for function('...') or funcref('...') for the error message
val functionName = if (expression is FunctionCallExpression && expression.arguments.size > 0) {
expression.arguments[0].evaluate(editor, context, scriptContext).toString()
}
else {
func
}
VimPlugin.showMessage("E117: Unknown function: $functionName")
return false
}
}
}
if (handler == null) {
VimPlugin.showMessage("E117: Unknown function: $func")
return false
}
val arg = when (selectionType) {
SelectionType.LINE_WISE -> "line"
SelectionType.CHARACTER_WISE -> "char"
SelectionType.BLOCK_WISE -> "block"
}
val saveRepeatHandler = VimRepeater.repeatHandler
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
KeyHandler.getInstance().reset(editor)
val result = operatorFunction.apply(editor, context, selectionType)
val arguments = listOf(SimpleExpression(arg))
handler.executeFunction(arguments, editor, context, scriptContext)
VimRepeater.repeatHandler = saveRepeatHandler
return result
return true
}
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])

View File

@@ -7,9 +7,9 @@
*/
package com.maddyhome.idea.vim.action.change
import com.intellij.openapi.command.CommandProcessor
import com.intellij.vim.annotations.CommandOrMotion
import com.intellij.vim.annotations.Mode
import com.intellij.openapi.command.CommandProcessor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
@@ -58,11 +58,11 @@ internal class RepeatChangeAction : VimActionHandler.SingleExecution() {
)
} else if (!repeatHandler && lastCommand != null) {
if (cmd.rawCount > 0) {
lastCommand.count = cmd.count
lastCommand.rawCount = cmd.count
val arg = lastCommand.argument
if (arg != null) {
val mot = arg.motion
mot.count = 0
mot.rawCount = 0
}
}
state.executingCommand = lastCommand

View File

@@ -34,7 +34,7 @@ public class DeleteJoinLinesSpacesAction : ChangeEditorActionHandler.SingleExecu
}
injector.editorGroup.notifyIdeaJoin(editor)
var res = true
editor.nativeCarets().sortedByDescending { it.offset.point }.forEach { caret ->
editor.nativeCarets().sortedByDescending { it.offset }.forEach { caret ->
if (!injector.changeGroup.deleteJoinLines(editor, caret, operatorArguments.count1, true, operatorArguments)) {
res = false
}

View File

@@ -39,7 +39,7 @@ public class DeleteJoinVisualLinesAction : VisualOperatorActionHandler.SingleExe
return true
}
var res = true
editor.nativeCarets().sortedByDescending { it.offset.point }.forEach { caret ->
editor.nativeCarets().sortedByDescending { it.offset }.forEach { caret ->
if (!caret.isValid) return@forEach
val range = caretsAndSelections[caret] ?: return@forEach
if (!injector.changeGroup.deleteJoinRange(

View File

@@ -39,7 +39,7 @@ public class DeleteJoinVisualLinesSpacesAction : VisualOperatorActionHandler.Sin
return true
}
var res = true
editor.carets().sortedByDescending { it.offset.point }.forEach { caret ->
editor.carets().sortedByDescending { it.offset }.forEach { caret ->
if (!caret.isValid) return@forEach
val range = caretsAndSelections[caret] ?: return@forEach
if (!injector.changeGroup.deleteJoinRange(

View File

@@ -8,10 +8,9 @@
package com.maddyhome.idea.vim.action.editor
import com.intellij.openapi.actionSystem.IdeActions
import com.intellij.vim.annotations.CommandOrMotion
import com.intellij.vim.annotations.Mode
import com.intellij.openapi.actionSystem.IdeActions
import com.maddyhome.idea.vim.action.ComplicatedKeysAction
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
@@ -21,54 +20,32 @@ import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.handler.IdeActionHandler
import com.maddyhome.idea.vim.handler.VimActionHandler
import com.maddyhome.idea.vim.helper.enumSetOf
import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke
@CommandOrMotion(keys = ["<C-H>", "<BS>"], modes = [Mode.INSERT])
internal class VimEditorBackSpace : IdeActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_H, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0)),
)
internal class VimEditorBackSpace : IdeActionHandler(IdeActions.ACTION_EDITOR_BACKSPACE) {
override val type: Command.Type = Command.Type.DELETE
}
@CommandOrMotion(keys = ["<Del>"], modes = [Mode.INSERT])
internal class VimEditorDelete : IdeActionHandler(IdeActions.ACTION_EDITOR_DELETE), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)),
)
internal class VimEditorDelete : IdeActionHandler(IdeActions.ACTION_EDITOR_DELETE) {
override val type: Command.Type = Command.Type.DELETE
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_STROKE)
}
@CommandOrMotion(keys = ["<Down>", "<kDown>"], modes = [Mode.INSERT])
internal class VimEditorDown : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, 0)),
)
internal class VimEditorDown : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN) {
override val type: Command.Type = Command.Type.MOTION
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_CLEAR_STROKES)
}
@CommandOrMotion(keys = ["<Tab>", "<C-I>"], modes = [Mode.INSERT])
internal class VimEditorTab : IdeActionHandler(IdeActions.ACTION_EDITOR_TAB), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_I, KeyEvent.CTRL_DOWN_MASK)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0)),
)
internal class VimEditorTab : IdeActionHandler(IdeActions.ACTION_EDITOR_TAB) {
override val type: Command.Type = Command.Type.INSERT
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_STROKE)
}
@CommandOrMotion(keys = ["<Up>", "<kUp>"], modes = [Mode.INSERT])
internal class VimEditorUp : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARET_UP), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> = setOf(
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)),
listOf(KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, 0)),
)
internal class VimEditorUp : IdeActionHandler(IdeActions.ACTION_EDITOR_MOVE_CARET_UP) {
override val type: Command.Type = Command.Type.MOTION
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_CLEAR_STROKES)
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2003-2023 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.action.ex
import com.intellij.vim.annotations.CommandOrMotion
import com.intellij.vim.annotations.Mode
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.ComplicatedKeysAction
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.handler.VimActionHandler
import java.util.*
import javax.swing.KeyStroke
/**
* Called by KeyHandler to process the contents of the ex entry panel
*
* The mapping for this action means that the ex command is executed as a write action
*/
@CommandOrMotion(keys = ["<CR>", "<C-M>", "<C-J>"], modes = [Mode.CMD_LINE])
public class ProcessExEntryAction : VimActionHandler.SingleExecution(), ComplicatedKeysAction {
override val keyStrokesSet: Set<List<KeyStroke>> =
parseKeysSet("<CR>", "<C-M>", 0x0a.toChar().toString(), 0x0d.toChar().toString())
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
override val flags: EnumSet<CommandFlags> = EnumSet.of(CommandFlags.FLAG_COMPLETE_EX)
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
return VimPlugin.getProcess().processExEntry(editor, context)
}
}

View File

@@ -21,19 +21,19 @@ import com.maddyhome.idea.vim.state.mode.SelectionType
public class CommandState(private val machine: VimStateMachine) {
public val isOperatorPending: Boolean
get() = machine.isOperatorPending
get() = machine.isOperatorPending(machine.mode)
public val mode: CommandState.Mode
public val mode: Mode
get() {
val myMode = machine.mode
return when (myMode) {
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> CommandState.Mode.CMD_LINE
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> CommandState.Mode.INSERT
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> CommandState.Mode.COMMAND
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> CommandState.Mode.OP_PENDING
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> CommandState.Mode.REPLACE
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> CommandState.Mode.SELECT
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> CommandState.Mode.VISUAL
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> Mode.CMD_LINE
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> Mode.INSERT
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> Mode.COMMAND
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> Mode.OP_PENDING
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> Mode.REPLACE
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> Mode.SELECT
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> Mode.VISUAL
}
}

View File

@@ -9,8 +9,6 @@
package com.maddyhome.idea.vim.common
import com.intellij.application.options.CodeStyle
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.codeStyle.CommonCodeStyleSettings.IndentOptions
@@ -39,13 +37,12 @@ internal class IndentConfig private constructor(indentOptions: IndentOptions) {
companion object {
@JvmStatic
fun create(editor: Editor, context: DataContext): IndentConfig {
return create(editor, PlatformDataKeys.PROJECT.getData(context))
fun create(editor: Editor): IndentConfig {
return create(editor, editor.project)
}
@JvmStatic
@JvmOverloads
fun create(editor: Editor, project: Project? = editor.project): IndentConfig {
fun create(editor: Editor, project: Project?): IndentConfig {
val indentOptions = if (project != null) {
CodeStyle.getIndentOptions(project, editor.document)
} else {

View File

@@ -13,24 +13,46 @@ import com.maddyhome.idea.vim.api.VimExOutputPanel
import com.maddyhome.idea.vim.helper.vimExOutput
import com.maddyhome.idea.vim.ui.ExOutputPanel
/**
* @author vlan
*/
// TODO: We need a nicer way to handle output, especially wrt testing, appending + clearing
public class ExOutputModel private constructor(private val myEditor: Editor) : VimExOutputPanel {
private var isActiveInTestMode = false
override val isActive: Boolean
get() = if (!ApplicationManager.getApplication().isUnitTestMode) {
ExOutputPanel.isPanelActive(myEditor)
} else {
isActiveInTestMode
}
override var text: String? = null
private set
get() = if (!ApplicationManager.getApplication().isUnitTestMode) {
ExOutputPanel.getInstance(myEditor).text
} else {
field
}
set(value) {
if (!ApplicationManager.getApplication().isUnitTestMode) {
ExOutputPanel.getInstance(myEditor).setText(value ?: "")
} else {
field = value
isActiveInTestMode = !value.isNullOrEmpty()
}
}
override fun output(text: String) {
this.text = text
if (!ApplicationManager.getApplication().isUnitTestMode) {
ExOutputPanel.getInstance(myEditor).setText(text)
}
}
override fun clear() {
text = null
}
override fun close() {
if (!ApplicationManager.getApplication().isUnitTestMode) {
ExOutputPanel.getInstance(myEditor).deactivate(false)
ExOutputPanel.getInstance(myEditor).close()
}
else {
isActiveInTestMode = false
}
}

View File

@@ -7,6 +7,7 @@
*/
package com.maddyhome.idea.vim.extension
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
@@ -14,21 +15,33 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.change.Extension
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.common.CommandAlias
import com.maddyhome.idea.vim.common.CommandAliasHandler
import com.maddyhome.idea.vim.helper.CommandLineHelper
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.helper.TestInputModel
import com.maddyhome.idea.vim.helper.noneOfEnum
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.key.MappingOwner
import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.ui.ModalEntry
import com.maddyhome.idea.vim.vimscript.model.Executable
import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
import com.maddyhome.idea.vim.vimscript.model.VimLContext
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
import com.maddyhome.idea.vim.vimscript.model.expressions.Scope
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionDeclaration
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionFlag
import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke
/**
@@ -120,12 +133,6 @@ public object VimExtensionFacade {
.setAlias(name, CommandAlias.Call(minimumNumberOfArguments, maximumNumberOfArguments, name, handler))
}
/** Sets the value of 'operatorfunc' to be used as the operator function in 'g@'. */
@JvmStatic
public fun setOperatorFunction(function: OperatorFunction) {
VimPlugin.getKey().operatorFunction = function
}
/**
* Runs normal mode commands similar to ':normal! {commands}'.
* Mappings doesn't work with this function
@@ -135,8 +142,9 @@ public object VimExtensionFacade {
*/
@JvmStatic
public fun executeNormalWithoutMapping(keys: List<KeyStroke>, editor: Editor) {
val context = injector.executionContextManager.onEditor(editor.vim)
keys.forEach { KeyHandler.getInstance().handleKey(editor.vim, it, context, false, false) }
val context = injector.executionContextManager.getEditorExecutionContext(editor.vim)
val keyHandler = KeyHandler.getInstance()
keys.forEach { keyHandler.handleKey(editor.vim, it, context, false, false, keyHandler.keyHandlerState) }
}
/** Returns a single key stroke from the user input similar to 'getchar()'. */
@@ -152,7 +160,7 @@ public object VimExtensionFacade {
LOG.trace("Unit test mode is active")
val mappingStack = KeyHandler.getInstance().keyStack
mappingStack.feedSomeStroke() ?: TestInputModel.getInstance(editor).nextKeyStroke()?.also {
if (editor.vim.vimStateMachine.isRecording) {
if (injector.registerGroup.isRecording) {
KeyHandler.getInstance().modalEntryKeys += it
}
}
@@ -173,8 +181,8 @@ public object VimExtensionFacade {
/** Returns a string typed in the input box similar to 'input()'. */
@JvmStatic
public fun inputString(editor: Editor, prompt: String, finishOn: Char?): String {
return service<CommandLineHelper>().inputString(editor.vim, prompt, finishOn) ?: ""
public fun inputString(editor: Editor, context: DataContext, prompt: String, finishOn: Char?): String {
return injector.commandLine.inputString(editor.vim, context.vim, prompt, finishOn) ?: ""
}
/** Get the current contents of the given register similar to 'getreg()'. */
@@ -207,4 +215,65 @@ public object VimExtensionFacade {
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
}
@JvmStatic
public fun exportScriptFunction(
scope: Scope?,
name: String,
args: List<String>,
defaultArgs: List<Pair<String, Expression>>,
hasOptionalArguments: Boolean,
flags: EnumSet<FunctionFlag>,
function: ScriptFunction
) {
var functionDeclaration: FunctionDeclaration? = null
val body = listOf(object : Executable {
// This context is set to the function declaration during initialisation and then set to the function execution
// context during execution
override lateinit var vimContext: VimLContext
override var rangeInScript: TextRange = TextRange(0, 0)
override fun execute(editor: VimEditor, context: ExecutionContext): ExecutionResult {
return function.execute(editor, context, functionDeclaration!!.functionVariables)
}
})
functionDeclaration = FunctionDeclaration(
scope,
name,
args,
defaultArgs,
body,
replaceExisting = true,
flags,
hasOptionalArguments
)
functionDeclaration.rangeInScript = TextRange(0, 0)
body.forEach { it.vimContext = functionDeclaration }
injector.functionService.storeFunction(functionDeclaration)
}
}
public fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) {
editor, context, args ->
val type = args["type"]?.asString()
val selectionType = when (type) {
"line" -> SelectionType.LINE_WISE
"block" -> SelectionType.BLOCK_WISE
"char" -> SelectionType.CHARACTER_WISE
else -> return@exportScriptFunction ExecutionResult.Error
}
if (function.apply(editor, context, selectionType)) {
ExecutionResult.Success
}
else {
ExecutionResult.Error
}
}
}
public fun interface ScriptFunction {
public fun execute(editor: VimEditor, context: ExecutionContext, args: Map<String, VimDataType>): ExecutionResult
}

View File

@@ -53,6 +53,11 @@ internal object VimExtensionRegistrar : VimExtensionRegistrator {
@Synchronized
private fun registerExtension(extensionBean: ExtensionBeanClass) {
val name = extensionBean.name ?: extensionBean.instance.name
if (name == "sneak" && extensionBean.name == null) {
// Filter out the old ideavim-sneak extension that used to be a separate plugin
// https://github.com/Mishkun/ideavim-sneak
return
}
if (name in registeredExtensions) return
registeredExtensions.add(name)
@@ -62,7 +67,7 @@ internal object VimExtensionRegistrar : VimExtensionRegistrator {
VimPlugin.getOptionGroup().addGlobalOptionChangeListener(option) {
if (injector.optionGroup.getOptionValue(option, OptionAccessScope.GLOBAL(null)).asBoolean()) {
initExtension(extensionBean, name)
PluginState.enabledExtensions.add(name)
PluginState.Util.enabledExtensions.add(name)
} else {
extensionBean.instance.dispose()
}

View File

@@ -251,7 +251,7 @@ public class VimArgTextObjExtension implements VimExtension {
final ArgumentTextObjectHandler textObjectHandler = new ArgumentTextObjectHandler(isInner);
//noinspection DuplicatedCode
if (!vimStateMachine.isOperatorPending()) {
if (!vimStateMachine.isOperatorPending(editor.getMode())) {
editor.nativeCarets().forEach((VimCaret caret) -> {
final TextRange range = textObjectHandler.getRange(editor, caret, context, count, 0);
if (range != null) {

View File

@@ -22,26 +22,27 @@ import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getLineEndOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.CommandAliasHandler
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.ex.ranges.Ranges
import com.maddyhome.idea.vim.ex.ranges.Range
import com.maddyhome.idea.vim.ex.ranges.toTextRange
import com.maddyhome.idea.vim.extension.ExtensionHandler
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.PsiHelper
import com.maddyhome.idea.vim.helper.vimStateMachine
@@ -49,17 +50,19 @@ import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.IjVimEditor
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import java.util.*
internal class CommentaryExtension : VimExtension {
companion object {
object Util {
fun doCommentary(
editor: VimEditor,
context: ExecutionContext,
range: TextRange,
selectionType: SelectionType,
resetCaret: Boolean,
resetCaret: Boolean = true,
): Boolean {
val mode = editor.vimStateMachine.mode
if (mode !is Mode.VISUAL) {
@@ -67,8 +70,7 @@ internal class CommentaryExtension : VimExtension {
}
return runWriteAction {
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
// isn't available
// Treat block- and character-wise selections as block comments. Fall back if the first action isn't available
val actions = if (selectionType === SelectionType.LINE_WISE) {
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
} else {
@@ -113,12 +115,17 @@ internal class CommentaryExtension : VimExtension {
// 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
// TODO: If we don't move the caret to the start offset, we should maintain the current logical position
if (resetCaret) {
editor.primaryCaret().moveToOffset(range.startOffset)
}
}
}
companion object {
private const val OPERATOR_FUNC = "CommentaryOperatorFunc"
}
override fun getName() = "commentary"
override fun init() {
@@ -145,6 +152,16 @@ internal class CommentaryExtension : VimExtension {
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
addCommand("Commentary", CommentaryCommandAliasHandler())
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, CommentaryOperatorFunction())
}
private class CommentaryOperatorFunction : OperatorFunction {
// todo make it multicaret
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
return Util.doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
}
}
/**
@@ -153,19 +170,13 @@ internal class CommentaryExtension : VimExtension {
* 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.
*/
private class CommentaryOperatorHandler : OperatorFunction, ExtensionHandler {
private class CommentaryOperatorHandler : ExtensionHandler {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(this)
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
// todo make it multicaret
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
return doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
}
}
private class CommentaryMappingHandler : ExtensionHandler {
@@ -238,8 +249,14 @@ internal class CommentaryExtension : VimExtension {
* Used like `:1,3Commentary` or `g/fun/Commentary`
*/
private class CommentaryCommandAliasHandler : CommandAliasHandler {
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
doCommentary(editor, context, ranges.getTextRange(editor, -1), SelectionType.LINE_WISE, false)
override fun execute(command: String, range: Range, editor: VimEditor, context: ExecutionContext) {
Util.doCommentary(
editor,
context,
range.getLineRange(editor, editor.primaryCaret()).toTextRange(editor),
SelectionType.LINE_WISE,
false
)
}
}
}

View File

@@ -19,24 +19,22 @@ import com.intellij.openapi.util.Key
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
import com.maddyhome.idea.vim.state.mode.selectionType
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.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.helper.fileSize
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
import com.maddyhome.idea.vim.helper.moveToInlayAwareOffset
import com.maddyhome.idea.vim.key.OperatorFunction
@@ -45,6 +43,8 @@ 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.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.selectionType
import org.jetbrains.annotations.NonNls
/**
@@ -72,30 +72,13 @@ internal class VimExchangeExtension : VimExtension {
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("X"), owner, injector.parser.parseKeys(EXCHANGE_CMD), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxc"), owner, injector.parser.parseKeys(EXCHANGE_CLEAR_CMD), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
}
companion object {
@NonNls
const val EXCHANGE_CMD = "<Plug>(Exchange)"
@NonNls
const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
@NonNls
const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
object Util {
val EXCHANGE_KEY = Key<Exchange>("exchange")
// End mark has always greater of eq offset than start mark
class Exchange(val type: SelectionType, val start: Mark, val end: Mark, val text: String) {
private var myHighlighter: RangeHighlighter? = null
fun setHighlighter(highlighter: RangeHighlighter) {
myHighlighter = highlighter
}
fun getHighlighter(): RangeHighlighter? = myHighlighter
}
fun clearExchange(editor: Editor) {
editor.getUserData(EXCHANGE_KEY)?.getHighlighter()?.let {
editor.markupModel.removeHighlighter(it)
@@ -104,18 +87,25 @@ internal class VimExchangeExtension : VimExtension {
}
}
companion object {
@NonNls private const val EXCHANGE_CMD = "<Plug>(Exchange)"
@NonNls private const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
@NonNls private const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
@NonNls private const val OPERATOR_FUNC = "ExchangeOperatorFunc"
}
private class ExchangeHandler(private val isLine: Boolean) : ExtensionHandler {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator(false))
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys(if (isLine) "g@_" else "g@"), editor.ij)
}
}
private class ExchangeClearHandler : ExtensionHandler {
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
clearExchange(editor.ij)
Util.clearExchange(editor.ij)
}
}
@@ -125,12 +115,12 @@ internal class VimExchangeExtension : VimExtension {
val mode = editor.mode
// Leave visual mode to create selection marks
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
Operator(true).apply(editor, context, mode.selectionType ?: CHARACTER_WISE)
Operator(true).apply(editor, context, mode.selectionType ?: SelectionType.CHARACTER_WISE)
}
}
}
private class Operator(private val isVisual: Boolean) : OperatorFunction {
private class Operator(private val isVisual: Boolean = false) : OperatorFunction {
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
fun SelectionType.getString() = when (this) {
SelectionType.CHARACTER_WISE -> "v"
@@ -148,7 +138,7 @@ internal class VimExchangeExtension : VimExtension {
else -> HighlighterTargetArea.EXACT_RANGE
}
val isVisualLine = ex.type == SelectionType.LINE_WISE
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || (isVisual))) 1 else 0
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || isVisual)) 1 else 0
return ijEditor.markupModel.addRangeHighlighter(
ijEditor.getMarkOffset(ex.start),
(ijEditor.getMarkOffset(ex.end) + endAdj).coerceAtMost(ijEditor.fileSize),
@@ -158,12 +148,12 @@ internal class VimExchangeExtension : VimExtension {
)
}
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: CHARACTER_WISE)
val exchange1 = ijEditor.getUserData(EXCHANGE_KEY)
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: SelectionType.CHARACTER_WISE)
val exchange1 = ijEditor.getUserData(Util.EXCHANGE_KEY)
if (exchange1 == null) {
val highlighter = highlightExchange(currentExchange)
currentExchange.setHighlighter(highlighter)
ijEditor.putUserData(EXCHANGE_KEY, currentExchange)
ijEditor.putUserData(Util.EXCHANGE_KEY, currentExchange)
return true
} else {
val cmp = compareExchanges(exchange1, currentExchange)
@@ -189,7 +179,7 @@ internal class VimExchangeExtension : VimExtension {
}
}
exchange(ijEditor, ex1, ex2, reverse, expand)
clearExchange(ijEditor)
Util.clearExchange(ijEditor)
return true
}
}
@@ -354,4 +344,14 @@ internal class VimExchangeExtension : VimExtension {
}
}
}
// End mark has always greater of eq offset than start mark
class Exchange(val type: SelectionType, val start: Mark, val end: Mark, val text: String) {
private var myHighlighter: RangeHighlighter? = null
fun setHighlighter(highlighter: RangeHighlighter) {
myHighlighter = highlighter
}
fun getHighlighter(): RangeHighlighter? = myHighlighter
}
}

View File

@@ -10,7 +10,7 @@ package com.maddyhome.idea.vim.extension.highlightedyank
import com.intellij.ide.ui.LafManager
import com.intellij.ide.ui.LafManagerListener
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColors
import com.intellij.openapi.editor.markup.EffectType
@@ -19,25 +19,24 @@ import com.intellij.openapi.editor.markup.HighlighterTargetArea
import com.intellij.openapi.editor.markup.RangeHighlighter
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.util.Disposer
import com.intellij.util.Alarm
import com.intellij.util.Alarm.ThreadToUse
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.VimProjectService
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.helper.MessageHelper
import com.maddyhome.idea.vim.helper.StrictMode
import com.maddyhome.idea.vim.helper.VimNlsSafe
import com.maddyhome.idea.vim.listener.VimInsertListener
import com.maddyhome.idea.vim.listener.VimYankListener
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
import org.jetbrains.annotations.NonNls
import java.awt.Color
import java.awt.Font
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
internal const val DEFAULT_HIGHLIGHT_DURATION: Long = 300
internal const val DEFAULT_HIGHLIGHT_DURATION: Int = 300
@NonNls
private val HIGHLIGHT_DURATION_VARIABLE_NAME = "highlightedyank_highlight_duration"
@@ -78,111 +77,128 @@ internal class HighlightColorResetter : LafManagerListener {
*/
internal class VimHighlightedYank : VimExtension, VimYankListener, VimInsertListener {
private val highlightHandler = HighlightHandler()
private var initialised = false
override fun getName() = "highlightedyank"
override fun init() {
// Note that these listeners will still be registered when IdeaVim is disabled. However, they'll never get called
VimPlugin.getYank().addListener(this)
VimPlugin.getChange().addInsertListener(this)
// Register our own disposable to remove highlights when IdeaVim is disabled. Somehow, we need to re-register when
// IdeaVim is re-enabled. We don't get a call back for that, but because the listeners are active until the
// _extension_ is disabled, make sure we're properly initialised each time we're called.
registerIdeaVimDisabledCallback()
initialised = true
}
private fun registerIdeaVimDisabledCallback() {
// TODO: IdeaVim should help with lifecycle management here - VIM-3419
// IdeaVim should possibly unregister extensions, but it would also need to re-register them. We have to do this
// state management manually for now
Disposer.register(VimPlugin.getInstance().onOffDisposable) {
highlightHandler.clearYankHighlighters()
initialised = false
}
}
override fun dispose() {
// Called when the extension is disabled with `:set no{extension}` or if the plugin owning the extension unloads
VimPlugin.getYank().removeListener(this)
VimPlugin.getChange().removeInsertListener(this)
highlightHandler.clearYankHighlighters()
initialised = false
}
override fun yankPerformed(editor: VimEditor, range: TextRange) {
ensureInitialised()
highlightHandler.highlightYankRange(editor.ij, range)
}
override fun insertModeStarted(editor: Editor) {
highlightHandler.clearAllYankHighlighters()
ensureInitialised()
highlightHandler.clearYankHighlighters()
}
private fun ensureInitialised() {
if (!initialised) {
registerIdeaVimDisabledCallback()
initialised = true
}
}
private class HighlightHandler {
private var editor: Editor? = null
private val yankHighlighters: MutableSet<RangeHighlighter> = mutableSetOf()
private val alarm = Alarm(ThreadToUse.SWING_THREAD)
private var lastEditor: Editor? = null
private val highlighters = mutableSetOf<RangeHighlighter>()
fun highlightYankRange(editor: Editor, range: TextRange) {
// from vim-highlightedyank docs: When a new text is yanked or user starts editing, the old highlighting would be deleted
clearAllYankHighlighters()
clearYankHighlighters()
this.editor = editor
val project = editor.project
if (project != null) {
Disposer.register(
VimProjectService.getInstance(project),
) {
this.editor = null
yankHighlighters.clear()
}
}
lastEditor = editor
if (range.isMultiple) {
val attributes = getHighlightTextAttributes(editor)
for (i in 0 until range.size()) {
highlightSingleRange(editor, range.startOffsets[i]..range.endOffsets[i])
}
} else {
highlightSingleRange(editor, range.startOffset..range.endOffset)
}
}
fun clearAllYankHighlighters() {
yankHighlighters.forEach { highlighter ->
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
}
yankHighlighters.clear()
}
private fun highlightSingleRange(editor: Editor, range: ClosedRange<Int>) {
val highlighter = editor.markupModel.addRangeHighlighter(
range.start,
range.endInclusive,
range.startOffsets[i],
range.endOffsets[i],
HighlighterLayer.SELECTION,
getHighlightTextAttributes(),
attributes,
HighlighterTargetArea.EXACT_RANGE,
)
yankHighlighters.add(highlighter)
setClearHighlightRangeTimer(highlighter)
highlighters.add(highlighter)
}
private fun setClearHighlightRangeTimer(highlighter: RangeHighlighter) {
val timeout = extractUsersHighlightDuration()
// from vim-highlightedyank docs: A negative number makes the highlight persistent.
val timeout = extractUsersHighlightDuration()
if (timeout >= 0) {
Executors.newSingleThreadScheduledExecutor().schedule(
{
ApplicationManager.getApplication().invokeLater {
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
}
},
// Note modality. This is important when highlighting an editor when a modal dialog is open, such as the resolve
// conflict diff view
alarm.addRequest(
{ clearYankHighlighters() },
timeout,
TimeUnit.MILLISECONDS,
ModalityState.any()
)
}
}
private fun getHighlightTextAttributes() = TextAttributes(
fun clearYankHighlighters() {
alarm.cancelAllRequests()
// Make sure the last editor we saved is still alive before we use it. We can't just use the list of open editors
// because this list is empty when IdeaVim is disabled, so we're unable to clean up
lastEditor?.let { editor ->
if (!editor.isDisposed) {
highlighters.forEach { highlighter -> editor.markupModel.removeHighlighter(highlighter) }
}
}
lastEditor = null
highlighters.clear()
}
private fun getHighlightTextAttributes(editor: Editor) = TextAttributes(
null,
extractUsersHighlightColor(),
editor?.colorsScheme?.getColor(EditorColors.CARET_COLOR),
editor.colorsScheme.getColor(EditorColors.CARET_COLOR),
EffectType.SEARCH_MATCH,
Font.PLAIN,
)
private fun extractUsersHighlightDuration(): Long {
private fun extractUsersHighlightDuration(): Int {
return extractVariable(HIGHLIGHT_DURATION_VARIABLE_NAME, DEFAULT_HIGHLIGHT_DURATION) {
it.toLong()
// toVimNumber will return 0 for an invalid string. Let's force it to throw
when (it) {
is VimString -> it.value.toInt()
else -> it.toVimNumber().value
}
}
}
private fun extractUsersHighlightColor(): Color {
return extractVariable(HIGHLIGHT_COLOR_VARIABLE_NAME, getDefaultHighlightTextColor()) { value ->
val rgba = value
val rgba = value.asString()
.substring(4)
.filter { it != '(' && it != ')' && !it.isWhitespace() }
.split(',')
@@ -192,12 +208,11 @@ internal class VimHighlightedYank : VimExtension, VimYankListener, VimInsertList
}
}
private fun <T> extractVariable(variable: String, default: T, extractFun: (value: String) -> T): T {
private fun <T> extractVariable(variable: String, default: T, extractFun: (value: VimDataType) -> T): T {
val value = VimPlugin.getVariableService().getGlobalVariableValue(variable)
if (value is VimString) {
if (value != null) {
return try {
extractFun(value.value)
extractFun(value)
} catch (e: Exception) {
@VimNlsSafe val message = MessageHelper.message(
"highlightedyank.invalid.value.of.0.1",

View File

@@ -99,7 +99,7 @@ internal class Matchit : VimExtension {
// 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.
val isInOpPending = commandState.isOperatorPending
val isInOpPending = commandState.isOperatorPending(editor.mode)
if (isInOpPending) {
val matchitAction = MatchitAction()

View File

@@ -246,7 +246,7 @@ internal class VimMultipleCursorsExtension : VimExtension {
// Note that ignoreCase is not overridden by the `\C` in the pattern
val pattern = makePattern(text, whole)
val matches = SearchHelper.findAll(editor, pattern, 0, -1, false)
val matches = injector.searchHelper.findAll(IjVimEditor(editor), pattern, 0, -1, false)
for (match in matches) {
if (match.contains(primaryCaret.offset)) {
primaryCaret.vim.moveToOffset(match.startOffset)
@@ -322,7 +322,7 @@ internal class VimMultipleCursorsExtension : VimExtension {
searchOptions.add(SearchOptions.WRAP)
}
return SearchHelper.findPattern(editor, makePattern(text, whole), startOffset, 1, searchOptions)?.startOffset ?: -1
return injector.searchHelper.findPattern(IjVimEditor(editor), makePattern(text, whole), startOffset, 1, searchOptions)?.startOffset ?: -1
}
private fun makePattern(text: String, whole: Boolean): String {

View File

@@ -37,7 +37,7 @@ import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.common.CommandAlias
import com.maddyhome.idea.vim.common.CommandAliasHandler
import com.maddyhome.idea.vim.ex.ranges.Ranges
import com.maddyhome.idea.vim.ex.ranges.Range
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.group.KeyGroup
import com.maddyhome.idea.vim.helper.MessageHelper
@@ -130,32 +130,32 @@ internal class NerdTree : VimExtension {
addCommand("NERDTreeFind", IjCommandHandler("SelectInProjectView"))
addCommand("NERDTreeRefreshRoot", IjCommandHandler("Synchronize"))
synchronized(monitor) {
commandsRegistered = true
synchronized(Util.monitor) {
Util.commandsRegistered = true
ProjectManager.getInstance().openProjects.forEach { project -> installDispatcher(project) }
}
}
class IjCommandHandler(private val actionId: String) : CommandAliasHandler {
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
callAction(editor, actionId, context)
override fun execute(command: String, range: Range, editor: VimEditor, context: ExecutionContext) {
Util.callAction(editor, actionId, context)
}
}
class ToggleHandler : CommandAliasHandler {
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
override fun execute(command: String, range: Range, editor: VimEditor, context: ExecutionContext) {
val project = editor.ij.project ?: return
val toolWindow = ToolWindowManagerEx.getInstanceEx(project).getToolWindow(ToolWindowId.PROJECT_VIEW) ?: return
if (toolWindow.isVisible) {
toolWindow.hide()
} else {
callAction(editor, "ActivateProjectToolWindow", context)
Util.callAction(editor, "ActivateProjectToolWindow", context)
}
}
}
class CloseHandler : CommandAliasHandler {
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
override fun execute(command: String, range: Range, editor: VimEditor, context: ExecutionContext) {
val project = editor.ij.project ?: return
val toolWindow = ToolWindowManagerEx.getInstanceEx(project).getToolWindow(ToolWindowId.PROJECT_VIEW) ?: return
if (toolWindow.isVisible) {
@@ -187,8 +187,8 @@ internal class NerdTree : VimExtension {
// TODO I'm not sure is this activity runs at all? Should we use [RunOnceUtil] instead?
class NerdStartupActivity : ProjectActivity {
override suspend fun execute(project: Project) {
synchronized(monitor) {
if (!commandsRegistered) return
synchronized(Util.monitor) {
if (!Util.commandsRegistered) return
installDispatcher(project)
}
}
@@ -214,7 +214,7 @@ internal class NerdTree : VimExtension {
val action = nextNode.actionHolder
when (action) {
is NerdAction.ToIj -> callAction(null, action.name, e.dataContext.vim)
is NerdAction.ToIj -> Util.callAction(null, action.name, e.dataContext.vim)
is NerdAction.Code -> e.project?.let { action.action(it, e.dataContext, e) }
}
}
@@ -356,7 +356,7 @@ internal class NerdTree : VimExtension {
currentWindow?.split(SwingConstants.VERTICAL, true, file, true)
// FIXME: 22.01.2021 This solution bouncing a bit
callAction(null, "ActivateProjectToolWindow", context.vim)
Util.callAction(null, "ActivateProjectToolWindow", context.vim)
},
)
registerCommand(
@@ -368,7 +368,7 @@ internal class NerdTree : VimExtension {
val currentWindow = splitters.currentWindow
currentWindow?.split(SwingConstants.HORIZONTAL, true, file, true)
callAction(null, "ActivateProjectToolWindow", context.vim)
Util.callAction(null, "ActivateProjectToolWindow", context.vim)
},
)
registerCommand(
@@ -477,6 +477,7 @@ internal class NerdTree : VimExtension {
"r",
NerdAction.ToIj("SynchronizeCurrentFile"),
)
registerCommand("NERDTreeMapToggleHidden", "I", NerdAction.ToIj("ProjectView.ShowExcludedFiles"))
registerCommand("NERDTreeMapRefreshRoot", "R", NerdAction.ToIj("Synchronize"))
registerCommand("NERDTreeMapMenu", "m", NerdAction.ToIj("ShowPopupMenu"))
registerCommand("NERDTreeMapQuit", "q", NerdAction.ToIj("HideActiveWindow"))
@@ -504,14 +505,9 @@ internal class NerdTree : VimExtension {
)
}
companion object {
const val pluginName = "NERDTree"
object Util {
internal val monitor = Any()
internal var commandsRegistered = false
private val LOG = logger<NerdTree>()
fun callAction(editor: VimEditor?, name: String, context: ExecutionContext) {
val action = ActionManager.getInstance().getAction(name) ?: run {
VimPlugin.showMessage(MessageHelper.message("action.not.found.0", name))
@@ -526,12 +522,19 @@ internal class NerdTree : VimExtension {
}
}
}
private fun addCommand(alias: String, handler: CommandAliasHandler) {
VimPlugin.getCommand().setAlias(alias, CommandAlias.Call(0, -1, alias, handler))
}
private fun registerCommand(variable: String, default: String, action: NerdAction) {
companion object {
const val pluginName = "NERDTree"
private val LOG = logger<NerdTree>()
}
}
private fun addCommand(alias: String, handler: CommandAliasHandler) {
VimPlugin.getCommand().setAlias(alias, CommandAlias.Call(0, -1, alias, handler))
}
private fun registerCommand(variable: String, default: String, action: NerdAction) {
val variableValue = VimPlugin.getVariableService().getGlobalVariableValue(variable)
val mappings = if (variableValue is VimString) {
variableValue.value
@@ -539,16 +542,16 @@ internal class NerdTree : VimExtension {
default
}
actionsRoot.addLeafs(mappings, action)
}
}
private fun registerCommand(default: String, action: NerdAction) {
private fun registerCommand(default: String, action: NerdAction) {
actionsRoot.addLeafs(default, action)
}
}
private val actionsRoot: RootNode<NerdAction> = RootNode()
private var currentNode: CommandPartNode<NerdAction> = actionsRoot
private fun collectShortcuts(node: Node<NerdAction>): Set<KeyStroke> {
private val actionsRoot: RootNode<NerdAction> = RootNode()
private var currentNode: CommandPartNode<NerdAction> = actionsRoot
private fun collectShortcuts(node: Node<NerdAction>): Set<KeyStroke> {
return if (node is CommandPartNode<NerdAction>) {
val res = node.keys.toMutableSet()
res += node.values.map { collectShortcuts(it) }.flatten()
@@ -556,15 +559,14 @@ internal class NerdTree : VimExtension {
} else {
emptySet()
}
}
}
private fun installDispatcher(project: Project) {
val dispatcher = NerdDispatcher.getInstance(project)
val shortcuts = collectShortcuts(actionsRoot).map { RequiredShortcut(it, MappingOwner.Plugin.get(pluginName)) }
private fun installDispatcher(project: Project) {
val dispatcher = NerdTree.NerdDispatcher.getInstance(project)
val shortcuts =
collectShortcuts(actionsRoot).map { RequiredShortcut(it, MappingOwner.Plugin.get(NerdTree.pluginName)) }
dispatcher.registerCustomShortcutSet(
KeyGroup.toShortcutSet(shortcuts),
(ProjectView.getInstance(project) as ProjectViewImpl).component,
)
}
}
}

View File

@@ -9,6 +9,7 @@
package com.maddyhome.idea.vim.extension.paragraphmotion
import com.intellij.openapi.editor.Caret
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
@@ -20,8 +21,10 @@ import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.helper.vimForEachCaret
import com.maddyhome.idea.vim.key.MappingOwner
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
import javax.swing.KeyStroke
internal class ParagraphMotion : VimExtension {
override fun getName(): String = "vim-paragraph-motion"
@@ -30,8 +33,8 @@ internal class ParagraphMotion : VimExtension {
VimExtensionFacade.putExtensionHandlerMapping(MappingMode.NXO, injector.parser.parseKeys("<Plug>(ParagraphNextMotion)"), owner, ParagraphMotionHandler(1), false)
VimExtensionFacade.putExtensionHandlerMapping(MappingMode.NXO, injector.parser.parseKeys("<Plug>(ParagraphPrevMotion)"), owner, ParagraphMotionHandler(-1), false)
putKeyMappingIfMissing(MappingMode.NXO, injector.parser.parseKeys("}"), owner, injector.parser.parseKeys("<Plug>(ParagraphNextMotion)"), true)
putKeyMappingIfMissing(MappingMode.NXO, injector.parser.parseKeys("{"), owner, injector.parser.parseKeys("<Plug>(ParagraphPrevMotion)"), true)
putKeyMappingIfMissingFromAndToKeys(MappingMode.NXO, injector.parser.parseKeys("}"), owner, injector.parser.parseKeys("<Plug>(ParagraphNextMotion)"), true)
putKeyMappingIfMissingFromAndToKeys(MappingMode.NXO, injector.parser.parseKeys("{"), owner, injector.parser.parseKeys("<Plug>(ParagraphPrevMotion)"), true)
}
private class ParagraphMotionHandler(private val count: Int) : ExtensionHandler {
@@ -49,4 +52,17 @@ internal class ParagraphMotion : VimExtension {
?.let { editor.normalizeOffset(it, true) }
}
}
// For VIM-3306
@Suppress("SameParameterValue")
private fun putKeyMappingIfMissingFromAndToKeys(
modes: Set<MappingMode>,
fromKeys: List<KeyStroke>,
pluginOwner: MappingOwner,
toKeys: List<KeyStroke>,
recursive: Boolean,
) {
val filteredModes = modes.filterNotTo(HashSet()) { VimPlugin.getKey().hasmapfrom(it, fromKeys) }
putKeyMappingIfMissing(filteredModes, fromKeys, pluginOwner, toKeys, recursive)
}
}

View File

@@ -8,30 +8,26 @@
package com.maddyhome.idea.vim.extension.replacewithregister
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getLineEndOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
import com.maddyhome.idea.vim.state.mode.isLine
import com.maddyhome.idea.vim.state.mode.selectionType
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.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.helper.exitVisualMode
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.IjVimEditor
@@ -39,6 +35,10 @@ import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
import com.maddyhome.idea.vim.put.PutData
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.isLine
import com.maddyhome.idea.vim.state.mode.selectionType
import org.jetbrains.annotations.NonNls
internal class ReplaceWithRegister : VimExtension {
@@ -53,17 +53,19 @@ internal class ReplaceWithRegister : VimExtension {
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_OPERATOR), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("grr"), owner, injector.parser.parseKeys(RWR_LINE), true)
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_VISUAL), true)
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
}
private class RwrVisual : ExtensionHandler {
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
val typeInEditor = editor.mode.selectionType ?: CHARACTER_WISE
val typeInEditor = editor.mode.selectionType ?: SelectionType.CHARACTER_WISE
editor.sortedCarets().forEach { caret ->
val selectionStart = caret.selectionStart
val selectionEnd = caret.selectionEnd
val visualSelection = caret to VimSelection.create(selectionStart, selectionEnd - 1, typeInEditor, editor)
doReplace(editor.ij, caret, PutData.VisualSelection(mapOf(visualSelection), typeInEditor))
doReplace(editor.ij, context.ij, caret, PutData.VisualSelection(mapOf(visualSelection), typeInEditor))
}
editor.exitVisualMode()
}
@@ -73,7 +75,7 @@ internal class ReplaceWithRegister : VimExtension {
override val isRepeatable: Boolean = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator())
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
}
@@ -91,7 +93,7 @@ internal class ReplaceWithRegister : VimExtension {
val visualSelection = caret to VimSelection.create(lineStart, lineEnd, SelectionType.LINE_WISE, editor)
caretsAndSelections += visualSelection
doReplace(editor.ij, caret, PutData.VisualSelection(mapOf(visualSelection), SelectionType.LINE_WISE))
doReplace(editor.ij, context.ij, caret, PutData.VisualSelection(mapOf(visualSelection), SelectionType.LINE_WISE))
}
editor.sortedCarets().forEach { caret ->
@@ -112,14 +114,14 @@ internal class ReplaceWithRegister : VimExtension {
editor.primaryCaret() to VimSelection.create(
range.startOffset,
range.endOffset - 1,
selectionType ?: CHARACTER_WISE,
selectionType ?: SelectionType.CHARACTER_WISE,
editor,
),
),
selectionType ?: CHARACTER_WISE,
selectionType ?: SelectionType.CHARACTER_WISE,
)
// todo multicaret
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
doReplace(ijEditor, context.ij, editor.primaryCaret(), visualSelection)
return true
}
@@ -132,16 +134,14 @@ internal class ReplaceWithRegister : VimExtension {
}
companion object {
@NonNls
private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
@NonNls private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
@NonNls private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
@NonNls private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
@NonNls private const val OPERATOR_FUNC = "ReplaceWithRegisterOperatorFunc"
}
}
@NonNls
private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
@NonNls
private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
private fun doReplace(editor: Editor, context: DataContext, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
val registerGroup = injector.registerGroup
val lastRegisterChar = if (editor.caretModel.caretCount == 1) registerGroup.currentRegister else registerGroup.getCurrentRegisterForMulticaret()
val savedRegister = caret.registerStorage.getRegister(lastRegisterChar) ?: return
@@ -165,19 +165,18 @@ internal class ReplaceWithRegister : VimExtension {
caretAfterInsertedText = false,
putToLine = -1,
)
val vimEditor = editor.vim
ClipboardOptionHelper.IdeaputDisabler().use {
VimPlugin.getPut().putText(
IjVimEditor(editor),
injector.executionContextManager.onEditor(editor.vim),
vimEditor,
context.vim,
putData,
operatorArguments = OperatorArguments(
editor.vimStateMachine?.isOperatorPending ?: false,
editor.vimStateMachine?.isOperatorPending(vimEditor.mode) ?: false,
0,
editor.vim.mode,
),
saveToRegister = false
)
}
}
}
}

View File

@@ -0,0 +1,327 @@
/*
* Copyright 2003-2024 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.sneak
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.ScrollType
import com.intellij.openapi.editor.colors.EditorColors
import com.intellij.openapi.editor.markup.EffectType
import com.intellij.openapi.editor.markup.HighlighterLayer
import com.intellij.openapi.editor.markup.HighlighterTargetArea
import com.intellij.openapi.editor.markup.RangeHighlighter
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.util.Disposer
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.VimProjectService
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.options
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.OperatorArguments
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.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
import com.maddyhome.idea.vim.extension.VimExtensionHandler
import com.maddyhome.idea.vim.helper.StrictMode
import com.maddyhome.idea.vim.newapi.ij
import java.awt.Font
import java.awt.event.KeyEvent
import java.util.*
import javax.swing.Timer
private const val DEFAULT_HIGHLIGHT_DURATION_SNEAK = 300
// By [Mikhail Levchenko](https://github.com/Mishkun)
// Original repository with the plugin: https://github.com/Mishkun/ideavim-sneak
internal class IdeaVimSneakExtension : VimExtension {
override fun getName(): String = "sneak"
override fun init() {
val highlightHandler = HighlightHandler()
mapToFunctionAndProvideKeys("s", SneakHandler(highlightHandler, Direction.FORWARD), MappingMode.NXO)
// vim-sneak uses `Z` for visual mode because `S` conflict with vim-sneak plugin VIM-3330
mapToFunctionAndProvideKeys("S", SneakHandler(highlightHandler, Direction.BACKWARD), MappingMode.NO)
mapToFunctionAndProvideKeys("Z", SneakHandler(highlightHandler, Direction.BACKWARD), MappingMode.X)
// workaround to support ; and , commands
mapToFunctionAndProvideKeys("f", SneakMemoryHandler("f"), MappingMode.NXO)
mapToFunctionAndProvideKeys("F", SneakMemoryHandler("F"), MappingMode.NXO)
mapToFunctionAndProvideKeys("t", SneakMemoryHandler("t"), MappingMode.NXO)
mapToFunctionAndProvideKeys("T", SneakMemoryHandler("T"), MappingMode.NXO)
mapToFunctionAndProvideKeys(";", SneakRepeatHandler(highlightHandler, RepeatDirection.IDENTICAL), MappingMode.NXO)
mapToFunctionAndProvideKeys(",", SneakRepeatHandler(highlightHandler, RepeatDirection.REVERSE), MappingMode.NXO)
}
private class SneakHandler(
private val highlightHandler: HighlightHandler,
private val direction: Direction,
) : ExtensionHandler {
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
val charone = getChar(editor) ?: return
val chartwo = getChar(editor) ?: return
val range = Util.jumpTo(editor, charone, chartwo, direction)
range?.let { highlightHandler.highlightSneakRange(editor.ij, range) }
Util.lastSymbols = "${charone}${chartwo}"
Util.lastSDirection = direction
}
private fun getChar(editor: VimEditor): Char? {
val key = VimExtensionFacade.inputKeyStroke(editor.ij)
return when {
key.keyChar == KeyEvent.CHAR_UNDEFINED || key.keyCode == KeyEvent.VK_ESCAPE -> null
else -> key.keyChar
}
}
}
/**
* This class acts as proxy for normal find commands because we need to update [Util.lastSDirection]
*/
private class SneakMemoryHandler(private val char: String) : VimExtensionHandler {
override fun execute(editor: Editor, context: DataContext) {
Util.lastSDirection = null
VimExtensionFacade.executeNormalWithoutMapping(injector.parser.parseKeys(char), editor)
}
}
private class SneakRepeatHandler(
private val highlightHandler: HighlightHandler,
private val direction: RepeatDirection,
) : ExtensionHandler {
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
val lastSDirection = Util.lastSDirection
if (lastSDirection != null) {
val (charone, chartwo) = Util.lastSymbols.toList()
val jumpRange = Util.jumpTo(editor, charone, chartwo, direction.map(lastSDirection))
jumpRange?.let { highlightHandler.highlightSneakRange(editor.ij, jumpRange) }
} else {
VimExtensionFacade.executeNormalWithoutMapping(injector.parser.parseKeys(direction.symb), editor.ij)
}
}
}
private object Util {
var lastSDirection: Direction? = null
var lastSymbols: String = ""
fun jumpTo(editor: VimEditor, charone: Char, chartwo: Char, sneakDirection: Direction): TextRange? {
val caret = editor.primaryCaret()
val position = caret.offset
val chars = editor.text()
val foundPosition = sneakDirection.findBiChar(editor, chars, position, charone, chartwo)
if (foundPosition != null) {
editor.primaryCaret().moveToOffset(foundPosition)
}
editor.ij.scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE)
return foundPosition?.let { TextRange(foundPosition, foundPosition + 2) }
}
}
private enum class Direction(val offset: Int) {
FORWARD(1) {
override fun findBiChar(
editor: VimEditor,
charSequence: CharSequence,
position: Int,
charone: Char,
chartwo: Char
): Int? {
for (i in (position + offset) until charSequence.length - 1) {
if (matches(editor, charSequence, i, charone, chartwo)) {
return i
}
}
return null
}
},
BACKWARD(-1) {
override fun findBiChar(
editor: VimEditor,
charSequence: CharSequence,
position: Int,
charone: Char,
chartwo: Char
): Int? {
for (i in (position + offset) downTo 0) {
if (matches(editor, charSequence, i, charone, chartwo)) {
return i
}
}
return null
}
};
abstract fun findBiChar(
editor: VimEditor,
charSequence: CharSequence,
position: Int,
charone: Char,
chartwo: Char,
): Int?
fun matches(
editor: VimEditor,
charSequence: CharSequence,
charPosition: Int,
charOne: Char,
charTwo: Char,
): Boolean {
var match = charSequence[charPosition].equals(charOne, ignoreCase = injector.options(editor).ignorecase) &&
charSequence[charPosition + 1].equals(charTwo, ignoreCase = injector.options(editor).ignorecase)
if (injector.options(editor).ignorecase && injector.options(editor).smartcase) {
if (charOne.isUpperCase() || charTwo.isUpperCase()) {
match = charSequence[charPosition].equals(charOne, ignoreCase = false) &&
charSequence[charPosition + 1].equals(charTwo, ignoreCase = false)
}
}
return match
}
}
private enum class RepeatDirection(val symb: String) {
IDENTICAL(";") {
override fun map(direction: Direction): Direction = direction
},
REVERSE(",") {
override fun map(direction: Direction): Direction = when (direction) {
Direction.FORWARD -> Direction.BACKWARD
Direction.BACKWARD -> Direction.FORWARD
}
};
abstract fun map(direction: Direction): Direction
}
private class HighlightHandler {
private var editor: Editor? = null
private val sneakHighlighters: MutableSet<RangeHighlighter> = mutableSetOf()
fun highlightSneakRange(editor: Editor, range: TextRange) {
clearAllSneakHighlighters()
this.editor = editor
val project = editor.project
if (project != null) {
Disposer.register(VimProjectService.getInstance(project)) {
this.editor = null
sneakHighlighters.clear()
}
}
if (range.isMultiple) {
for (i in 0 until range.size()) {
highlightSingleRange(editor, range.startOffsets[i]..range.endOffsets[i])
}
} else {
highlightSingleRange(editor, range.startOffset..range.endOffset)
}
}
fun clearAllSneakHighlighters() {
sneakHighlighters.forEach { highlighter ->
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
}
sneakHighlighters.clear()
}
private fun highlightSingleRange(editor: Editor, range: ClosedRange<Int>) {
val highlighter = editor.markupModel.addRangeHighlighter(
range.start,
range.endInclusive,
HighlighterLayer.SELECTION,
getHighlightTextAttributes(),
HighlighterTargetArea.EXACT_RANGE
)
sneakHighlighters.add(highlighter)
setClearHighlightRangeTimer(highlighter)
}
private fun setClearHighlightRangeTimer(highlighter: RangeHighlighter) {
val timer = Timer(DEFAULT_HIGHLIGHT_DURATION_SNEAK) {
if (editor?.isDisposed != true) {
editor?.markupModel?.removeHighlighter(highlighter)
}
}
timer.isRepeats = false
timer.start()
}
private fun getHighlightTextAttributes() = TextAttributes(
null,
EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES.defaultAttributes.backgroundColor,
editor?.colorsScheme?.getColor(EditorColors.CARET_COLOR),
EffectType.SEARCH_MATCH,
Font.PLAIN
)
}
}
/**
* Map some <Plug>(keys) command to given handler
* and create mapping to <Plug>(prefix)[keys]
*/
private fun VimExtension.mapToFunctionAndProvideKeys(
keys: String, handler: ExtensionHandler, mappingModes: EnumSet<MappingMode>
) {
VimExtensionFacade.putExtensionHandlerMapping(
mappingModes,
injector.parser.parseKeys(command(keys)),
owner,
handler,
false
)
VimExtensionFacade.putExtensionHandlerMapping(
mappingModes,
injector.parser.parseKeys(commandFromOriginalPlugin(keys)),
owner,
handler,
false
)
// This is a combination to meet the following requirements:
// - Now we should support mappings from sneak `Sneak_s` and mappings from the previous version of the plugin `(sneak-s)`
// - The shortcut should not be registered if any of these mappings is overridden in .ideavimrc
// - The shortcut should not be registered if some other shortcut for this key exists
val fromKeys = injector.parser.parseKeys(keys)
val filteredModes = mappingModes.filterNotTo(HashSet()) {
VimPlugin.getKey().hasmapto(it, injector.parser.parseKeys(command(keys)))
}
val filteredModes2 = mappingModes.filterNotTo(HashSet()) {
VimPlugin.getKey().hasmapto(it, injector.parser.parseKeys(commandFromOriginalPlugin(keys)))
}
val filteredFromModes = mappingModes.filterNotTo(HashSet()) {
injector.keyGroup.hasmapfrom(it, fromKeys)
}
val doubleFiltered = mappingModes
.filter { it in filteredModes2 && it in filteredModes && it in filteredFromModes }
.toSet()
putKeyMapping(doubleFiltered, fromKeys, owner, injector.parser.parseKeys(command(keys)), true)
putKeyMapping(
doubleFiltered,
fromKeys,
owner,
injector.parser.parseKeys(commandFromOriginalPlugin(keys)),
true
)
}
private fun command(keys: String) = "<Plug>(sneak-$keys)"
private fun commandFromOriginalPlugin(keys: String) = "<Plug>Sneak_$keys"

View File

@@ -7,6 +7,7 @@
*/
package com.maddyhome.idea.vim.extension.surround
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.editor.Editor
@@ -17,6 +18,7 @@ import com.maddyhome.idea.vim.api.VimChangeGroup
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.endsWithNewLine
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.MappingMode
@@ -24,14 +26,16 @@ import com.maddyhome.idea.vim.command.OperatorArguments
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.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.group.findBlockRange
import com.maddyhome.idea.vim.helper.runWithEveryCaretAndRestore
import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.IjVimCaret
@@ -42,7 +46,6 @@ import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
import com.maddyhome.idea.vim.put.PutData
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.state.mode.selectionType
import org.jetbrains.annotations.NonNls
import java.awt.event.KeyEvent
@@ -78,13 +81,15 @@ internal class VimSurroundExtension : VimExtension {
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("ds"), owner, injector.parser.parseKeys("<Plug>DSurround"), true)
putKeyMappingIfMissing(MappingMode.XO, injector.parser.parseKeys("S"), owner, injector.parser.parseKeys("<Plug>VSurround"), true)
}
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator(supportsMultipleCursors = false, count = 1)) // TODO
}
private class YSurroundHandler : ExtensionHandler {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator(supportsMultipleCursors = false, count = 1)) // TODO
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
}
@@ -96,7 +101,7 @@ internal class VimSurroundExtension : VimExtension {
val ijEditor = editor.ij
val c = getChar(ijEditor)
if (c.code == 0) return
val pair = getOrInputPair(c, ijEditor) ?: return
val pair = getOrInputPair(c, ijEditor, context.ij) ?: return
editor.forEachCaret {
val line = it.getBufferPosition().line
@@ -146,7 +151,7 @@ internal class VimSurroundExtension : VimExtension {
val charTo = getChar(editor.ij)
if (charTo.code == 0) return
val newSurround = getOrInputPair(charTo, editor.ij) ?: return
val newSurround = getOrInputPair(charTo, editor.ij, context.ij) ?: return
runWriteAction { change(editor, context, charFrom, newSurround) }
}
@@ -223,12 +228,12 @@ internal class VimSurroundExtension : VimExtension {
val searchHelper = injector.searchHelper
return when (char) {
't' -> searchHelper.findBlockTagRange(editor, caret, 1, true)
'(', ')', 'b' -> searchHelper.findBlockRange(editor, caret, '(', 1, true)
'[', ']' -> searchHelper.findBlockRange(editor, caret, '[', 1, true)
'{', '}', 'B' -> searchHelper.findBlockRange(editor, caret, '{', 1, true)
'<', '>' -> searchHelper.findBlockRange(editor, caret, '<', 1, true)
'(', ')', 'b' -> findBlockRange(editor, caret, '(', 1, true)
'[', ']' -> findBlockRange(editor, caret, '[', 1, true)
'{', '}', 'B' -> findBlockRange(editor, caret, '{', 1, true)
'<', '>' -> findBlockRange(editor, caret, '<', 1, true)
'`', '\'', '"' -> {
val caretOffset = caret.offset.point
val caretOffset = caret.offset
val text = editor.text()
if (text.getOrNull(caretOffset - 1) == char && text.getOrNull(caretOffset) == char) {
TextRange(caretOffset - 1, caretOffset + 1)
@@ -265,23 +270,23 @@ internal class VimSurroundExtension : VimExtension {
private class Operator(private val supportsMultipleCursors: Boolean, private val count: Int) : OperatorFunction {
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
val editor = vimEditor.ij
val c = getChar(editor)
val ijEditor = vimEditor.ij
val c = getChar(ijEditor)
if (c.code == 0) return true
val pair = getOrInputPair(c, editor) ?: return false
val pair = getOrInputPair(c, ijEditor, context.ij) ?: return false
runWriteAction {
val change = VimPlugin.getChange()
if (supportsMultipleCursors) {
editor.runWithEveryCaretAndRestore {
applyOnce(editor, change, pair, count)
ijEditor.runWithEveryCaretAndRestore {
applyOnce(ijEditor, change, pair, count)
}
}
else {
applyOnce(editor, change, pair, count)
applyOnce(ijEditor, change, pair, count)
// Jump back to start
executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
executeNormalWithoutMapping(injector.parser.parseKeys("`["), ijEditor)
}
}
return true
@@ -315,7 +320,9 @@ private val LOG = logger<VimSurroundExtension>()
private const val REGISTER = '"'
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
private const val OPERATOR_FUNC = "SurroundOperatorFunc"
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
private val SURROUND_PAIRS = mapOf(
'b' to ("(" to ")"),
@@ -341,8 +348,8 @@ private fun getSurroundPair(c: Char): Pair<String, String>? = if (c in SURROUND_
null
}
private fun inputTagPair(editor: Editor): Pair<String, String>? {
val tagInput = inputString(editor, "<", '>')
private fun inputTagPair(editor: Editor, context: DataContext): Pair<String, String>? {
val tagInput = inputString(editor, context, "<", '>')
val matcher = tagNameAndAttributesCapturePattern.matcher(tagInput)
return if (matcher.find()) {
val tagName = matcher.group(1)
@@ -355,17 +362,18 @@ private fun inputTagPair(editor: Editor): Pair<String, String>? {
private fun inputFunctionName(
editor: Editor,
context: DataContext,
withInternalSpaces: Boolean,
): Pair<String, String>? {
val functionNameInput = inputString(editor, "function: ", null)
val functionNameInput = inputString(editor, context, "function: ", null)
if (functionNameInput.isEmpty()) return null
return if (withInternalSpaces) "$functionNameInput( " to " )" else "$functionNameInput(" to ")"
}
private fun getOrInputPair(c: Char, editor: Editor): Pair<String, String>? = when (c) {
'<', 't' -> inputTagPair(editor)
'f' -> inputFunctionName(editor, false)
'F' -> inputFunctionName(editor, true)
private fun getOrInputPair(c: Char, editor: Editor, context: DataContext): Pair<String, String>? = when (c) {
'<', 't' -> inputTagPair(editor, context)
'f' -> inputFunctionName(editor, context, false)
'F' -> inputFunctionName(editor, context, true)
else -> getSurroundPair(c)
}

View File

@@ -138,7 +138,7 @@ public class VimTextObjEntireExtension implements VimExtension {
final EntireTextObjectHandler textObjectHandler = new EntireTextObjectHandler(ignoreLeadingAndTrailing);
//noinspection DuplicatedCode
if (!vimStateMachine.isOperatorPending()) {
if (!vimStateMachine.isOperatorPending(editor.getMode())) {
((IjVimEditor) editor).getEditor().getCaretModel().runForEachCaret((Caret caret) -> {
final TextRange range = textObjectHandler.getRange(editor, new IjVimCaret(caret), context, count, 0);
if (range != null) {

View File

@@ -131,10 +131,11 @@ public class VimIndentObject implements VimExtension {
// This is done as a separate step so that it works even when the caret is inside the indentation.
int offset = caretLineStartOffset;
int indentSize = 0;
while (++offset < charSequence.length()) {
while (offset < charSequence.length()) {
final char ch = charSequence.charAt(offset);
if (ch == ' ' || ch == '\t') {
++indentSize;
++offset;
} else {
break;
}
@@ -267,7 +268,7 @@ public class VimIndentObject implements VimExtension {
final IndentObjectHandler textObjectHandler = new IndentObjectHandler(includeAbove, includeBelow);
if (!vimStateMachine.isOperatorPending()) {
if (!vimStateMachine.isOperatorPending(editor.getMode())) {
((IjVimEditor)editor).getEditor().getCaretModel().runForEachCaret((Caret caret) -> {
final TextRange range = textObjectHandler.getRange(vimEditor, new IjVimCaret(caret), context, count, 0);
if (range != null) {

View File

@@ -68,10 +68,11 @@ import com.maddyhome.idea.vim.newapi.IjEditorExecutionContext
import com.maddyhome.idea.vim.newapi.IjVimCaret
import com.maddyhome.idea.vim.newapi.IjVimEditor
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.regexp.VimRegex
import com.maddyhome.idea.vim.regexp.match.VimMatchResult
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.vimscript.model.commands.SortOption
import org.jetbrains.annotations.TestOnly
import java.math.BigInteger
@@ -196,7 +197,7 @@ public class ChangeGroup : VimChangeGroupBase() {
val allowWrap = injector.options(editor).whichwrap.contains("~")
var motion = injector.motion.getHorizontalMotion(editor, caret, count, true, allowWrap)
if (motion is Motion.Error) return false
changeCase(editor, caret, caret.offset.point, (motion as AbsoluteOffset).offset, CharacterHelper.CASE_TOGGLE)
changeCase(editor, caret, caret.offset, (motion as AbsoluteOffset).offset, CharacterHelper.CASE_TOGGLE)
motion = injector.motion.getHorizontalMotion(
editor,
caret,
@@ -234,8 +235,7 @@ public class ChangeGroup : VimChangeGroupBase() {
}
val lineLength = editor.lineLength(line)
if (column < VimMotionGroupBase.LAST_COLUMN && lineLength < column) {
val pad =
EditorHelper.pad((editor as IjVimEditor).editor, (context as IjEditorExecutionContext).context, line, column)
val pad = EditorHelper.pad((editor as IjVimEditor).editor, line, column)
val offset = editor.getLineEndOffset(line)
insertText(editor, caret, offset, pad)
}
@@ -394,7 +394,7 @@ public class ChangeGroup : VimChangeGroupBase() {
context: ExecutionContext,
range: TextRange,
) {
val startPos = editor.offsetToBufferPosition(caret.offset.point)
val startPos = editor.offsetToBufferPosition(caret.offset)
val startOffset = editor.getLineStartForOffset(range.startOffset)
val endOffset = editor.getLineEndForOffset(range.endOffset)
val ijEditor = (editor as IjVimEditor).editor
@@ -450,7 +450,7 @@ public class ChangeGroup : VimChangeGroupBase() {
dir: Int,
operatorArguments: OperatorArguments,
) {
val start = caret.offset.point
val start = caret.offset
val end = injector.motion.moveCaretToRelativeLineEnd(editor, caret, lines - 1, true)
indentRange(editor, caret, context, TextRange(start, end), 1, dir, operatorArguments)
}
@@ -484,7 +484,7 @@ public class ChangeGroup : VimChangeGroupBase() {
// Remember the current caret column
val intendedColumn = caret.vimLastColumn
val indentConfig = create((editor as IjVimEditor).editor, (context as IjEditorExecutionContext).context)
val indentConfig = create((editor as IjVimEditor).editor)
val sline = editor.offsetToBufferPosition(range.startOffset).line
val endLogicalPosition = editor.offsetToBufferPosition(range.endOffset)
val eline = if (endLogicalPosition.column == 0) max((endLogicalPosition.line - 1).toDouble(), 0.0)
@@ -531,7 +531,7 @@ public class ChangeGroup : VimChangeGroupBase() {
val soff = editor.getLineStartOffset(l)
val eoff = editor.getLineEndOffset(l, true)
val woff = injector.motion.moveCaretToLineStartSkipLeading(editor, l)
val col = editor.offsetToVisualPosition(woff).column
val col = editor.offsetToBufferPosition(woff).column
val limit = max(0.0, (col + dir * indentConfig.getTotalIndent(count)).toDouble())
.toInt()
if (col > 0 || soff != eoff) {
@@ -567,54 +567,68 @@ public class ChangeGroup : VimChangeGroupBase() {
): Boolean {
val startLine = range.startLine
val endLine = range.endLine
val count = endLine - startLine + 1
val count = range.size
if (count < 2) {
return false
}
val startOffset = editor.getLineStartOffset(startLine)
val endOffset = editor.getLineEndOffset(endLine)
return sortTextRange(editor, caret, startOffset, endOffset, lineComparator, sortOptions)
}
/**
* Sorts a text range with a comparator. Returns true if a replace was performed, false otherwise.
*
* @param editor The editor to replace text in
* @param start The starting position for the sort
* @param end The ending position for the sort
* @param lineComparator The comparator to use to sort
* @param sortOption The option to sort the range
* @return true if able to sort the text, false if not
*/
private fun sortTextRange(
editor: VimEditor,
caret: VimCaret,
start: Int,
end: Int,
lineComparator: Comparator<String>,
sortOption: SortOption,
): Boolean {
val selectedText = (editor as IjVimEditor).editor.document.getText(TextRangeInterval(start, end))
val lines: MutableList<String> = selectedText.split("\n").sortedWith(lineComparator).toMutableList()
if (sortOption.unique) {
val iterator = lines.iterator()
val selectedText = (editor as IjVimEditor).editor.document.getText(TextRangeInterval(startOffset, endOffset))
val lines = selectedText.split("\n")
val modifiedLines = sortOptions.pattern?.let {
if (sortOptions.sortOnPattern) {
extractPatternFromLines(editor, lines, startLine, it)
} else {
deletePatternFromLines(editor, lines, startLine, it)
}
} ?: lines
val sortedLines = lines.zip(modifiedLines)
.sortedWith { l1, l2 -> lineComparator.compare(l1.second, l2.second) }
.map {it.first}
.toMutableList()
if (sortOptions.unique) {
val iterator = sortedLines.iterator()
var previous: String? = null
while (iterator.hasNext()) {
val current = iterator.next()
if (current == previous || sortOption.ignoreCase && current.equals(previous, ignoreCase = true)) {
if (current == previous || sortOptions.ignoreCase && current.equals(previous, ignoreCase = true)) {
iterator.remove()
} else {
previous = current
}
}
}
if (lines.size < 1) {
if (sortedLines.isEmpty()) {
return false
}
replaceText(editor, caret, start, end, StringUtil.join(lines, "\n"))
replaceText(editor, caret, startOffset, endOffset, StringUtil.join(sortedLines, "\n"))
return true
}
private fun extractPatternFromLines(editor: VimEditor, lines: List<String>, startLine: Int, pattern: String): List<String> {
val regex = VimRegex(pattern)
return lines.mapIndexed { i: Int, line: String ->
val result = regex.findInLine(editor, startLine + i, 0)
when (result) {
is VimMatchResult.Success -> result.value
is VimMatchResult.Failure -> line
}
}
}
private fun deletePatternFromLines(editor: VimEditor, lines: List<String>, startLine: Int, pattern: String): List<String> {
val regex = VimRegex(pattern)
return lines.mapIndexed { i: Int, line: String ->
val result = regex.findInLine(editor, startLine + i, 0)
when (result) {
is VimMatchResult.Success -> line.substring(result.value.length, line.length)
is VimMatchResult.Failure -> line
}
}
}
/**
* Perform increment and decrement for numbers in visual mode
*

View File

@@ -8,9 +8,11 @@
package com.maddyhome.idea.vim.group
import com.intellij.openapi.components.Service
import com.maddyhome.idea.vim.api.VimCommandGroupBase
/**
* @author Elliot Courant
*/
@Service
internal class CommandGroup : VimCommandGroupBase()

View File

@@ -11,6 +11,9 @@ package com.maddyhome.idea.vim.group;
import com.intellij.execution.impl.ConsoleViewImpl;
import com.intellij.find.EditorSearchSession;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.client.ClientAppSession;
import com.intellij.openapi.client.ClientKind;
import com.intellij.openapi.client.ClientSessionsManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
@@ -22,7 +25,10 @@ import com.intellij.openapi.project.Project;
import com.maddyhome.idea.vim.KeyHandler;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.api.*;
import com.maddyhome.idea.vim.helper.*;
import com.maddyhome.idea.vim.helper.CaretVisualAttributesHelperKt;
import com.maddyhome.idea.vim.helper.CommandStateHelper;
import com.maddyhome.idea.vim.helper.EditorHelper;
import com.maddyhome.idea.vim.helper.UserDataManager;
import com.maddyhome.idea.vim.newapi.IjVimDocument;
import com.maddyhome.idea.vim.newapi.IjVimEditor;
import com.maddyhome.idea.vim.options.EffectiveOptionValueChangeListener;
@@ -33,11 +39,12 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.intellij.openapi.editor.EditorSettings.*;
import static com.maddyhome.idea.vim.api.VimInjectorKt.injector;
import static com.maddyhome.idea.vim.api.VimInjectorKt.options;
import static com.maddyhome.idea.vim.helper.CaretVisualAttributesHelperKt.updateCaretsVisualAttributes;
import static com.maddyhome.idea.vim.newapi.IjVimInjectorKt.ijOptions;
/**
@@ -49,12 +56,31 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
private Boolean isKeyRepeat = null;
// TODO: Get rid of this custom line converter once we support soft wraps properly
// The builtin relative line converter looks like it's using Vim's logical lines for counting, where a Vim logical
// line is a buffer line, or a single line representing a fold of several buffer lines. This converter is counting
// screen lines (but badly - if you're on the second line of a wrapped line, it still counts like you're on the first.
// We really want to use Vim logical lines, but we don't currently support them for movement - we move by screen line.
private final CaretListener myLineNumbersCaretListener = new CaretListener() {
@Override
public void caretPositionChanged(@NotNull CaretEvent e) {
final boolean requiresRepaint = e.getNewPosition().line != e.getOldPosition().line;
if (requiresRepaint && options(injector, new IjVimEditor(e.getEditor())).getRelativenumber()) {
repaintRelativeLineNumbers(e.getEditor());
// We don't get notified when the IDE's settings change, so make sure we're up-to-date when the caret moves
final Editor editor = e.getEditor();
boolean relativenumber = ijOptions(injector, new IjVimEditor(editor)).getRelativenumber();
if (relativenumber) {
if (!hasRelativeLineNumbersInstalled(editor)) {
installRelativeLineNumbers(editor);
}
else {
// We must repaint on each caret move, so we update when caret's visual line doesn't match logical line
repaintRelativeLineNumbers(editor);
}
}
else {
if (hasRelativeLineNumbersInstalled(editor)) {
removeRelativeLineNumbers(editor);
}
}
}
};
@@ -67,11 +93,10 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
editor.getCaretModel().addCaretListener(myLineNumbersCaretListener);
UserDataManager.setVimEditorGroup(editor, true);
UserDataManager.setVimLineNumbersInitialState(editor, editor.getSettings().isLineNumbersShown());
updateLineNumbers(editor);
}
private void deinitLineNumbers(@NotNull Editor editor, boolean isReleasing) {
private void deinitLineNumbers(@NotNull Editor editor) {
if (isProjectDisposed(editor) || !supportsVimLineNumbers(editor) || !UserDataManager.getVimEditorGroup(editor)) {
return;
}
@@ -80,14 +105,6 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
UserDataManager.setVimEditorGroup(editor, false);
removeRelativeLineNumbers(editor);
// Don't reset the built in line numbers if we're releasing the editor. If we do, EditorSettings.setLineNumbersShown
// can cause the editor to refresh settings and can call into FileManagerImpl.getCachedPsiFile AFTER FileManagerImpl
// has been disposed (Closing the project with a Find Usages result showing a preview panel is a good repro case).
// See IDEA-184351 and VIM-1671
if (!isReleasing) {
setBuiltinLineNumbers(editor, UserDataManager.getVimLineNumbersInitialState(editor));
}
}
private static boolean supportsVimLineNumbers(final @NotNull Editor editor) {
@@ -101,41 +118,22 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
}
private static void updateLineNumbers(final @NotNull Editor editor) {
final EffectiveOptions options = options(injector, new IjVimEditor(editor));
final boolean relativeNumber = options.getRelativenumber();
final boolean number = options.getNumber();
final boolean showBuiltinEditorLineNumbers = shouldShowBuiltinLineNumbers(editor, number, relativeNumber);
final EditorSettings settings = editor.getSettings();
if (settings.isLineNumbersShown() ^ showBuiltinEditorLineNumbers) {
// Update line numbers later since it may be called from a caret listener
// on the caret move and it may move the caret internally
ApplicationManager.getApplication().invokeLater(() -> {
if (editor.isDisposed()) return;
setBuiltinLineNumbers(editor, showBuiltinEditorLineNumbers);
});
final boolean isLineNumbersShown = editor.getSettings().isLineNumbersShown();
if (!isLineNumbersShown) {
return;
}
if (relativeNumber) {
final LineNumerationType lineNumerationType = editor.getSettings().getLineNumerationType();
if (lineNumerationType == LineNumerationType.RELATIVE || lineNumerationType == LineNumerationType.HYBRID) {
if (!hasRelativeLineNumbersInstalled(editor)) {
installRelativeLineNumbers(editor);
}
}
else if (hasRelativeLineNumbersInstalled(editor)) {
else {
removeRelativeLineNumbers(editor);
}
}
private static boolean shouldShowBuiltinLineNumbers(final @NotNull Editor editor, boolean number, boolean relativeNumber) {
final boolean initialState = UserDataManager.getVimLineNumbersInitialState(editor);
return initialState || number || relativeNumber;
}
private static void setBuiltinLineNumbers(final @NotNull Editor editor, boolean show) {
editor.getSettings().setLineNumbersShown(show);
}
private static boolean hasRelativeLineNumbersInstalled(final @NotNull Editor editor) {
return UserDataManager.getVimHasRelativeLineNumbersInstalled(editor);
}
@@ -204,7 +202,8 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
}
public void editorCreated(@NotNull Editor editor) {
DocumentManager.INSTANCE.addListeners(editor.getDocument());
UserDataManager.setVimInitialised(editor, true);
VimPlugin.getKey().registerRequiredShortcutKeys(new IjVimEditor(editor));
initLineNumbers(editor);
@@ -228,7 +227,7 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
// Note that we need a similar check in `VimEditor.isWritable` to allow Escape to work to exit insert mode. We need
// to know that a read-only editor that is hosting a console view with a running process can be treated as writable.
Runnable switchToInsertMode = () -> {
ExecutionContext.Editor context = injector.getExecutionContextManager().onEditor(new IjVimEditor(editor), null);
ExecutionContext context = injector.getExecutionContextManager().getEditorExecutionContext(new IjVimEditor(editor));
VimPlugin.getChange().insertBeforeCursor(new IjVimEditor(editor), context);
KeyHandler.getInstance().reset(new IjVimEditor(editor));
};
@@ -246,14 +245,13 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
switchToInsertMode.run();
}
});
updateCaretsVisualAttributes(editor);
updateCaretsVisualAttributes(new IjVimEditor(editor));
}
public void editorDeinit(@NotNull Editor editor, boolean isReleased) {
deinitLineNumbers(editor, isReleased);
public void editorDeinit(@NotNull Editor editor) {
deinitLineNumbers(editor);
UserDataManager.unInitializeEditor(editor);
VimPlugin.getKey().unregisterShortcutKeys(new IjVimEditor(editor));
DocumentManager.INSTANCE.removeListeners(editor.getDocument());
CaretVisualAttributesHelperKt.removeCaretsVisualAttributes(editor);
}
@@ -284,6 +282,18 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
notifyIdeaJoin(((IjVimEditor) editor).getEditor().getProject(), editor);
}
@Override
public void updateCaretsVisualAttributes(@NotNull VimEditor editor) {
Editor ijEditor = ((IjVimEditor) editor).getEditor();
CaretVisualAttributesHelperKt.updateCaretsVisualAttributes(ijEditor);
}
@Override
public void updateCaretsVisualPosition(@NotNull VimEditor editor) {
Editor ijEditor = ((IjVimEditor) editor).getEditor();
CaretVisualAttributesHelperKt.updateCaretsVisualAttributes(ijEditor);
}
public static class NumberChangeListener implements EffectiveOptionValueChangeListener {
public static NumberChangeListener INSTANCE = new NumberChangeListener();
@@ -304,17 +314,18 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
private static class RelativeLineNumberConverter implements LineNumberConverter {
@Override
public Integer convert(@NotNull Editor editor, int lineNumber) {
final boolean number = options(injector, new IjVimEditor(editor)).getNumber();
final IjVimEditor ijVimEditor = new IjVimEditor(editor);
final boolean number = ijOptions(injector, ijVimEditor).getNumber();
final int caretLine = editor.getCaretModel().getLogicalPosition().line;
// lineNumber is 1 based
if (number && (lineNumber - 1) == caretLine) {
return lineNumber;
if ((lineNumber - 1) == caretLine) {
return number ? lineNumber : 0;
}
else {
final int visualLine = new IjVimEditor(editor).bufferLineToVisualLine(lineNumber - 1);
final int currentVisualLine = new IjVimEditor(editor).bufferLineToVisualLine(caretLine);
return Math.abs(currentVisualLine - visualLine);
final int visualLine = ijVimEditor.bufferLineToVisualLine(lineNumber - 1);
final int caretVisualLine = editor.getCaretModel().getVisualPosition().line;
return Math.abs(caretVisualLine - visualLine);
}
}
@@ -324,20 +335,51 @@ public class EditorGroup implements PersistentStateComponent<Element>, VimEditor
}
}
@NotNull
@Override
public Collection<VimEditor> localEditors() {
return HelperKt.localEditors().stream()
public @NotNull Collection<VimEditor> getEditorsRaw() {
return getLocalEditors()
.map(IjVimEditor::new)
.collect(Collectors.toList());
}
@NotNull
@Override
public Collection<VimEditor> localEditors(@NotNull VimDocument buffer) {
final Document document = ((IjVimDocument)buffer).getDocument();
return HelperKt.localEditors(document).stream()
public Collection<VimEditor> getEditors() {
return getLocalEditors()
.filter(UserDataManager::getVimInitialised)
.map(IjVimEditor::new)
.collect(Collectors.toList());
}
@NotNull
@Override
public Collection<VimEditor> getEditors(@NotNull VimDocument buffer) {
final Document document = ((IjVimDocument)buffer).getDocument();
return getLocalEditors()
.filter(editor -> UserDataManager.getVimInitialised(editor) && editor.getDocument().equals(document))
.map(IjVimEditor::new)
.collect(Collectors.toList());
}
private Stream<Editor> getLocalEditors() {
// Always fetch local editors. If we're hosting a Code With Me session, any connected guests will create hidden
// editors to handle syntax highlighting, completion requests, etc. We need to make sure that IdeaVim only makes
// changes (e.g., adding search highlights) to local editors so things don't incorrectly flow through to any Clients.
// In non-CWM scenarios, or if IdeaVim is installed on the Client, there are only ever local editors, so this will
// also work there. In Gateway remote development scenarios, IdeaVim should not be installed on the host, only the
// Client, so all should work there too.
// Note that most IdeaVim operations are in response to interactive keystrokes, which would mean that
// ClientEditorManager.getCurrentInstance would return local editors. However, some operations are in response to
// events such as document change (to update search highlights), and these can come from CWM guests, and we'd get
// the remote editors.
// This invocation will always get local editors, regardless of the current context.
List<ClientAppSession> appSessions = ClientSessionsManager.getAppSessions(ClientKind.ALL);
if (!appSessions.isEmpty()) {
ClientAppSession localSession = appSessions.get(0);
return localSession.getService(ClientEditorManager.class).editors();
}
else {
return Stream.empty();
}
}
}

View File

@@ -22,16 +22,17 @@ import com.intellij.openapi.fileEditor.impl.EditorsSplitters;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.search.FilenameIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.ProjectScope;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.api.*;
import com.maddyhome.idea.vim.state.mode.Mode;
import com.maddyhome.idea.vim.state.VimStateMachine;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.helper.EditorHelper;
import com.maddyhome.idea.vim.helper.EditorHelperRt;
@@ -40,10 +41,13 @@ import com.maddyhome.idea.vim.helper.SearchHelper;
import com.maddyhome.idea.vim.newapi.ExecuteExtensionKt;
import com.maddyhome.idea.vim.newapi.IjEditorExecutionContext;
import com.maddyhome.idea.vim.newapi.IjVimEditor;
import com.maddyhome.idea.vim.state.VimStateMachine;
import com.maddyhome.idea.vim.state.mode.Mode;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import static com.maddyhome.idea.vim.api.VimInjectorKt.injector;
@@ -438,14 +442,35 @@ public class FileGroup extends VimFileBase {
private static final @NotNull Logger logger = Logger.getInstance(FileGroup.class.getName());
/**
* This method listens for editor tab changes so any insert/replace modes that need to be reset can be.
* Respond to editor tab selection and remember the last used tab
*/
public static void fileEditorManagerSelectionChangedCallback(@NotNull FileEditorManagerEvent event) {
// The user has changed the editor they are working with - exit insert/replace mode, and complete any
// appropriate repeat
if (event.getOldFile() != null) {
LastTabService.getInstance(event.getManager().getProject()).setLastTab(event.getOldFile());
}
}
}
@Nullable
@Override
public VimEditor selectEditor(@NotNull String projectId, @NotNull String documentPath, @Nullable String protocol) {
VirtualFileSystem fileSystem = VirtualFileManager.getInstance().getFileSystem(protocol);
if (fileSystem == null) return null;
VirtualFile virtualFile = fileSystem.findFileByPath(documentPath);
if (virtualFile == null) return null;
Project project = Arrays.stream(ProjectManager.getInstance().getOpenProjects())
.filter(p -> injector.getFile().getProjectId(p).equals(projectId))
.findFirst().orElseThrow();
Editor editor = selectEditor(project, virtualFile);
if (editor == null) return null;
return new IjVimEditor(editor);
}
@NotNull
@Override
public String getProjectId(@NotNull Object project) {
if (!(project instanceof Project)) throw new IllegalArgumentException();
return ((Project) project).getName();
}
}

View File

@@ -20,7 +20,6 @@ import com.maddyhome.idea.vim.options.OptionAccessScope
*/
@Suppress("SpellCheckingInspection")
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
public var ide: String by optionProperty(IjOptions.ide)
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
@@ -29,15 +28,15 @@ public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesB
public val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
public var colorfulmodewidget: Boolean by optionProperty(IjOptions.colorfulmodewidget)
// Temporary options to control work-in-progress behaviour
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
public var useNewRegex: Boolean by optionProperty(IjOptions.useNewRegex)
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
}
/**
@@ -46,6 +45,18 @@ public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesB
* As a convenience, this class also provides access to the IntelliJ specific global options, via inheritance.
*/
public class EffectiveIjOptions(scope: OptionAccessScope.EFFECTIVE): GlobalIjOptions(scope) {
// Vim options that are implemented purely by existing IntelliJ features and not used by vim-engine
public var breakindent: Boolean by optionProperty(IjOptions.breakindent)
public val colorcolumn: StringListOptionValue by optionProperty(IjOptions.colorcolumn)
public var cursorline: Boolean by optionProperty(IjOptions.cursorline)
public var fileformat: String by optionProperty(IjOptions.fileformat)
public var list: Boolean by optionProperty(IjOptions.list)
public var number: Boolean by optionProperty(IjOptions.number)
public var relativenumber: Boolean by optionProperty(IjOptions.relativenumber)
public var textwidth: Int by optionProperty(IjOptions.textwidth)
public var wrap: Boolean by optionProperty(IjOptions.wrap)
// IntelliJ specific options
public var ideacopypreprocess: Boolean by optionProperty(IjOptions.ideacopypreprocess)
public var ideajoin: Boolean by optionProperty(IjOptions.ideajoin)
public var idearefactormode: String by optionProperty(IjOptions.idearefactormode)

Some files were not shown because too many files have changed in this diff Show More