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

9697 Commits

Author SHA1 Message Date
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
9afdd838ba Remove speckit files and spec documents
Co-Authored-By: Claude Opus 4.6 <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
b0a45d47c5 Extend command() API to pass ex-command range to handler
The command() handler now receives startLine and endLine (0-based)
from the resolved ex-command range. Previously the range was received
by the internal CommandAliasHandler but discarded before reaching the
plugin lambda.

Also fix using editor.projectId instead of the VimApiImpl's own
projectId, so the handler resolves the correct editor context.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:52 +02:00
Alex Plate
653721f13e Mark K3 coroutine audit complete in tasks.md and research.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:52 +02:00
Alex Plate
696a810ab0 K3-8b: Make methods in non-locking scopes suspend
Per VIM-4144 coroutine audit: methods inside non-locking scopes
(OptionScope, DigraphScope, OutputPanelScope) should be suspend
for RemDev future-proofing. Updated interfaces, implementations,
and extension functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:52 +02:00
Alex Plate
f12e6cc51e K3-5: Update KDoc for lock-acquiring openers (read/change)
Per VIM-4144 coroutine audit: read/change functions stay non-suspend
(Kotlin contracts don't support suspend, and they're already callable
from the suspend editor {} block). Block parameters stay non-suspend
(inside locks). Updated stale KDoc that referenced Deferred/Job.

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
28a405a9ff K3-3g: Make CommandLine input callback suspend
Per VIM-4144 coroutine audit: handler lambdas should be suspend
for RemDev future-proofing. Implementation uses runBlocking bridge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:51 +02:00
Alex Plate
7c66224d17 K3-3f: Make modal input handlers suspend
Per VIM-4144 coroutine audit: handler lambdas should be suspend
for RemDev future-proofing. Implementation uses runBlocking bridge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:51 +02:00
Alex Plate
eb9d698f2a K3-3d: Make command handler suspend, add command() to VimInitApi
Per VIM-4144 coroutine audit: handler lambdas should be suspend
for RemDev future-proofing. Also exposes command() at init time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:51 +02:00
Alex Plate
0f7ea73c73 K3-3b: Make text object range provider suspend
Per VIM-4144 coroutine audit: handler lambdas should be suspend
for RemDev future-proofing. Implementation uses runBlocking bridge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:51 +02:00
Alex Plate
efc5f0140f K3-5': Remove suspend from CommandLineTransaction methods (inside lock)
Per VIM-4144 coroutine audit: methods inside locks must be synchronous.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:31:50 +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
9072761043 Mark T006 as complete in tasks.md
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
Alex Plate
835e9f3226 T004: Define API scope as editor-only
Decision: VimApi works in editor context only, not IDE-wide.
See YouTrack ADR for full rationale.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:48 +02:00
Alex Plate
374ac851fc Add T005: document editor obtaining strategy for K1
New task to understand and document how to obtain editors reliably:
- Why focused approach is unreliable (global state, can change mid-op)
- Normal case: capture at shortcut entry point
- Edge cases: macros with :wincmd, API commands that switch windows

Renumbered all subsequent tasks (now 82 total).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:48 +02:00
Alex Plate
eef7d17a59 Prioritize K1 Editor Context Fix over State Update Safety
Swap K1 and K2 in Phase 2 tasks - editor context is more critical.
Add decision task T004 to define API scope (IDE-wide vs editor-only).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:48 +02:00
Alex Plate
821f281025 Refactor tasks.md: convert research tasks to actionable tasks
- Remove Phase 2 (Foundational) - all tasks were research already in plan.md
- Renumber tasks T004-T081 across 6 phases (was 7 phases, 94 tasks)
- Convert "Verify X" tasks to "Write test: X" (T026-T033)
- Convert "Review/Audit" tasks to specific implementation tasks
- Convert "Evaluate/Document" tasks to "Skip" with clear reason
- Remove duplicate tasks (extension list, test requirements)
- Update phase dependencies and parallel opportunities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:48 +02:00
Alex Plate
563a46bffc Complete Phase 1: Setup tasks for API layer
Verified API module structure, documented VimApi interface methods,
and identified all VimExtensionFacade usages requiring migration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:47 +02:00
Alex Plate
3646a5b419 Address specification analysis findings
- Document TeamCity CI compatibility checker in spec, plan, and tasks
- Enhance T038 with specific Vimscript execution test cases
- Enhance T039 with specific variable scope test cases
- Add T043a for vim-engine separation verification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:47 +02:00
Alex Plate
b235a04970 Add API layer implementation tasks
94 tasks organized by user story:
- US4 (API Finalization): 24 tasks for K1-K4 issues and G1-G4 gaps
- US1 (Complete API): 14 tasks for API module completeness
- US2 (Internal Migration): 24 tasks for built-in extension migrations
- US3 (External Experience): 18 tasks for documentation and external plugin PRs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-20 18:31:47 +02:00
1grzyb1
681a44da77 Fix IndexOutOfBoundsException in findBlock when caret is at end of file
The caret can legitimately be at position chars.length (end-of-file), which is valid in IntelliJ but not a valid character index. findBlock and getQuoteRangeNoPSI assumed the caret was always on a character, causing a crash when text objects like a) were used at EOF.

Return null early when pos is out of character index range, since there is no block or quote to match at that position.
2026-03-20 09:14:35 +01: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
dependabot[bot]
9baaaa34c8 Bump org.eclipse.jgit:org.eclipse.jgit.ssh.apache
Bumps [org.eclipse.jgit:org.eclipse.jgit.ssh.apache](https://github.com/eclipse-jgit/jgit) from 7.4.0.202509020913-r to 7.6.0.202603022253-r.
- [Commits](https://github.com/eclipse-jgit/jgit/compare/v7.4.0.202509020913-r...v7.6.0.202603022253-r)

---
updated-dependencies:
- dependency-name: org.eclipse.jgit:org.eclipse.jgit.ssh.apache
  dependency-version: 7.6.0.202603022253-r
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-18 15:38:52 +00: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
729cf9be0f Revert "Remove maxMapDepthReached mechanism from KeyHandler"
This reverts commit bddedb0080.
2026-03-17 11:48:35 +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