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

Added Qute CodeAction(s) for similar text suggestions for UnknownProperty. #713

Merged

Conversation

angelozerr
Copy link
Contributor

Added Qute CodeAction(s) for similar text suggestions for UnknownProperty.

Part of #602

Signed-off-by: azerr azerr@redhat.com

@angelozerr
Copy link
Contributor Author

The PR can be reviewed now. I did some refactoring to avoid creating a temporary list of similar values.

Here a demo with unkwonw property with field, getter and template extension:

CodeActionSimilarForUnkwownProperty

@datho7561
Copy link
Contributor

datho7561 commented Aug 25, 2022

When I place my cursor on a misspelled method, I get a code action failure:

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.redhat.qute.services.nativemode.JavaTypeAccessibiltyRule.isIgnoreSuperClasses()" because "rule" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "com.redhat.qute.services.nativemode.JavaTypeAccessibiltyRule.isIgnoreSuperClasses()" because "rule" is null
	at com.redhat.qute.services.nativemode.NativeModeJavaTypeFilter.isIgnoreSuperclasses(NativeModeJavaTypeFilter.java:139)
	at com.redhat.qute.services.codeactions.AbstractQuteCodeAction.isIgnoreSuperclasses(AbstractQuteCodeAction.java:120)
	at com.redhat.qute.services.codeactions.QuteCodeActionForUnknownMethod.collectSimilarCodeActionsForJavaMethods(QuteCodeActionForUnknownMethod.java:126)
	at com.redhat.qute.services.codeactions.QuteCodeActionForUnknownMethod.collectSimilarCodeActionsForJavaMethods(QuteCodeActionForUnknownMethod.java:133)
	at com.redhat.qute.services.codeactions.QuteCodeActionForUnknownMethod.doCodeActionsForSimilarValues(QuteCodeActionForUnknownMethod.java:101)
	at com.redhat.qute.services.codeactions.QuteCodeActionForUnknownMethod.doCodeActions(QuteCodeActionForUnknownMethod.java:71)
	at com.redhat.qute.services.QuteCodeActions.doCodeActions(QuteCodeActions.java:109)
	at com.redhat.qute.services.QuteLanguageService.doCodeActions(QuteLanguageService.java:104)
	at com.redhat.qute.ls.template.TemplateFileTextDocumentService.lambda$codeAction$9(TemplateFileTextDocumentService.java:164)
	at com.redhat.qute.ls.commons.ModelTextDocuments.lambda$computeModelAsyncCompose$1(ModelTextDocuments.java:144)
	... 7 more

@angelozerr angelozerr force-pushed the code-action-suggestion-property branch from 3f4313c to e4161f1 Compare August 25, 2022 19:23
`UnknownProperty`.

Part of redhat-developer#602

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr
Copy link
Contributor Author

When I place my cursor on a misspelled method, I get a code action failure:

It should be fixed.

@datho7561
Copy link
Contributor

This also has the same bug as #723. If you take:

{@java.lang.String myString}

{myString.lambda$cha$0()}

It will suggest the lambda method

@angelozerr
Copy link
Contributor Author

This also has the same bug as #723. If you take:

Lets fix this corner usecase in #723

@angelozerr
Copy link
Contributor Author

This also has the same bug as #723. If you take:

It should be fixed with #724

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to also filter the similar method suggestions based on the parameters that are currently being supplied to the method, eg.

{myString.char(1)}

It makes more sense to suggest charAt(int pos) in this case then chars()

However, I think that we could leave this for a future PR.

@angelozerr
Copy link
Contributor Author

It'd be nice to also filter the similar method suggestions based on the parameters that are currently being supplied to the method, eg.

I agree but this PR is about UnknownProperty. Your suggestion is for UnknownMethod. Please create an issue for that.

@datho7561
Copy link
Contributor

I agree but this PR is about UnknownProperty. Your suggestion is for UnknownMethod. Please create an issue for that.

Oops, that's my bad. I've just been testing methods

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@datho7561 datho7561 merged commit 5322071 into redhat-developer:master Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants