1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2026-04-15 11:44:13 +02:00
Commit Graph

5722 Commits

Author SHA1 Message Date
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
1grzyb1
cbc446aea7 Fix focus in gi ga nerdtree
Add focusNew parameter to splitWindow to allow NERDTree preview
mappings (gs, gi, ga) to keep focus on the tree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:24:30 +01:00
1grzyb1
839446b7ed VIM-4134 Load frontend classes only in frontend module 2026-03-16 14:24:30 +01:00
1grzyb1
48dfa01234 VIM-4134 Remove frontend split module
All operations uses rpc interface right now and on backend we detect if we are in disptch thread if so we won't use EDT.
2026-03-16 14:24:30 +01:00
1grzyb1
eb4a261984 VIM-4134 Synchronize idea jump through topic 2026-03-16 14:24:30 +01:00
1grzyb1
1f3e7e701e VIM-4134 replace path-based file identification with VirtualFileId and EditorId 2026-03-16 14:24:30 +01:00
1grzyb1
230f816605 VIM-4134 migrate to ProjectId for project resolution 2026-03-16 14:24:30 +01:00
1grzyb1
cb3a11e785 VIM-4134 update tests for new module structure
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:24:30 +01:00
1grzyb1
bef0b4c32a VIM-4134 move frontend code to main source set
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:24:30 +01:00
1grzyb1
325ccc3668 VIM-4134 add common module with shared services, RPC interfaces, and resources
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:24:30 +01:00
1grzyb1
d44bf3aa02 Update copyright years to 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 14:24:30 +01:00
1grzyb1
0a962153c9 VIM-4134 migration to plugin model v2 2026-02-18 11:08:29 +01:00
1grzyb1
15674af9e0 VIM-3948 add ToolWindowNavEverywhere extension to VimEverywhere plugin
This adds support for <C-W> navigation for non-editor windows.
IdeaVim doesn't read keystrokes outside the editor, so we need to create custom dispatcher that will handle does shortcuts in those scenarios.
This feature is enabled alongside `VimEverywhere`.
2026-02-17 15:01:17 +01:00
1grzyb1
29067706ec VIM-4134 Replace java.io.File with java.nio.file.Path 2026-02-17 15:01:02 +01:00
1grzyb1
a250369735 VIM-3948 rename vimhints plugin to VimEverywhere 2026-02-11 15:58:34 +01:00
1grzyb1
f22f973b0c VIM-3948 include NerdTreeEverywhere extension in vimhints 2026-02-11 15:58:34 +01:00
1grzyb1
d9c745fd8e VIM-4120 handle ':' in output panel 2026-02-11 12:58:59 +01:00
1grzyb1
9f0ae27440 VIM-4120 close output panel on active editor change 2026-02-11 12:58:59 +01:00
1grzyb1
6591be3617 VIM-4120 remove isPanelActive from VimOutputPanel 2026-02-11 12:58:59 +01:00
1grzyb1
410ac0ff39 VIM-4120 close current output panel when executing command 2026-02-11 12:58:59 +01:00
1grzyb1
d382e0bc26 VIM-4120 single addText method 2026-02-11 12:58:59 +01:00
1grzyb1
c91d43c45e VIM-4120 Use weak reference for active OutputPanel to avoid project leak 2026-02-11 12:58:59 +01:00
1grzyb1
622163194d VIM-4120 removed awt color reference in engine 2026-02-11 12:58:59 +01:00
1grzyb1
34f16f4daf VIM-4120 Rename isActive to isVisible to not leak IJ impl details 2026-02-11 12:58:59 +01:00
1grzyb1
44b0e24586 VIM-4120 Fix label in multiline output panel
During first echo with multiline it showed -- MORE -- instead of asking to press enter
2026-02-11 12:58:59 +01:00