Skip to content

[Spring Data Queries] Show document highlights when the cursor is at query parameter AST node #1332

Closed

Description

@BoykoAlex

All Spring Data Query whether it is JPQL/HQL or a native SQL query support parameters coming from java code. Typically @Query annotates a method, then :1 or ?2 found in the query would stand for the first and second parameter of the Java method respectively. It's be useful to show the Java parameter and its usage in Java code once the cursor is at the parameter node (or perhaps when hovering the mouse over that node).
LSP has Document Highlights feature that we could try using for this scenario

Activity

  1. added this to the 4.26.0.RELEASE milestone on Aug 23, 2024
  2. BoykoAlex commented on Aug 28, 2024

    @BoykoAlex
    ContributorAuthor

    Fixed with 0063608. Only highlights method parameter. These methods are inside an interface typically so no need to go through the method body. Works in VSCode but in Eclipse Java editor LSP support is required

  3. martinlippert commented on Aug 28, 2024

    @martinlippert
    Member

    @BoykoAlex Let's track the missing support in the Eclipse Java source editor as a separate issue.

  4. martinlippert commented on Aug 28, 2024

    @martinlippert
    Member

    Feels like we should also cover additional cases as well. If you have a query string like:

    "SELECT DISTINCT owner FROM Owner owner left join  owner.pets WHERE owner.lastName LIKE :lastName% "
    

    we should highlight all occurrences of owner when you have the cursor inside of of the occurrences.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: vscodetheme: spring-data-supporttype: enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions