Skip to content

Conversation

@magidc
Copy link
Contributor

@magidc magidc commented Aug 30, 2025

Bug description

Steps to reproduce

  • Use Help | Find Action, search for "http request", hit Enter
  • Provide a name, hit Enter
  • Go into insert mode (type i)
  • Select "Requests with Tests and Scripts" from the "Examples" drop-down near the top right corner of the editor window
  • (Verify you're still in insert mode)
  • Hit Esc to exit insert mode
  • (Verify this action had no effect)

Expected result (correct behavior)

If you navigate to a read-only file while in insert mode, you should either:

  • be put into normal mode, OR
  • be allowed to press Esc to exit insert mode.

Actual result (faulty behavior)

If you navigate to a read-only file while in insert mode, you remain in insert mode.
You cannot escape into normal mode. To get around this, you must:

  1. Return to an editable editor
  2. Escape into normal mode
  3. Then return to the read-only editor in order to use normal-mode commands.

Solution

I opted for limiting the command executed in read-only files to the ones that do not change, or allow to change its contents.
I have noticed that this bug was actually happening in more situations that the one described. As the mode always changes automatically to Normal when focusing in a non writable editor, all that is really needed is to prevent any command that changes or allows content changing (like switching to insert mode, pasting, etc).

What I did is a simply one-line change that blocks the execution of any command with an action that extends from ChangeEditorActionHandler class when the editor is not writable. Simple but effective

@AlexPl292
Copy link
Member

Hello, thank you for your interest! There is an already onging a PR with the same issue: #1283

Take a look at it, it has a long discussion. Also, if #1283 will be finished, it will get a priority in merging.

@magidc
Copy link
Contributor Author

magidc commented Sep 5, 2025

Thanks! I didn´t notice there was already an ongoing PR for the same issue. I will try to contribute to the discussion

@AlexPl292 AlexPl292 closed this Sep 5, 2025
@magidc
Copy link
Contributor Author

magidc commented Sep 8, 2025

Just one question. I have developed some plugins on top of IdeaVim, one of them provides extra text objects like any kind of quoted text, list items or function arguments.

There is already a plugin included in IdeaVIM to provide a text object for function arguments called "argtextobj". I was never comfortable with it because it fails to select arguments in some cases, specially when the argument is parametrized like "Map<String, Concept> arg". The plugin detects arguments doing a pure text analysis. My version seems to be more reliable as it is based on the PSIElements of the internal Intellij model.

I would like to contribute to IdeaVIM and fix the "argtextobj" plugin but the change would be a complete reimplementation. Should I do it this way or should I include as a new plugin?

Also, am I allowed to add my other IdeaVIM plugins to the document where IdeaVIM plugins are listed

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants