intellij-rainbow-brackets icon indicating copy to clipboard operation
intellij-rainbow-brackets copied to clipboard

Scope highlight: highlight the "parent PSI" as well

Open TheBestPessimist opened this issue 2 years ago • 1 comments

Please check

  • [x] I already support this project.
  • [x] If you are submitting a feature request, please do consider donating us on Open Collective Or by AliPay/WeChatPay. I purchased the plugin via jetbrains store.
  • [x] This issue/feature request is not reported before.

Your programming languages

Kotlin, JSON

Expected Behavior

Current Behavior

Possible Solution

Code snippet

I'm not sure how to explain what I want, as I don't know intellij's PSI names, so I will try to explain what I want by examples. This is why i did not use the template correctly either.

This is about the feature "Scope highlight", via Ctrl+Right Click or Alt+Right Click.

Sample image: image

Currently, when highlighting a particular object, only the portion between curly brackets, including the brackets themselves ({}) is selected. What I would like is to also highlight the "parent object" to which those curly brackets belong to.

  • Example: In the case of JSON (top half of the image):

Current highlighting:

                          {
          "name": "Tax-00 (0.0%)",
          "amount": 0.0
        }

Desired highlighting:

        "taxRate": {
          "name": "Tax-00 (0.0%)",
          "amount": 0.0
        }
  • Example: In the case of Kotlin (bottom half of the image):

Current highlighting:

                           {
            log.error("Failed to handle order deliveries: $payloadToStringUtf8", it)
            MessageHandlingAckStatus.NOK_NACK
        }

Desired highlighting:

        .getOrElse {
            log.error("Failed to handle order deliveries: $payloadToStringUtf8", it)
            MessageHandlingAckStatus.NOK_NACK
        }

I believe this would make the highlighted portions give a bit more context, especially when doing a screen sharing session with a person unfamiliar with the code.

This thing already happens for XML, as far as i can see: image

In the case where I would like to highlight the following piece of code (cursor/right click is at position |), this happens just as i want it.

        <Root level="info">
       |     <Appender-Ref ref="CONSOLE_JSON"/>
        </Root>

Your Environment

  • Plugin version: izhangzhihao.rainbow.brackets (6.21)
  • IDE & Operating System version, comment your env as below(go to "About IntelliJ IDEA" -> click the "copy" icon):
IntelliJ IDEA 2021.3 Beta (Ultimate Edition)
Build #IU-213.5605.12, built on November 3, 2021
IntelliJ IDEA EAP User
Expiration date: December 3, 2021
Runtime version: 11.0.13+7-b1751.16 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2126M
Cores: 12
Registry:
    debugger.click.disable.breakpoints=true
    documentation.show.toolbar=true
    debugger.valueTooltipAutoShowOnSelection=true

Non-Bundled Plugins:
    some.awesome (1.14)
    org.nik.presentation-assistant (1.0.9)
    com.jetbrains.ChooseRuntime (1.2)
    com.github.b3er.idea.plugins.arc.browser (0.23)
    uk.co.ben-gibson.remote.repository.mapper (3.3.3)
    com.intellij.kubernetes (213.5605.12)
    BrowseWordAtCaret (3.0.5)
    com.haulmont.jpab (5.8-213)
    izhangzhihao.rainbow.brackets (6.21)
    lermitage.intellij.extra.icons (1.66.0.203)
    AceJump (3.8.4)

Kotlin: 213-1.5.10-release-949-IJ5605.12

TheBestPessimist avatar Nov 17 '21 11:11 TheBestPessimist

Hey @TheBestPessimist :wave:,

Thank you for opening an issue/feature request. We will get back to you as soon as we can. Also, check out our https://opencollective.com/intellij-rainbow-brackets and consider backing us - every little helps!

PS.: We offer priority support for all backers. Don't forget to add priority label when you start backing us :smile: