Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for IdeaVim and Code With Me #819

Merged
merged 10 commits into from
Feb 23, 2024

Conversation

citizenmatt
Copy link
Member

This PR fixes a number of bugs in IdeaVim when being used in Code With Me scenarios, mainly when installed on the host, but also fixes issues when installed on both host and guest (JetBrains Client)

Primarily, it updates the API used to get the editors that are in use by the host, correctly ignoring the non-local, hidden editors used by remote guests, and ensures that any editor listeners are only working with local editors. It fixes the following issues:

  • Search highlights and selection from host transferred to the guest Client editors (VIM-3268)
  • File/tab selection callback was not ignoring guest editors, so "switch to alternate file" (<C-^>) on the host could switch to the last selected file on the guest (VIM-3274)
  • Line numbers would be drawn in guest editors, including relative line numbers - relative to the host's caret (VIM-3275)
  • Stop IdeaVim actions appearing in the Client. This would mean that that Client could disable IdeaVim for the host. If the Client also had IdeaVim installed, trying to disable IdeaVim on the Client would disable on the host (VIM-3283)
  • Fixes an unrelated bug that stopped the output pane from updating when changing the theme, due to an incorrect listener registration (VIM-2167)

There is a minor change in behaviour when a new editor is created. Previously, IdeaVim would incorrectly register listeners and initialise options, etc. for all windows. Now it only initialises editors that are supported by IdeaVim. This means local editors, but it's also dependent on the 'ideavimsupport' option to decide if it should handle single line editors or editors inside dialogs. Previously, because the listeners were always registered, changing the 'ideavimsupport' option would allow these editors to immediately start working. Now, they are only possibly initialised at creation time. If the option is changed, the editor would need to be closed and reopened. I do not expect this option to be changed during an interactive session, so I believe this is reasonable.

There are other issues outstanding for remote development scenarios, where IdeaVim is installed in the Client. This is currently blocked waiting a means to debug this scenario. I'll take a look when I get debugging working.

Always ignores non-local, hidden editors opened by remote guests in Code With Me sessions.

Fixes VIM-3268
Reviews all IntelliJ listeners to ensure that they only work with supported local editors. Editor creation was initialising IdeaVim for all editors, which meant that behaviour could leak into Code With Me guest editors. E.g. guest editors incorrectly drawing relative line numbers, or the host using the guest's last selected tab when switching to an alternate file.

This leads to a change in behaviour with some local editors. The editor creation listener will now check to see if the editor is local *and supported*. This means it can exclude single line editors, editors in database cells or dialogs, depending on the state of 'ideavimsupport' at creation time. The behaviour at creation time is now more correct, but if 'ideavimsupport' is modified, existing matching editors will not be initialised.

Fixes VIM-3274, fixes VIM-3275
This means we listen to changes in all documents, rather than just the changes in the documents for open local editors. And this means that we correctly update e.g. marks when a non-local editor changes a file that isn't open in a local editor.
IdeaVim actions are local only - they control local behaviour and should not be visible in the Client

Fixes VIM-3283
@AlexPl292 AlexPl292 merged commit bd19256 into JetBrains:master Feb 23, 2024
4 checks passed
@AlexPl292
Copy link
Member

Cool, merged! CWM should be happy

@citizenmatt citizenmatt deleted the bugfix/cwm-fixes branch February 23, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants