You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR adds more Content Assist options for Spring JPA Repository interfaces.
It adds simple text completions, e.g. a content assist is provided for countBy and automatically completes the return type and parameters of a method if it is named correctly.
2023-02-20_16-43-21.mp4
Aside from that, it includes a small fix allowing for primitive properties and also boolean properties if their getter names start with is.
To do:
Order/priorize completion proposals if possible (put text proposals at the bottom of the proposal list) - I am unsure whether this is possible does not seem to be possible without significant modifications and Eclipse seems to order it in a sensitive way anyways
more tests :)
split up some methods for better readability
Add completion proposals for property names (e.g. findByFirst should could completed to findByFirstName)
improve content assist for complex types that are indirectly referenced findByEmployee_FirstName so that it detects the type
complete partial attribute names (e.g. complete findByFirst to findByFirstName)
Future work:
The keywords In/IsIn should make the method expect a collection whereas Includes/... should expect a single element when a collection is on the left
create text-completions for keywords
Should there be a method/configuration for enabling/disabling these content assist options (e.g. enable some but not others)? If so, where/how are such things implemented in this project?
@danthe1st Generally it all looks good to me. I suspect that the way to use it would be first type in the query keyword with a help of content assist (query proposals) then invoke content assist once query string is completed to fill in the rest for the method declaration (method proposals). Is this correct?
I'm going to squash the commits into one before merging. Hope this is okay with you
Yes, it does complete the signature of already existing queries once they are typed (if those refer to unknown attributes, it uses Object as the parameter).
Aside from that, it also autocompletes simple query method subjects like findFirst and tries to provide conpletions for attribute names. This us done via text completions.
I decided to return Lists (except for streamBy) in the query methods. I hope that's a sensible choice.
As seen in the Future work section, there still potential to improve it (e.g. keywords are not yet completed and it uses the wrong type for predicates like In) but I decided that those things could be done in upcoming PRs.
I'm going to merge this PR as is squashed and rebased. It looks like we could factor some static stuff into spring beans but we can do it later as more PRs in this area are merged
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #107
This PR adds more Content Assist options for Spring JPA Repository interfaces.
It adds simple text completions, e.g. a content assist is provided for
countBy
and automatically completes the return type and parameters of a method if it is named correctly.2023-02-20_16-43-21.mp4
Aside from that, it includes a small fix allowing for primitive properties and also boolean properties if their getter names start with
is
.To do:
Order/priorize completion proposals if possible (put text proposals at the bottom of the proposal list) - I am unsure whether this is possibledoes not seem to be possible without significant modifications and Eclipse seems to order it in a sensitive way anywaysfindByFirst
should could completed tofindByFirstName
)findByEmployee_FirstName
so that it detects the typefindByFirst
tofindByFirstName
)Future work:
In
/IsIn
should make the method expect a collection whereasIncludes
/... should expect a single element when a collection is on the leftShould there be a method/configuration for enabling/disabling these content assist options (e.g. enable some but not others)? If so, where/how are such things implemented in this project?