1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2026-05-25 22:52:14 +02:00
Commit Graph

2151 Commits

Author SHA1 Message Date
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
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
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
cbc8249a71 adjust visual marks position after deletion 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
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
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
1grzyb1
c1f7a6b3a7 VIM-4120 Pass enter press back to editor 2026-02-11 12:58:59 +01:00
1grzyb1
9848aab71a VIM-4120 adjust arrows key handling
in single-line mode we just passed arrow keys back to the editor
in multiline mode they are used to scroll in output panel unless we are already at end, then it's passed back to editor
2026-02-11 12:58:59 +01:00
1grzyb1
bcc8d1b525 VIM-4120 Remove caret from OutputPanel 2026-02-11 12:58:59 +01:00
1grzyb1
5510a20654 VIM-4120 Pass eny keypress back to editor in single line output 2026-02-11 12:58:59 +01:00
1grzyb1
bec8daa6ab VIM-4120 Use showErrorMessage for displaying errors in red 2026-02-11 12:58:59 +01:00
1grzyb1
5e20bbf14e VIM-4120 display multiple lines in OutputPanel with different styles 2026-02-11 12:58:59 +01:00
Filipp Vakhitov
ed55b2b24f Replace v: scope variables with g: scope for mode widget 2026-02-11 12:17:50 +02:00
1grzyb1
6ecfb3e92e VIM-4120 Add missing VimHintsExtension class 2026-02-11 08:51:10 +01:00
Filipp Vakhitov
14e6759121 Allow plugin writers to provide their own VimCommandLineService 2026-02-11 09:34:34 +02:00
1grzyb1
f1355c3305 VIM-3948 Enable vimhints through 'Plug'
As vimhints are not part of neovim, it makes more sense to keep it as a plugin, not as an option
2026-02-10 12:02:34 +01:00
1grzyb1
3ffd680650 VIM-3948 don't traverse not visible components
We don't want to apply labels for components that are inside not visible components. For example, setting has `SettingsEditor` with multiple `SettingWrapper` for each selected tab but only one is visible at one time. So we don't want to apply labels on not visible tabs
2026-02-10 09:06:06 +01:00
1grzyb1
1588a9e15b VIM-3948 Traverse vertical panes in ConfigurableEditor
Vertical planes in settings windows has a lot of elements that we may want to click using hints so we traverse inside them
2026-02-10 08:08:14 +01:00