Skip to content

add Spring Data JPA Content Assist to STS 4 #107

Closed

Description

@ismailsalloo

Has Spring Data JPA Content Assist been removed from STS 4? In version 3 I was able to use content assist to show what fields were allowed to be part of the name of the method when using Query Methods. Has it been removed / not added to STS4 or is it a bug or disabled by default?

Activity

  1. kdvolder commented on Oct 9, 2018

    @kdvolder
    Member

    Possibly, but I am not totally sure what you are exactly referring to. So, can you give a concrete example of something that used to work and now doesn't anymore? With "concrete", I mean with some code sample and a bit of explanation exactly what you expect to work.

    We may consider trying to somehow 'rescue' the feature from the old code-base or re-implement it from scratch, but we need to know what you are actually talking about first. Oh, and thanks for the report, we rely on these reports to determine which parts of the old tooling people are really missing.

  2. thackel commented on Oct 9, 2018

    @thackel

    I can confirm that the Spring-Data JPA Content assist is not working anymore.

    When editing JPA Repositories, STS is no longer providing completion for possible fields of the entity.

    Here is the original feature ticket for older versions which describe the functionality: https://jira.spring.io/browse/IDE-1249

  3. ismailsalloo commented on Oct 9, 2018

    @ismailsalloo
    Author

    Possibly, but I am not totally sure what you are exactly referring to. So, can you give a concrete example of something that used to work and now doesn't anymore? With "concrete", I mean with some code sample and a bit of explanation exactly what you expect to work.

    We may consider trying to somehow 'rescue' the feature from the old code-base or re-implement it from scratch, but we need to know what you are actually talking about first. Oh, and thanks for the report, we rely on these reports to determine which parts of the old tooling people are really missing.

    I'm attaching screenshots of what code completion looks like in STS 3 vs STS 4 (specifically around JPA Query Methods)

    STS 3:
    sts3

    STS 4:
    sts4

  4. ismailsalloo commented on Oct 9, 2018

    @ismailsalloo
    Author

    I can confirm that the Spring-Data JPA Content assist is not working anymore.

    When editing JPA Repositories, STS is no longer providing completion for possible fields of the entity.

    Here is the original feature ticket for older versions which describe the functionality: https://jira.spring.io/browse/IDE-1249

    This pretty much sums up what's missing :-)

  5. kdvolder commented on Oct 9, 2018

    @kdvolder
    Member

    Thanks for the reference and the screenshots. That helps to know what is being talked about here.

    Now, I'm pretty sure we are not going to re-implement or 'rescue' all of that as it was before because it seems much of it was specific to beans defined by XML.

    From the screenshots, am I correct in assuming you are really mostly interested in the content assist and validations in Java context? WE might be able to re-implement that, though I suspect it will have to be done mostly from scratch. (Not saying we won't do it, we might, but it could take some time as its not a trivial feature to re-implement).

  6. martinlippert commented on Oct 9, 2018

    @martinlippert
    Member

    This is indeed a feature of the Spring Data support in STS 3.9.x that we didn't re-implement for STS4 yet. This is due to the fact that the Spring support in STS4 is a complete re-write and we focused on specific pieces first (instead of "blindly" re-implementing everything from the old tooling). So this piece didn't make it into the first version of the all-new Spring Tools 4.

    We should add this to the backlog in order to bring this content-assist for Spring Data repositories back - maybe in an even better shape than we had before... :-)

  7. ismailsalloo commented on Oct 9, 2018

    @ismailsalloo
    Author

    Thanks for the reference and the screenshots. That helps to know what is being talked about here.

    Now, I'm pretty sure we are not going to re-implement or 'rescue' all of that as it was before because it seems much of it was specific to beans defined by XML.

    From the screenshots, am I correct in assuming you are really mostly interested in the content assist and validations in Java context? WE might be able to re-implement that, though I suspect it will have to be done mostly from scratch. (Not saying we won't do it, we might, but it could take some time as its not a trivial feature to re-implement).

    Yes, we mainly work within the Java context nowadays. Can't remember when last I defined a bean via XML :-)

  8. ismailsalloo commented on Oct 9, 2018

    @ismailsalloo
    Author

    This is indeed a feature of the Spring Data support in STS 3.9.x that we didn't re-implement for STS4 yet. This is due to the fact that the Spring support in STS4 is a complete re-write and we focused on specific pieces first (instead of "blindly" re-implementing everything from the old tooling). So this piece didn't make it into the first version of the all-new Spring Tools 4.

    We should add this to the backlog in order to bring this content-assist for Spring Data repositories back - maybe in an even better shape than we had before... :-)

    I'm pretty impressed with STS 4 at the moment. Looking forward to what's in store for the future

  9. martinlippert commented on Oct 15, 2018

    @martinlippert
    Member

    @ismailsalloo Anything specific you are looking for with regards to the Spring Data content-assist? Just the Spring Data query method completions? Or something else in addition to that?

  10. ismailsalloo commented on Oct 15, 2018

    @ismailsalloo
    Author

    @ismailsalloo Anything specific you are looking for with regards to the Spring Data content-assist? Just the Spring Data query method completions? Or something else in addition to that?

    I mainly used it for query method completions. It would be cool if syntax within a @query annotation could also be validated.

  11. martinlippert commented on Oct 16, 2018

    @martinlippert
    Member

    @ismailsalloo What exactly do you mean with syntax validation within a @query annotation? Can you provide a few examples?

    Since we try to stay away from validations to avoid annoying users with false warnings, I would like to understand this in more detail first.

  12. ismailsalloo commented on Oct 16, 2018

    @ismailsalloo
    Author

    @ismailsalloo What exactly do you mean with syntax validation within a @query annotation? Can you provide a few examples?

    Since we try to stay away from validations to avoid annoying users with false warnings, I would like to understand this in more detail first.

    @martinlippert, I understand the annoyance behind false validations. It also gets to me at times.

    Basically my idea is not too much different from the query method suggestion. I was thinking of something to the effect where as you start typing your query within the @query annotation, based on your entity structure, STS provides the user with suggestions of what fields you can extract within your query as well as what fields you can use in your search criteria. In addition to that, if you have a number field within your search criteria, the method param that it maps to must be of type number. I know it's pie in the sky, but it would be super awesome to have that functionality in STS.

    I hope I'm making sense

  13. martinlippert commented on Oct 16, 2018

    @martinlippert
    Member

    @ismailsalloo Thanks for the details, this content-assist support for the values in the annotation sounds indeed quite useful and like an awesome feature, thanks a lot for the suggestion. Will put that on the list of things to consider for future versions.

  14. added this to the 4.1.0 milestone on Oct 16, 2018
  15. ismailsalloo commented on Oct 16, 2018

    @ismailsalloo
    Author

    @ismailsalloo Thanks for the details, this content-assist support for the values in the annotation sounds indeed quite useful and like an awesome feature, thanks a lot for the suggestion. Will put that on the list of things to consider for future versions.

    @martinlippert thanks for taking out time to respond to my query and possibly having it included in the future :-)

  16. 15 remaining items

  17. shahrk commented on Apr 4, 2021

    @shahrk

    @martinlippert how should I get started. I'd like to help with this feature. I really think it is essential.

  18. martinlippert commented on Apr 6, 2021

    @martinlippert
    Member

    @shahrk Sounds great, your help on this one would be very welcome.

    This is the class that implements the existing, but very limited content-assist for Spring Data repositories:
    https://github.com/spring-projects/sts4/blob/master/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/data/DataRepositoryCompletionProcessor.java

    Here is a simple test case for that implementation:
    https://github.com/spring-projects/sts4/blob/master/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/data/test/DataRepositoryCompletionProcessorTest.java

    The first step to make some progress here would be to get a workspace up that contains the projects. The easiest way would be, most likely, so import all the projects in the headless-services directory as Maven project into a fresh workspace.

    The second step would be to get the existing test running (Run as -> JUnit Test).

    The unit test case uses this:
    https://github.com/spring-projects/sts4/tree/master/headless-services/spring-boot-language-server/src/test/resources/test-projects/test-spring-data-symbols

    as a test project to work against.

    This line in the test prepares the content of the editor:
    https://github.com/spring-projects/sts4/blob/master/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/data/test/DataRepositoryCompletionProcessorTest.java#L55

    By adding the <*> to the content of the editor the test knows where the cursor position is. Then you basically invoke the content-assist on the editor by asking it for all the completions and see if the result is what you would expect.

    The infrastructure around this "asking the editor for all the completions" doesn't allow you to specify all the things yet that a completion request to the language server could contain (like a prefix, etc.), so you might want to add that to the infrastructure as you need it.

    If you decide to work on this, please make sure you accept the CLA upfront and then submit PRs. Also feel free to submit several small PRs instead of one big. That would make reviewing them easier.

    Hope that helps to get started with this!

  19. removed this from the 4.1.0.RELEASE milestone on Aug 22, 2022
  20. added a commit that references this issue on Feb 20, 2023
    a880498
  21. danthe1st commented on Feb 21, 2023

    @danthe1st
    Contributor

    I have created a PR for this. I hope it is useful.

  22. martinlippert commented on Feb 21, 2023

    @martinlippert
    Member

    I have created a PR for this. I hope it is useful.

    Absolutely, this is truly awesome. I asked @BoykoAlex to review and provide feedback, so that we can get this into the next release. 😀

  23. added a commit that references this issue on Feb 21, 2023
    366f715
  24. added this to the 4.18.0.RELEASE milestone on Feb 24, 2023
  25. added
    for: eclipse
    for: vscode
    on Feb 24, 2023
  26. martinlippert commented on Feb 24, 2023

    @martinlippert
    Member

    I will mark this as closed and fixed for now, due to the contribution from @danthe1st. Many thanks for that again!!!

  27. martinlippert commented on Feb 24, 2023

    @martinlippert
    Member

    Further improvements to the content-assist should be captured in separate issues.

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: eclipsefor: vscodetheme: code completiontheme: spring-data-supporttheme: sts3-feature-requesttype: enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions