1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-10-15 13:12:01 +02:00
Commit Graph

5461 Commits

Author SHA1 Message Date
Alex Plate
ec11c2ec70 Update status bar menu links with a sign that shows that this is an external link
Because of some encoding issues, I had to embed the string right in the code
2025-09-02 11:25:55 +03:00
Alex Plate
1e98fe2bed Add link to IdeaVim documentation in the status bar menu 2025-09-02 11:22:10 +03:00
Alex Plate
c6adc48e81 [API] Make option() function return a value
This allows users to easily retrieve values from option scope:
val x = option { get<Int>("history") }

- Changed option() signature from Unit to generic T return type
- Updated VimApiImpl implementation to return the lambda result
- Added test demonstrating the new return value capability
2025-08-29 18:11:26 +03:00
Alex Plate
907495df4d [API] Refactor OptionScope from abstract class to interface
- Convert OptionScope from abstract class to interface
- Extract inline functions with reified types as extension functions
- Make getOptionValue() and setOption() public interface methods
- Remove internal modifier layer functions
- Update OptionScopeImpl to implement new interface
- Add documentation recommending extension function usage
- Update test imports to use new extension functions
2025-08-29 18:11:25 +03:00
Alex Plate
2b276d316f [API] Add append(), prepend(), and remove() extension functions for list options
- append(): adds values to end of comma-separated list (like Vim's +=)
- prepend(): adds values to beginning of list (like Vim's ^=)
- remove(): removes values from list (like Vim's -=)
- All functions prevent duplicate values from being added
- Comprehensive test coverage for all scenarios
2025-08-29 18:11:25 +03:00
Alex Plate
4f1982d6bd [API] Add toggle() function to OptionScope for boolean options
Adds a simple toggle() function that flips boolean option values.
Works with both full option names and abbreviations.

Example usage:
  toggle("ignorecase")  // true → false, false → true
  toggle("ic")          // works with abbreviations
2025-08-29 18:11:25 +03:00
Alex Plate
a235648672 [API] Add split() extension function to OptionScope for comma-separated values
Adds a concise String.split() extension function within OptionScope that splits
comma-separated option values into lists. This simplifies working with list-type
options like 'virtualedit', 'whichwrap', etc.

Example usage:
  val values = get<String>("virtualedit")?.split() ?: emptyList()
  // "block,all" → ["block", "all"]
2025-08-29 18:11:25 +03:00
Alex Plate
85d5da4ab6 [API] Add comprehensive tests for OptionScope API
Added extensive test coverage for the OptionScope API including:
- String list options with various formats (single, multiple, empty values)
- Error handling for invalid values, empty names, and type mismatches
- Boundary conditions for integer options
- Boolean/integer type conversions
- Global vs local option scoping
- Option abbreviations
- Edge cases like trailing/leading commas and very long strings
2025-08-29 18:11:24 +03:00
Xinhe Wang
511da14b83 Support disabling extended NERDTree without restarting 2025-08-29 17:53:46 +03:00
Xinhe Wang
636fe0a76f Make extended NERDTree a separate VimExtension 2025-08-29 17:53:46 +03:00
Xinhe Wang
2b5342a935 Add support for ActivateNode in NERDTree Everywhere 2025-08-29 17:53:46 +03:00
Xinhe Wang
758aaf276a Extend NERDTree support to Tree components other than Project 2025-08-29 17:53:46 +03:00
Alex Plate
df82794f4f Fixed a missing | 2025-08-29 14:31:44 +03:00
Alex Plate
2d378327e7 Fix tests after bringing back the old ReplaceWithRegister 2025-08-29 14:00:24 +03:00
Alex Plate
0e37295988 Ignore some test for neovim 2025-08-29 13:55:27 +03:00
Alex Plate
0d342ea6c3 Disable the new ReplaceWithRegister test as it's flaky 2025-08-29 13:45:06 +03:00
Alex Plate
e343da03a1 Bring back the old implementation of the replace with register
The new implementation is now named ReplaceWithRegisterNew
2025-08-29 13:44:26 +03:00
Xinhe Wang
b593d079c4 Correct the behavior of NERDTree-P to jump to the root node
It cannot be guaranteed that the tree has a single visible root.
2025-08-26 14:04:15 +01:00
Xinhe Wang
cfbb77f1db Fix(VIM-3981): make :set noNERDTree work
Please note that the ex-commands will still not be unregistered
2025-08-26 14:04:15 +01:00
Xinhe Wang
c6fc1046ee Extract helper functions in NerdTree.Util to the global scope
This is necessary because I would like to use `registerMappings` in
the constructor of `NerdDispatcher` where we have no access to
private methods of `NerdTree`.

Also, `callAction` is moved into `nerdtree.Mappings.Action` and
duplicated `addCommand` is removed.
2025-08-26 14:04:15 +01:00
Xinhe Wang
007d636310 Clear NERDTree's KeyStroke buffer after <ESC> is pressed
The user may have pressed `g` accidentally and wish to perform an
operation which is not prefix by `g`.

This gives the user a way to clear the keys entered previously and
matches Vim's behavior.
2025-08-26 14:04:15 +01:00
Xinhe Wang
8d2d3a21a3 Move update from NerdDispatcher to its abstract class
To make it reusable in the incoming extended NERDTree.

Note that this commit itself does not change any behavior.
2025-08-26 14:04:15 +01:00
Xinhe Wang
175bae51a1 Initiate SpeedSearch right after / is pressed in NERDTree
What we can benefit from this approach:

- User perspective

  The SpeedSearch input will pop up immediately to indicate that
  `/` has been pressed, and search text can then be entered to
  filter the tree nodes.

- Codebase perspective

  The `waitForSearch` property can be removed from the Dispatcher
  objects, and we can get rid of `ToolWindowManagerListener` and
  the concurrency issue in it. This keeps code simple and readable.

  In my previous attempt to preserve the `waitForSearch` prop, the
  Dispatcher object had to be passed to each action impl as an
  argument.
2025-08-26 14:04:15 +01:00
Alex Plate
186db70a22 [API] Specify and cleanup the error handling in the option scope
1) ExException is wrapped with the IllegalArgumentException. We cannot use the raw ExException as it's not defined in the API module. So, if any client will have an access only to the API module, they won't be able to handle this kind of the exception.

2) getOption throws IllegalArgumentException if the type classifier is null. I don't know when this might happen, but this looks more like a plugin developer error. Also, this allows to distinguish the wrong option name vs this type of problem

3) In setOption and getOption throw an exception if there is no such option. This clearly explains what is wrong with this call.

Note: there was a question of using exceptions vs some return values, even like `Result`. The decision falls into the using of exceptions as using the wrong arguments in the plugin is a programming error from the user point of view.
This means, if there is a plugin that checks some option that in reality doesn't exist, it's not a fail of the end user and the end user cannot do anything about that.
Also, using the `Result` will force the plugin developer to handle all possible failure branches, what is quite unnecessary when accessing a well-defined option.
2025-08-22 17:52:51 +03:00
Matt Ellis
1a7b54d0a9 Avoid importing unnecessary helper function 2025-08-22 15:26:26 +03:00
Matt Ellis
4cc3bd2b9f Use return value of Escape action
If none of the IDE Escape handlers do anything, we get Vim's lovely beep
2025-08-22 15:26:26 +03:00
Matt Ellis
ef66a15faf Reuse existing colour when changing caret
Maintains the colour set by Next Edit Suggestions when changing mode

Fixes VIM-4010. Fixes VIM-3455
2025-08-22 15:26:26 +03:00
Matt Ellis
d8a79cb12f Use Vim actions to insert Tab
Previously, we would drop out of VimShortcutKeyAction when hitting Tab in Insert mode. This allowed Emmet to work because ExpandLiveTemplateByTabAction (one of the many actions registered for Tab) would have a chance to handle it.

Now we let Tab actions try to handle the key before Vim does, so we can let Vim handle Tab. In Insert mode, Vim now inserts the tab (or equivalent spaces) by invoking the "EditorTab" action, which is the same as the TabAction handler in the list of actions. Because Vim does this, we can now easily repeat inserting Tab without workarounds, remap `<Tab>` and `<S-Tab>` and Vim will update scroll locations after inserting the text.

