Skip to content

Symbols view should nest elements by their surrounding scope #1431

Closed

Description

@odrotbohm

For a Spring MVC controller class like this:

@Controller
class MyController {

  @GetMapping("/path")
  void foo(@RequestParam String bar) {

  }
}

the Spring Symbols view creates multiple top-level entries:

It would be nice if the elements were nested inside each other. The parameter annotation as a nested node underneath the method, that in turn underneath the bean etc. Otherwise (and currently) you might end up with a gazillion of @RequestParam list entries that – without that contextual information – are not really helpful on their own.

Activity

  1. added
    for: eclipse
    for: vscode
    and removed on Dec 6, 2024
  2. added this to the Backlog milestone on Dec 6, 2024
  3. self-assigned this
    on Dec 6, 2024
  4. added a commit that references this issue on Jan 15, 2025
  5. martinlippert commented on Feb 5, 2025

    @martinlippert
    Member

    There is bit of groundwork necessary to fully materialize this on the UI side, but the groundwork is already underway. I hope for the hierarchical view of symbols to appear in the outline view of VSCode as the first step (probably for the 4.29.0 release), then the work continues for the remaining UI work for 4.30.0 or 4.31.0 - just as a quick update.

  6. added 2 commits that reference this issue on Feb 20, 2025
  7. 7 remaining items

  8. added 2 commits that reference this issue on Feb 26, 2025
  9. martinlippert commented on Feb 27, 2025

    @martinlippert
    Member

    @odrotbohm There is a (very specific) way to play around with early steps here.

    • you need to use VSCode with the Java and Spring Boot Tools extension installed
    • you need to switch the Spring Boot Tools extension to the "pre-release" version (there is a button for that in the extension page in VSCode)
    • you need to set a specific preference via: Settings -> Extensions -> Spring Boot Tools -> Language Server -> Spring-boot-LS-Java-Vmware, and add -DoutlineSymbolsFromIndex=true

    Then, you can restart VSCode and import your project. The new hierarchical structure will then show up for one file only in the outline section under the Spring Boot Tools node of the tree. This works for single files only at the moment, but it should give you a good idea about how the hierarchical structural view will look like for a single file.

    You could imagine that the separate structural view would then show the project perspective, but below the project nodes for each file (the tree structure that you see in the outline view).

    This is very early days and it needs a lot of polishing and improvements on various levels. But feel free to give it a try and report back what you stumble upon, what should be incorporated into the structure, what is missing, how to display it differently, etc. At the moment the exact label for each node is more or less what we also create for the workspace symbols, but I assume that those structural view nodes should get their own, slightly different label over time.

  10. martinlippert commented on Feb 27, 2025

    @martinlippert
    Member

    One more thing: There is a setting for directing the log output of the language server to a log file. Would be great to set that, just in case something goes wrong. The log output might help in that case.

  11. odrotbohm commented on Feb 27, 2025

    @odrotbohm
    MemberAuthor

    The new hierarchical structure will then show up for one file only in the outline section under the Spring Boot Tools node of the tree.

    Can you elaborate where I would find this? What does "the tree" refer to here? In the Spring Boot Dashboard view I only see the sections "Apps", "Beans", and "Endpoint Mappings".

  12. odrotbohm commented on Feb 27, 2025

    @odrotbohm
    MemberAuthor

    Never mind. Found it.

  13. odrotbohm commented on Feb 27, 2025

    @odrotbohm
    MemberAuthor

    This looks nice already. A few things that caught my eye:

    • Spring Data repositories could list the query methods in a nested way?
    • Not all Spring components cause a Spring Boot Tools node to appear in the outline (for example, PaymentServiceImpl in Restbucks does not)
    • The hover text of a bean node ends with "(interface)" even if the bean node is a class (for example PaymentController in Restbucks)
  14. martinlippert commented on Feb 27, 2025

    @martinlippert
    Member
    • Spring Data repositories could list the query methods in a nested way?

    How do you identify a query method and distinguish such a method from another, non-query method? Can you point me to the code in Spring Data that identifies query methods? That way, I could mimic that logic inside the tools.

    • Not all Spring components cause a Spring Boot Tools node to appear in the outline (for example, PaymentServiceImpl in Restbucks does not)

    Will take a look.

    • The hover text of a bean node ends with "(interface)" even if the bean node is a class (for example PaymentController in Restbucks)

    Will look into this as well.

    Thanks a lot for the early feedback, very much appreciated. Feel free to add more thoughts here anytime.

  15. martinlippert commented on Feb 27, 2025

    @martinlippert
    Member
    • Not all Spring components cause a Spring Boot Tools node to appear in the outline (for example, PaymentServiceImpl in Restbucks does not)

    PaymentServiceImpl is annotated with a Service annotation from JMolecules, not Spring. This is at least the reason why the tooling doesn't recognize it as a bean. How does it turn into a bean? Feels like I need to treat since as a regular @Component annotated class, but how can the tooling decide this?

    • The hover text of a bean node ends with "(interface)" even if the bean node is a class (for example PaymentController in Restbucks)

    This comes from the SymbolKind constant that we use here, so VSCode adds the symbol kind to the hover automatically (no way to prevent that), so we need to be more precise about which SymbolKind we choose for each individual symbol or index element.

  16. martinlippert commented on May 22, 2025

    @martinlippert
    Member

    With the switch made in #1557, this is done for document symbols - based on the new indexing - and enabled by default.

    Additional work to provide this kind of hierarchical structure on the project or workspace level is still underway.

  17. odrotbohm commented on May 22, 2025

    @odrotbohm
    MemberAuthor

    Any ETA on when builds will reach the snapshot repo?

  18. martinlippert commented on May 22, 2025

    @martinlippert
    Member

    Any ETA on when builds will reach the snapshot repo?

    Already available... :-)

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

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: spring index & symbolstheme: structural viewtype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions