1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-10-09 04:26:57 +02:00
Commit Graph

9045 Commits

Author SHA1 Message Date
Alex Plate
9499716b18 [API] Simplify list option handling in OptionScope 2025-08-29 18:11:27 +03:00
Alex Plate
c66a212781 [API] Add experimental API warning to all plugin documentation
Added prominent warning notice to all Plugin API documentation files:
- Plugin-API-reference.md
- Plugin-API-introduction.md
- Plugin-API-quick-start-guide.md
- Plugin-API-tutorial-replace-with-register.md

The warning clearly states that the API is experimental and not
recommended for production use, with potential breaking changes.
2025-08-29 18:11:26 +03:00
Alex Plate
0099ea9073 [API] Update Plugin API Reference documentation for OptionScope
- Document that option() function now returns a value
- Add comprehensive documentation for list option methods (append, prepend, remove)
- Add utility methods documentation (toggle, split)
- Include practical usage examples and common use cases
- Update method signatures to reflect non-nullable returns
- Add Vim command equivalents for better understanding
2025-08-29 18:11:26 +03:00
Alex Plate
de809b528b [API] Turn OptionScopeImpl into an object 2025-08-29 18:11:26 +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
955ccc8151 [API] Make getOptionValue return type non-nullable
The implementation always returns a value or throws an exception,
so the return type should be non-nullable to reflect this behavior.
Updated extension functions to remove unnecessary null checks.
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
jetbrains-junie[bot]
022dc9698b feat(junie): added .devcontainer.json 2025-08-29 16:53:20 +03:00
jetbrains-junie[bot]
6c3a9f214b feat(junie): added .junie workflow 2025-08-29 16:52:06 +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
Alex Plãte
a009766a1a "Claude Code Review workflow" 2025-08-29 12:05:24 +03:00
Alex Plãte
d40061f9a4 "Claude PR Assistant workflow" 2025-08-29 12:05:24 +03:00
Alex Plate
476389b9c3 Bring back actualText to keep the compatibility with an external plugin 2025-08-29 11:48:26 +03:00
Alex Plate
7e71676656 [API] The write lock should be taken on EDT 2025-08-29 11:45:22 +03:00
Alex Plate
6a149a8ba4 [API] Add an experimental status on the API 2025-08-29 11:45:22 +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
Alex Plate
04d9282fb2 Change OutputPanelScopeImpl to be an object 2025-08-22 16:30:51 +03:00
Alex Plate
6f54a30bc3 Fix(VIM-4004): Add support for f13-f24 keys 2025-08-22 16:09:43 +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
f0a104a131 Reset caret shape on Escape
Provides a way to reset and resync the caret shape by hitting Escape, even if we don't change mode
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
a0a3f3f3b1 Fix an exception during the renaming: there was a read action missing 2025-08-22 11:22:38 +03:00
Alex Plate
aa539e76eb Rename RWLockLabel to VimLockLabel and other annotations
Also, clarify their usage
2025-08-22 11:22:38 +03:00