Fixes VIM-2331. Fixes JetBrains/ideavim#938. Fixes JetBrains/ideavim#280
2025-08-22 15:26:26 +03:00
Matt Ellis
74a04dd235 Do not expand Live Templates in Normal mode 2025-08-22 15:26:26 +03:00
Matt Ellis
2aaf9badd5 Order IDE actions for Tab before Vim actions
Fixes VIM-4010
2025-08-22 15:26:26 +03:00
Matt Ellis
0950585e13 Fix initialising non-default colorcolumn option
Fixes VIM-3984
2025-08-22 15:25:55 +03:00
Matt Ellis
d850052f20 Fix count accepted as valid in text object
Fixes VIM-3960
2025-08-22 14:17:33 +03:00
Xinhe Wang
629a0f7aab Indicate error when an unrecognized key sequence is entered in NERDTree 2025-08-22 14:16:31 +03:00
Matt Ellis
cb74ff6af2 Fix normalising visual column
Would previously normalise against the entire buffer line length rather than just the current visual line length. For short lines, this would not include inlays, and would therefore position the caret wrong when moving up/down at end of line. For long, wrapped lines, this just plain wouldn't work.

Fixes VIM-3997
2025-08-22 14:15:44 +03:00
Matt Ellis
c9ebc1c4ae Fix calculation of visual column with inlays
Was assuming caret was always on a text character visual column, but could be on an inlay.

Fixes VIM-4007
2025-08-22 14:15:44 +03:00
Alex Plate
aa539e76eb Rename RWLockLabel to VimLockLabel and other annotations
Also, clarify their usage
2025-08-22 11:22:38 +03:00
Alex Plate
2136836877 Merge all configuration files into a single plugin.xml
The way we split plugin.xml was outdated. Also, it started to show errors in highlighting, even there were no errors.
It's better to keep everything in a single file
2025-08-20 09:18:16 +03:00
Alex Plate
63e482408d Fix compilation issues 2025-08-08 18:28:52 +03:00
Alex Plate
9c9cd1b2a0 Bring back the function to set the mode, but in experimental status now 2025-08-08 14:28:01 +03:00
Alex Plate
87f5a6fab3 Remove stub classes
This solution was initially questionable. For a long time it produced nothing but more work on implementing the stubs.
2025-08-08 12:44:30 +03:00
Alex Plate
9d92ae9449 Remove the suspend from functions under the read or write actions
The suspending operations must not be performed under the read or write actions as this will lead to performance issues or freezes.

Also, the current implementation of launching coroutine under the write action is simply incorrect. The coroutine will escape the write action into another thread.
2025-08-08 12:44:30 +03:00
Alex Plate
492bd62166 Rename VimScope to VimApi and move it into a different package
`VimApi` would be a better entry point name. Also, the API term is clearer than the scope.
2025-08-08 12:44:30 +03:00
Alex Plate
fee75001f6 Do not allow to change the mode from the API
The details why we don't want this for now are logged in the code
2025-08-08 12:44:29 +03:00
Alex Plate
df3fb1a8a3 Convert VimScope into the interface 2025-08-08 12:44:29 +03:00
Matt Ellis
e6ed15c772 Fix command line missing due to empty colour
Fixes VIM-3993
2025-08-08 11:57:12 +03:00
Mia Vucinic
3cb5308193 fix failing tests 2025-08-01 16:16:29 +03:00
Mia Vucinic
093769ee7c add file lock to ensure exclusive access 2025-08-01 16:16:29 +03:00
Mia Vucinic
fd58a61685 remove ReplaceWithRegister options from tests
- since enabling and disabling extensions is no longer done using options, options in tests can be removed
2025-08-01 16:16:28 +03:00
Mia Vucinic
562ae63805 fix ReplaceWithRegister test
- remove unnecessary new lines in tests
2025-08-01 16:16:28 +03:00
Mia Vucinic
04603ae61f add new extensions API handling in test 2025-08-01 16:16:27 +03:00