1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2026-05-03 17:03:08 +02:00
Commit Graph

5723 Commits

Author SHA1 Message Date
claude[bot]
16eb382dfa Maintenance: Statistics - Fix thread safety issues
Fix potential ConcurrentModificationException in statistics collection by using thread-safe collections.

Issues found:
- VimscriptState.Util and PluginState.Util used non-thread-safe HashSets
- Collections were modified from EDT/user actions but read from getMetrics()
- IntelliJ's ApplicationUsagesCollector.getMetrics() may be called on background threads
- Race conditions could cause ConcurrentModificationException or data corruption

Changes:
- Replace HashSet with ConcurrentHashMap.newKeySet() for thread-safe add/read operations
- Add @Volatile annotations to boolean flags to ensure visibility across threads
- This ensures safe concurrent access between statistics writers and collectors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 16:36:30 +02:00
Matt Ellis
bcb76421b2 Implement let unpack 2025-11-07 16:31:24 +02:00
Matt Ellis
e135392d8b Implement bitwise shift expressions 2025-11-07 15:56:39 +02:00
Matt Ellis
7e7a08a718 Implement parsing function call through funcref
This breaks a specific construct: `echo(42)(999)`. The `echo` command can parse multiple expressions without separating whitespace. IdeaVim now treats this example as a function call of the resul of the `(42)` expression, which is, of course, invalid. Vim evaluates expressions as it is parsing and declines to apply the `(999)` subscript because it knows the first expression is not a funcref/partial.

IdeaVim does not have this context, so cannot know that this is two expressions and not a function call.

I think it is better to support the `expr10(expr1, ...)` syntax and break this (what feels like niche) functionality than not have function calls through expression results at all.
2025-11-07 15:56:39 +02:00
Matt Ellis
5dde53c4d5 Reorder rules to reflect Vim's precedence
The only change to the rules themselves is to add unary plus/minus to IntExpression and FloatExpression. This matches Vim's precedence, where the unary operator applies to numeric constants at a higher precedence than to other expressions. E.g. `-4->abs()` invokes `abs` on `-4`, while `-a->abs()` is the negative value of `abs(a)`.
2025-11-07 15:56:39 +02:00
Matt Ellis
f83e982730 Fix associativity of ternary and falsy operators
Fixes VIM-3835
2025-11-07 15:56:39 +02:00
Matt Ellis
115937f642 Consolidate unary expressions 2025-11-07 15:56:39 +02:00
Matt Ellis
3278b5e8cf Add tests for expression precedence 2025-11-07 15:56:39 +02:00
Matt Ellis
5d96a682f6 Fix test base classes 2025-11-07 15:56:39 +02:00
Matt Ellis
63cbb5b736 Fix use of is operator as variable name 2025-11-07 15:56:39 +02:00
Matt Ellis
fc6f2905be Fix is and isnot operators
The parser was treating `is` and `isnot` as identifiers instead of operators
2025-11-07 15:56:39 +02:00
Alex Plate
e71e9714c2 Remove incorrect 3-argument mapping functions from API
The 3-argument mapping functions (e.g., nmap(keys, actionName, action)) had
incorrect implementation that used recursive mappings for both sub-mappings.
Also, this approach makes it impossible to implement other mapping features
such as skipping mapping registration if the mapping is already defined in
.ideavimrc.

A different solution for convenient mapping patterns will be implemented later.

Changes:
- Remove 16 three-argument function declarations from MappingScope interface
- Remove 16 three-argument function implementations from MappingScopeImpl
- Update ReplaceWithRegister plugins to use correct 2-step pattern:
  1. nnoremap("<Plug>...") for non-recursive <Plug> → action
  2. nmap("key", "<Plug>...") for recursive key → <Plug>

Total: 374 lines deleted, 18 lines added
2025-10-27 11:00:03 +02:00
Xinhe Wang
7b561bc275 Support hints for status bar widgets
The project switching and version control menus in the top-left corner remain unavailable due to accessibility issues (failure to implement the Accessible interface, specifically) with the ToolbarComboButton component in the IntelliJ platform.
2025-10-24 15:41:30 +03:00
Xinhe Wang
057a54c63d Specify hint action in HintGenerator instead of actionPerformed 2025-10-24 15:41:30 +03:00
Xinhe Wang
5893718c1b Click target center instead of invoking accessible action if hint is selected 2025-10-24 15:41:30 +03:00
1a8d5e0b66 Improve support for recording macros with code completion (#1332)
Fixes wrong recorded inputs when code completion introduces an import.

Fixes wrong recorded inputs when completing a static member with a partial type name. Example: `WiE.A` -> `WindowEvent.ACTION_EVENT_MASK`

Co-authored-by: Alex Plãte <aleksei.plate@jetbrains.com>
2025-10-24 15:24:43 +03:00
claude[bot]
13fb2d53f1 Maintenance: LenFunctionTest - Address review feedback
- Remove duplicate empty dictionary test (already covered at line 28)
- Rename 'test len with zero' to 'test len with zero number' for clarity
- Rename 'test len with negative number' to 'test len with negative numbers' (plural)

Co-authored-by: Alex Plãte <AlexPl292@users.noreply.github.com>
2025-10-24 14:38:49 +03:00
claude[bot]
c803a1cf24 Maintenance: LenFunctionTest - Add comprehensive edge case coverage
What was inspected:
- LenFunctionTest.kt and its corresponding implementation LenFunctionHandler.kt

Issues found:
- Test coverage was limited to basic happy path scenarios
- Missing tests for important edge cases: empty strings, zero, negative numbers,
  large numbers, empty collections, and special character handling
- No tests distinguishing between single-quoted and double-quoted string behavior
  in Vimscript

Changes made:
- Added 9 new test methods covering:
  * Empty strings (both single and double quoted)
  * Empty lists and dictionaries
  * Zero and negative numbers
  * Large numbers
  * Multi-element collections
  * Strings with escape sequences (documenting Vim's single vs double quote behavior)

Why this improves the code:
- Ensures len() function handles all data type edge cases correctly
- Documents expected behavior for Vimscript string quoting conventions
- Provides regression protection against future changes
- Aligns with testing best practices by covering boundary conditions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 14:38:49 +03:00
Matt Ellis
b4915d08cd Remove redundant code
The template listener is called immediately for the first variable, which will do the same thing.
2025-10-24 14:29:58 +03:00
Matt Ellis
6b7b18d947 Switch to Normal when accepting an inline rename
The 'idearefactormode' default of Select would leave an inline rename in Insert mode, and hitting Escape to return to Normal frequently cancelled the rename.

Also fixes various edge cases when moving between template variables. Often, this works due to a change in selection, but if there's an empty template variable and no current selection, there's no change in selection, and the mode isn't updated.
2025-10-24 14:29:58 +03:00
Matt Ellis
54cc89f641 Fix missing read action exceptions 2025-10-24 14:29:58 +03:00
Matt Ellis
1048d06586 Remove no longer used 'ideaglobalmode' text 2025-10-24 14:29:58 +03:00
azjf
a0f923512a Add support for non-control-character mapleader such as \<C-Space> 2025-10-24 13:44:57 +03:00
claude[bot]
0bb3524118 Maintenance: IjVimMessages - Fix redundant toString() call and improve null safety
In clearStatusBarMessage(), the mutable 'message' property was being
accessed multiple times without capturing it in a local variable. This
could theoretically cause issues if the property changed between the
null check and the usage. Additionally, calling toString() on a String
is redundant and creates an unnecessary allocation.

Fixed by capturing the message in a local variable at the start of the
method, which allows Kotlin's smart cast to work properly and removes
the need for the redundant toString() call.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-20 08:45:45 +03:00
claude[bot]
7de2ea0e0b Add regression test for string indexing boundary condition
This test validates the off-by-one error fix in IndexedExpression.kt:56.
When accessing a string at index equal to its length, the code should
return an empty string rather than throwing IndexOutOfBoundsException.

The old condition (idx > text.length) would allow idx == text.length to
pass through, causing an exception. The new condition (idx >= text.length)
correctly treats this as out of bounds.

Test case: 'hello'[5] should return '' since 'hello'.length == 5

Co-authored-by: Alex Plãte <AlexPl292@users.noreply.github.com>
2025-10-17 21:15:47 +03:00
Alex Plate
db767f534f Remove an unclear test 2025-10-17 12:30:29 +03:00
claude[bot]
244d13a3cc Maintenance: HintGenerator - Fix variable shadowing and remove wildcard import
Fixed a variable shadowing bug in the hint generation logic where the lambda
parameter name 'it' was being shadowed in nested lambda, causing incorrect
logic when checking for hint conflicts. The code now uses explicit parameter
names 'candidateHint' and 'existingHint' to make the logic clear and correct.

Also replaced wildcard import (java.util.*) with explicit import of
WeakHashMap, following project conventions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 10:23:36 +03:00
claude[bot]
4a2600738f Maintenance: RangeFunctionTest - Fix missing assertion and improve imports
Fixed a missing assertion in the test case "test range negative with start
past end throws error" that was not verifying the error condition actually
occurred. Also cleaned up imports by adding a proper import for assertTrue
instead of using the fully qualified kotlin.test.assertTrue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 18:01:47 +03:00
claude[bot]
82ed26a701 Maintenance: PrintLineNumberCommand - Fix out-of-bounds range handling
Add bounds checking to clamp line numbers to the last line of the document,
preventing potential exceptions when accessing line text with out-of-bounds
ranges like `:$+100=`. This matches the behavior of other commands like
GoToLineCommand.

Also add tests to verify the edge case behavior with and without flags.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 18:00:49 +03:00
claude[bot]
9a069e5ef8 Maintenance: ExPanelBorder - Update copyright and remove redundant modifier
- Update copyright year from 2023 to 2025
- Remove redundant 'internal constructor()' modifier (already implied by internal class)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 15:51:32 +03:00
claude[bot]
bb62dcdc15 Maintenance: DeletePreviousWordAction - Update copyright and add test
Update copyright year to 2025 and add test coverage for edge case when
caret is at the beginning of the command line.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 15:15:59 +03:00
Alex Plate
fdcb954e31 Remove the VimSelectionModel as it's not used anywhere 2025-10-09 13:14:49 +02:00
Alex Plate
bdc29c3eb4 Add support for count(), index(), min(), max(), and range() vimscript functions
Implements five new vimscript list functions:
- count(): counts occurrences of a value in a list/dict
- index(): finds first index of a value in a list
- min()/max(): finds minimum/maximum value in a list/dict
- range(): generates a list of numbers with optional stride

Includes error handling for edge cases like zero stride and invalid ranges.
2025-10-03 20:59:29 +03:00
Alex Plate
d46eb39635 Add support for repeat(), char2nr(), nr2char(), trim(), and reverse() vimscript functions
Implement five commonly used vimscript functions:

- repeat(expr, count): Repeats strings or lists multiple times
- char2nr(char): Converts character to Unicode code point
- nr2char(number): Converts code point to character
- trim(text, [mask], [dir]): Trims whitespace or custom characters
- reverse(object): Reverses lists in-place or returns reversed string

All functions include comprehensive test coverage and follow vim's
official behavior including edge cases.
2025-10-03 19:08:57 +03:00
Alex Plate
a6c71d90bb Fix(VIM-4050): Implement getline vim function 2025-10-03 18:41:34 +03:00
Alex Plate
62de460264 Execute the processor with a proper mode after closing the exEntryPanel
Now, the inputProcessor will be called after all closing is finished. This includes the mode that won't be CMD_LINE anymore, but the one that was used before entering CMD_LINE
2025-10-03 15:33:27 +03:00
Alex Plate
2d02327665 Rename method to get the panel
Kotlin has some hard incremental compilation issues when keeping the old name. No other reason for the rename
2025-10-03 15:32:53 +03:00
Alex Plate
91b5a705d4 Fix issues with null variables during swing initialization 2025-10-03 15:16:04 +03:00
Alex Plate
b7c3bc2875 Migrate ExOutputPanel from Java to Kotlin and update related references 2025-10-03 13:30:20 +03:00
Alex Plate
70922f5fc5 Rename .java to .kt 2025-10-03 13:30:19 +03:00
Alex Plate
13e4d0ce2b Migrate ExTextField from Java to Kotlin and update related references 2025-10-03 13:30:19 +03:00
Alex Plate
3990b6475e Rename .java to .kt 2025-10-03 13:30:19 +03:00
Alex Plate
63c65c8b93 Migrate ExEntryPanel from Java to Kotlin and update related references 2025-10-03 13:30:19 +03:00
Alex Plate
ba2ffa6955 Rename .java to .kt 2025-10-03 13:30:19 +03:00
Alex Plate
411b6eaf48 Refactor ExDocument: Migrate from Java to Kotlin 2025-10-03 13:30:18 +03:00
Alex Plate
b5ecb05382 Rename .java to .kt 2025-10-03 13:30:18 +03:00
Alex Plate
330f24bf74 Update JUnit to version 6 and improve null safety in test utilities 2025-10-02 18:04:30 +03:00
Alex Plate
36dfce695a Fix the compatibility with the latest idea EAP 2025-10-02 17:55:55 +03:00
Matt Ellis
a916b4de9c Rename Variable to VariableExpression 2025-10-02 17:26:38 +03:00
Matt Ellis
8a0bdfd18f Improve sublist expression compatibility 2025-10-02 17:26:38 +03:00