Commit Graph
100 Commits
Author SHA1 Message Date
Matt EllisandGrzybek 319b5164dc Enable Vim in Java files decompiled from Kotlin
Fixes VIM-4197
2026-04-20 08:45:23 +02:00
Matt EllisandGrzybek c49ac943fc Remove explicit gradleJvm option, use project SDK 2026-04-20 08:45:23 +02:00
Matt EllisandAlex Plãte 9bffb4f42f Fix min arity for remove() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 3cdea85df4 Move common functions to collectionFunctions
Add a new package for functions that apply to both List and Dictionary, as well as some String functions (where a String is treated like a collection of characters). Trying to group some functions that shouldn't just sit at top level
2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte cc1122b3b6 Rename file 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 5adff67ec8 Add List uniq() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 8340be8459 Add List sort() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 9fbee06890 Add filter() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 4bf947a143 Fix comparison of String and Number 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 5225c409d8 Add List reduce() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 17eddab2ac Add map() and mapnew() functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 00fee97117 Add List indexof() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte fd9b283df1 Add call() function
Vim lists call() as part of List functions. We document it the same way so we can cross-reference, but it's not really a List function, so it's implemented with varFunctions
2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte e6b863f1ca Add List+Dictionary foreach() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte ea209d5c94 Refactor function and funcref functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 88fa7c2a29 Add doc comment 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 648cebf8d5 Encapsulate calling named function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte e2adf0af51 Handle range for builtin functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 1333051ad8 Make range an argument instead of a field 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte bd0edb01b6 Introduce BuiltinFunctionHandler base class 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 0f9923128d Update doc comment 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 7600d96d0a Improve handling of dictionary functions
VimFuncref is no longer mutable, since the instance can be shared between variables. A dictionary function must be invoked with a Funcref that captures the dictionary; when accessing a dictionary entry that is a function, the returned value is a newly created partial function that captures the dictionary. This helps fix some issues when printing a dictionary and/or dictionary function with `echo`, including a stack overflow.
2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 5e5005f068 Rename FunctionCallExpression for clarity 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 603d7bc886 Remove function from public API 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 1f4e8f110e Fix missing parameter for resource 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 5e74cfdad7 Rename file 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte df48c41904 Add List flattennew() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 95d3aad9ff Add List flatten() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 1afd730083 Add error handling to reverse() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 3e23903d95 Rename file 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 5d4dd891e6 Add List+Dictionary extendnew() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte f27cafbae3 Add List+Dictionary extend() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte e1ddf7780f Add List+String slice() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 4103291d1a Add List+Dictionary+String items() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 727b94e6ff Add Dictionary values() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte d07a154a77 Add Dictionary keys() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 94736d2339 Add List+Dictionary remove() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte dc335e5178 Add List insert() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 52a1774f11 Add Dictionary has_key() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 6f553ec3c0 Add List add() function 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte ed50fa28f5 Refactor argument handling for functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 0e2349baac Refactor min/max args for function handler 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 12ab94452b Update error message for min and max functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte fa06644ece Move functions to more appropriate packages 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 11653e22b8 Add list of implemented builtin functions 2026-01-09 19:12:27 +02:00
Matt EllisandAlex Plãte 8f7f27caec Fix high CPU usage while showing command line
Fixes repeatedly calling repaint while trying to paint the caret. This is due to a combination of the modelToView translation returning a location instead of a bounding box (the width can be zero) and a check that one rectangle contains another returning false when one rectangle has a width of zero.

Also fixes the caret not redrawing properly while flashing when first shown. This is due to the width and height not being properly initialised.
2026-01-06 10:15:56 +02:00
Matt EllisandAlex Plãte 33adcd3f04 Add deepcopy() function 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte aa346a3dfa Add copy() function 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte ec13dd398b Ensure functions handle recursion and equality
Specifically, index() and count(). Moves the implementation of equality from EqualToHandler to VimDataType and friends
2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte 8b61d33c2c Improve not equal to operator support
List, Dictionary, Funcref and recursion
2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte f062ceb898 Support equal to operator for Funcref 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte 89115bdfb2 Support equal to operator for Dictionary 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte 4baf80130f Support equal to operator for Lists 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte cede08b536 Support string output for recursive datatypes 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte 1b7b1cb8ed Remove value semantics from VimList and Dictionary
Also VimFuncref. This is required to protect against unbounded recursion in generated equals and hashCode functions when the list or dictionary contains internally recursive references
2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte 28ec2ed694 Add comments and tests for Vim data types
Some tests are disabled, will implement next
2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte c1c18c44ae Fix review comments for is operator 2025-11-22 00:09:32 +02:00
Matt EllisandAlex Plãte bcb76421b2 Implement let unpack 2025-11-07 16:31:24 +02:00
Matt EllisandAlex Plãte 592ff5f774 Rearrange bits of grammar in alphabetical order
No changes!
2025-11-07 16:31:24 +02:00
Matt EllisandAlex Plãte 6f3ed33f6e Add support for getting env var expressions
The JVM doesn't provide a way to set
2025-11-07 16:15:39 +02:00
Matt EllisandAlex Plãte e135392d8b Implement bitwise shift expressions 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 4c9951dde6 Rename the binary expression parser rules 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 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 EllisandAlex Plãte 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 EllisandAlex Plãte f83e982730 Fix associativity of ternary and falsy operators
Fixes VIM-3835
2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 115937f642 Consolidate unary expressions 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 3278b5e8cf Add tests for expression precedence 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 5d96a682f6 Fix test base classes 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 63cbb5b736 Fix use of is operator as variable name 2025-11-07 15:56:39 +02:00
Matt EllisandAlex Plãte 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
Matt EllisandAlex Plãte 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 EllisandAlex Plãte 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 EllisandAlex Plãte 54cc89f641 Fix missing read action exceptions 2025-10-24 14:29:58 +03:00
Matt EllisandAlex Plãte 1048d06586 Remove no longer used 'ideaglobalmode' text 2025-10-24 14:29:58 +03:00
Matt EllisandAlex Plãte 6defddd24c Extract variable expression assignment 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte a916b4de9c Rename Variable to VariableExpression 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 8a0bdfd18f Improve sublist expression compatibility 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 3eb0ac9207 Remove tests for indexed expressions 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte d71b99b8d5 Update SublistExpressionTest.kt 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte db8736dcf4 Extract sublist expression assignment 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 4c3cefc1e6 Add typename for reporting purposes 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte b11fc4895b Support assigning to negative index 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte b7ce946af3 Extract sublist expression assignment
Also allows whitespace inside indexed expression
2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 5a45f6d945 Improve evaluating indexed expressions
Support negative indexes, float indexes, and indexing numbers
2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 6622f15ea3 Allow dictionary to be indexed by Float 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte fd1fe51633 Extract indexed expression assignment 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 91459edf6c Rename OneElementSublistExpression 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 01d92acd40 Improve validation for concatenation 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 6d18288883 Fix validation for modulo operator 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 7ffca59450 Support double-dot concatenation assignment 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 61df4f342d Support Float in concatenation handler
Surprisingly Float is converted to String, and then concatenated. But this is only supported for the binary concatenation operator, not the compound assignment concatenation operator. This lead to improved validation and behaviour closer to Vim.
2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte cb1c0298ff Improve exception handling in tests 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 56d5af6bc9 Allow assigning Float to Register 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 1dbe3e4aa1 Update RegisterExpression to assign value 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 7256731572 Rename Register to RegisterExpression 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte dc5b45a52d Update OptionExpression to match Vim behaviour 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 063317b0c9 Introduce LValueExpression, update OptionExpression 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 37b6768148 Rename LetCommand.variable to lvalue 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 5ce2887391 Extract and add tests for sublist expressions 2025-10-02 17:26:38 +03:00
Matt EllisandAlex Plãte 4ab91150d6 Extract and add tests for indexed expressions 2025-10-02 17:26:38 +03:00