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

Scope highlight: highlight the "parent PSI" as well #2396

Closed
3 tasks done
TheBestPessimist opened this issue Nov 17, 2021 · 4 comments
Closed
3 tasks done

Scope highlight: highlight the "parent PSI" as well #2396

TheBestPessimist opened this issue Nov 17, 2021 · 4 comments

Comments

@TheBestPessimist
Copy link

TheBestPessimist commented Nov 17, 2021

Please check

  • I already support this project.
  • 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.
  • 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
@open-collective-bot
Copy link

Hey @TheBestPessimist 👋,

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 😄

@TheBestPessimist TheBestPessimist changed the title Scope highlight: highlight the "parent" as well Scope highlight: highlight the "parent PSI" as well Nov 17, 2021
@izhangzhihao
Copy link
Owner

Closed because there was no plan to implement it this way.

@izhangzhihao izhangzhihao closed this as not planned Won't fix, can't repro, duplicate, stale May 6, 2024
@TheBestPessimist
Copy link
Author

@izhangzhihao can i ask why not? To me, having the "function definition" highlighted too seems much more natural when reading a single piece of code.

@izhangzhihao
Copy link
Owner

Considering the significant differences in PSI trees across different languages, it is challenging to create a universal implementation for highlighting "parent PSI." This is because the varying PSI tree structures in different languages would result in completely different user experiences. Given that this is not a universally applicable solution, it is currently not included in the plan.

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

No branches or pull requests

2 participants