Noorts / Toggler

JetBrains IDE Plugin - Quickly toggle words and symbols with a hotkey

Home Page:https://plugins.jetbrains.com/plugin/16166-toggler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Collapsing imports prevents toggling with no selection

Saucistophe opened this issue · comments

Hi there, I have a strange one.
Clicking on a part of a togglable word is usually enough to trigger a partial match. However, this does not work on my java files. It does work on scratch file with exactly the same data. What's even stranger, it works when selecting the exact part that I want to toggle.

toggler

I can reproduce on at least 3 of our repos (Those use Maven, Spring web, Lombok, and mapstruct).
I run IntelliJ Idea 2021.2, with the following extensions:
image

Also, I absolutely love this extension. Thank you.

After building the plugin and adding logs, I found the culprit. It's due to the collapsed import section! When it's collapsed, the amount of lines hidden from the editor is not counted somehow, and the line is off.

toggler_aha

Hey @Saucistophe!

Thanks for letting me know about the issue and for the subsequent investigation as to what the culprit is. I definitely appreciate it 👍.

I'll look into a solution soon and let you know once I know more.

Thanks!
I tried implementing a unit test to reproduce it, but I cannot wrap my head around those IntelliJ fixtures.

Let me know if you need any help or input.

Hey @Saucistophe,

The issue should be resolved as per commit. It was a relatively small fix. A LogicalPosition (unfolded) is now used instead of a VisualPosition (folded). The text replacement API expects an unfolded position so this small change fixes the problem that folding caused.

Once again thanks for the report 👍. If you run into any other problems, do let me know, so that we can take care of them 😄.

The new update (v1.2.2) is available here as a release and will be available on the marketplace and in your IDE once JetBrains approves the update (usually two business days).

Thank you for the explanation and the quick fix!

It's deployed, and it works!