1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2026-03-28 05:52:37 +01:00
Commit Graph

5696 Commits

Author SHA1 Message Date
b28478f098 Preserve visual mode after executing IDE action 2026-03-27 22:17:36 +01:00
b09b9522af Make g0/g^/g$ work with soft wraps 2026-03-27 22:17:36 +01:00
d2e96a7989 Make search highlights temporary 2026-03-27 22:17:35 +01:00
8ebb20f742 Exit insert mode after refactoring 2026-03-27 22:17:35 +01:00
5f07f71d11 Add action to run last macro in all opened files 2026-03-27 22:17:35 +01:00
2a08def7e4 Revert per-caret registers 2026-03-27 22:17:35 +01:00
a9cd6250a0 Apply scrolloff after executing native IDEA actions 2026-03-27 22:17:35 +01:00
595baa79dc Automatically add unambiguous imports after running a macro 2026-03-27 22:17:35 +01:00
95abad99db Fix(VIM-3986): Exception when pasting register contents containing new line 2026-03-27 22:17:35 +01:00
cf17f4e586 Fix(VIM-3179): Respect virtual space below editor (imperfectly) 2026-03-27 22:17:35 +01:00
a0d4591747 Add support for count for visual and line motion surround 2026-03-27 22:17:35 +01:00
27fdbd667e Fix vim-surround not working with multiple cursors
Fixes multiple cursors with vim-surround commands `cs, ds, S` (but not `ys`).
2026-03-27 22:17:35 +01:00
3af7dfc772 Fix(VIM-696): Restore visual mode after undo/redo, and disable incompatible actions 2026-03-27 22:17:34 +01:00
cc2cd5c7cb Change matchit plugin to use HTML patterns in unrecognized files 2026-03-27 22:17:34 +01:00
f4e71e500b Reset insert mode when switching active editor 2026-03-27 22:17:34 +01:00
cf26501c8c Remove notifications about configuration options 2026-03-27 22:17:34 +01:00
e27932583b Set custom plugin version 2026-03-27 22:09:48 +01:00
1grzyb1
13fd228707 Fix TransactionTest project leak on CI
The mock services (VimMarkService, VimJumpService) were replaced via
MockTestCase.mockService() using @TestDisposable, which is disposed
AFTER @AfterEach. During super.tearDown(), editor disposal triggers
injector.markService.editorReleased(vimEditor), which still hits the
mock (service replacement not yet undone). This records a new Mockito
invocation on the EDT's MockingProgressImpl thread-local, holding
IjVimEditor → EditorImpl → ProjectImpl — causing the leaked project.

Fix: use a separate Disposable for service replacements and dispose it
before super.tearDown(), so editorReleased goes to the real service.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 13:48:44 +01:00
1grzyb1
2b0485fb9c Fix flaky Transaction test 2026-03-24 11:09:16 +01:00
1grzyb1
65ae630623 Fix flaky Transaction test 2026-03-24 10:08:28 +01:00
1grzyb1
d0ad4caf76 Move dependency support to the plugin.xml file
Otherwise, exception thrown from `DependencySupportBean.setPluginDescriptor()`.
2026-03-24 09:13:42 +01:00
1grzyb1
35fe3f9cca VIM-2821 Undo for repeating insertText in split mode
Insert text wasn't being properly grouped into single undo group when performing `.`
Now whole `.` is grouped into single undo entry
2026-03-24 08:56:46 +01:00
Alex Plate
2b1bee3c9c Fix thinapi test compilation errors with runBlocking
After the K3 coroutine audit made VimApi methods suspend,
these tests were not updated to wrap calls in runBlocking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:54 +02:00
Alex Plate
609f9b9be8 Revert Exchange plugin migration to new VimApi
Part of the VimApi freeze decision (VIM-4161). Reverting the
partial migration to keep Exchange fully on the old API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:54 +02:00
Alex Plate
a81cfa67f0 Migrate Exchange highlight from RangeHighlighter to HighlightId
Replace RangeHighlighter field in Exchange with HighlightId. Use
injector.highlightingService for adding/removing highlights instead
of direct markupModel access. Update Util.clearExchange to take
VimEditor. Update test assertHighlighter to check markup model
directly (area validation lost — tracked with TODO).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:54 +02:00
Alex Plate
06d75c1170 Simplify highlight endAdj condition in Exchange
The old condition `!isVisualLine && (hlArea == EXACT_RANGE || isVisual)`
was equivalent to `ex.type != LINE_WISE` because when !isVisualLine is
true, hlArea is always EXACT_RANGE, making the isVisual branch
unreachable. Pure logic simplification, no behavior change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:54 +02:00
Alex Plate
65c5f5eadd Migrate all Exchange mappings to nmapPluginAction/xmapPluginAction
Replace separate nnoremap+nmap/putExtensionHandlerMapping+putKeyMappingIfMissing
with the combined nmapPluginAction/xmapPluginAction helpers for all four
mappings (cx, cxx, cxc, X). Remove ExchangeClearHandler and VExchangeHandler
classes; their logic is now in top-level bridge functions that still delegate
to the old Operator/Util code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:54 +02:00
Alex Plate
6c9f711b51 Refactor Exchange data class to use offsets and line/col instead of Mark
Preparation for new API migration: Exchange now stores startLine/startCol/
startOffset/endLine/endCol/endOffset directly, removing dependency on the
internal Mark type. All comparison and cursor logic updated accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:53 +02:00
Alex Plate
6613a3284c Migrate Exchange N-mode handler (cx, cxx) to new VimApi
Replace ExchangeHandler class with suspend fun VimApi.exchangeAction()
and register via initApi.mappings { nnoremap/nmap }.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:53 +02:00
Alex Plate
9d35c748c2 Switch Exchange extension to init(initApi: VimInitApi) signature
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:53 +02:00
Alex Plate
f0c9c6d16b Reorganize VimApi into scopes with dual-access pattern
Move loose functions from VimApi into dedicated scope interfaces
(VariableScope, CommandScope, TabScope, StorageScope, TextScope)
and update existing scopes (mappings, textObjects, outputPanel,
digraph, commandLine) from default-empty-lambda to two-function
pattern: lambda `fun <T> scope(block: X.() -> T): T` plus
direct-object `fun scope(): X`.

VIM-4158

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:53 +02:00
Alex Plate
70fce5ab2b Migrate Commentary N/X operator mappings to new API
Replace putExtensionHandlerMapping(MappingMode.NX, ..., CommentaryOperatorHandler)
with initApi.mappings { nnoremap/xnoremap("<Plug>Commentary") { ... } }.

Remove CommentaryOperatorHandler class (logic inlined into mapping lambdas).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:52 +02:00
Alex Plate
90c642ccfe Switch Commentary to init(initApi: VimInitApi) signature
No behavior change — just switches from the old init() to
init(initApi) so we can incrementally migrate to the new API.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:52 +02:00
Alex Plate
7b99c43a98 K3-4+7: Make scope openers and flat VimApi methods suspend
Per VIM-4144 coroutine audit:
- Group 4: Scope-opening functions (editor, forEachEditor, commandLine,
  option, outputPanel, digraph, modalInput) become suspend with suspend
  block parameters
- Group 7: Flat VimApi methods (normal, execute, saveFile, closeFile,
  tab ops, data ops, pattern ops, camel ops) become suspend
- Excluded: properties (mode, tabCount, currentTabIndex), getVariable,
  setVariable, exportOperatorFunction per earlier decisions
- Updated VimApiImpl overrides accordingly
- Fixed extension code (argtextobj, miniai, paragraphmotion,
  replacewithregister, textobjindent) to propagate suspend through
  helper functions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:51 +02:00
Alex Plate
f7af2631e9 T010-T014: Remove mode-changing methods from VimApi, use normal() instead
Remove enterInsertMode(), enterNormalMode(), enterVisualMode() from VimApi.
Mode changes should use normal() — e.g., normal("<Esc>"), normal("i"),
normal("v") — matching how real Vim plugins handle mode transitions.

Neither Vim nor Neovim has a direct "set mode" API. All mode changes in
real plugins (surround, exchange, commentary, ReplaceWithRegister) use
normal!, feedkeys(), or :stopinsert. The removed methods used incomplete
internal delegation (changeMode Level 2) that skipped proper entry/exit
setup (marks, strokes, dot-repeat, document listeners).

Also removes the now-unused changeMode() function from Modes.kt.

See VIM-4143 for future proper mode-changing API design.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:50 +02:00
Alex Plate
f80120db5c T005d: Comment out window management APIs pending IJPL-235369
After setAsCurrentWindow(), getSelectedTextEditor() returns stale data
because the platform propagates the change asynchronously via
flatMapLatest + stateIn, and there is no way to observe when
propagation completes.

Comment out window APIs in VimApi, VimApiImpl, CaretRead, CaretReadImpl.
Add limitation comment to VimWindowGroup. Update EditorContextTest to
call injector.window directly. Track re-enablement in VIM-4138.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:50 +02:00
Alex Plate
6889ba37c5 T006: Add VimInitApi delegation wrapper for init-time type safety
Introduce VimInitApi as a restricted wrapper around VimApi that exposes
only init-safe methods (getVariable, mappings, textObjects,
exportOperatorFunction). During plugin init() there is no editor context,
so editor operations should not be callable. VimInitApi enforces this at
the type level via delegation rather than inheritance.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:50 +02:00
Alex Plate
918e525d26 T005c: Add EditorContextTest for editor context tracking
Verify that getSelectedEditor(projectId) correctly tracks the active
editor. After opening a new editor in a split window, VimApi's
editor { read { ... } } returns data from the newly selected editor.

Also update tasks.md: mark T005, T005b, T005c complete; drop T007,
T008 per VIM-4122 ADR; mark T009 as already done.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:49 +02:00
Alex Plate
22ad32103e T005b: Replace getFocusedEditor() with getSelectedEditor(projectId)
Use FileEditorManager's selected editor (internal model) instead of
focus-based detection. Falls back to injector.fallbackWindow when
projectId is null (init phase, project loading).

- Add getSelectedEditor(projectId) to VimEditorGroup interface
- Implement in EditorGroup.java using FileEditorManager
- Convert all thinapi scope impls from objects to classes accepting projectId
- Fix exportOperatorFunction to use execution-time editor.projectId
  instead of init-time captured null
- Update all thinapi mock tests to mock fallbackWindow and restore
  injector before tearDown
- Update CaretTransactionTest to use real projectId

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:49 +02:00
Alex Plate
5d985ef862 T005b: Add projectId parameter to VimApiImpl for editor context
Add projectId to VimApiImpl and propagate through scope implementations.
This is a pre-refactoring step before switching from getFocusedEditor()
to getSelectedEditor() API.

- VimApiImpl: Add projectId parameter (nullable), with KDoc explaining
  that it's null during init and falls back to fallback editor
- Scope implementations: Pass projectId through construction chain
- MappingScopeImpl, TextObjectScopeImpl: Get projectId from editor
  at execution time via editor.projectId
- Tests: Pass null for projectId (no editor context in setup)
- Remove VimApi.kt extension function (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:49 +02:00
Alex Plate
33f219c6d8 T005a: Pre-construct VimApi and pass to extension init method
- Add init(VimApi) experimental method to VimExtension interface
- Make init() a default empty method for backward compatibility
- Create VimApi in VimExtensionRegistrar and pass to extensions
- Migrate 7 extensions from api() to init(api: VimApi) pattern:
  MiniAI, VimTextObjEntireExtension, VimIndentObject,
  VimArgTextObjExtension, ParagraphMotion, ReplaceWithRegister

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:49 +02:00
Alex Plate
2032480cac Fix(VIM-1705): use selected editor during macro playback
During macro execution, commands like <C-w>h can change the active
editor. Previously, the editor was captured once at macro start and
reused for all keystrokes, causing window-switching commands to
have no effect on subsequent operations.

Now we re-query FileEditorManager.selectedTextEditor on each keystroke
to get the currently selected editor.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:49 +02:00
Alex Plate
fc679a4959 Remove try catch for potemkin progress
It's not necessary to explicitly catch the cancellation exception and return on that. Moreover, it's wrong not to re-throw the ProcessCanceledException
2026-03-20 18:31:48 +02:00
1grzyb1
a2246c966a VIM-3473 Sync ideavim in remdev
ideavimrc is on local and it coused sync issues between editor and actuall file os it's better to refresh with document content
2026-03-19 13:39:42 +01:00
1grzyb1
f3b67416cd VIM-4134 Format with = action in split mode
Formatting was broken in split mode and also in monolith mode cursor position restoring didn't match vim actual behaviour. refactored it to work in same way as commenting works
2026-03-18 11:35:37 +01:00
1grzyb1
06954e3759 Disable ^ in nvim tests
It was to complex to fix proper ^ mark positioning so leaving it for later covered by VIM-4154.
2026-03-17 11:48:35 +01:00
1grzyb1
cbc8249a71 adjust visual marks position after deletion 2026-03-17 11:48:35 +01:00
1grzyb1
20cb0afa5d VIM-4134 assert editor state on EDT 2026-03-17 11:48:35 +01:00
1grzyb1
2d63251b29 VIM-4134 Check for write lock before removing bookmark 2026-03-17 11:48:35 +01:00
1grzyb1
34d580898c VIM-4134 Fix undo in commentary
Commentary was doing visual selection on frontend and actual commenting
on backend which resulted in strange undo behaviour.
Moving whole commenting logic fixes all undo issues by making all actions single undo group.
2026-03-16 14:24:30 +01:00