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 similar text suggestion Code Action(s) for UndefinedObject and UndefinedNamespace #670

Merged

Conversation

AlexXuChen
Copy link
Contributor

@AlexXuChen AlexXuChen commented Jul 6, 2022

Added Qute Did you mean ...? CodeAction(s) for similar text suggestions for UndefinedNamespace, UndefinedObject.

Screenshot from 2022-07-13 14-45-10
Screenshot from 2022-07-28 14-53-35

Fixes #602

Signed-off-by: Alexander Chen alchen@redhat.com

@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 3 times, most recently from d30e985 to 612fead Compare July 8, 2022 18:43
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 3 times, most recently from 92e8ad3 to 9519ca1 Compare July 13, 2022 19:08
Copy link
Member

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Seems to be going in the right direction. Just some things to fix. I would really look at what the difference is between an expression, expressionpart and expressionparts as well as what their structure is like. That should help avoid any casting issues.

[Error - 10:53:06 a.m.] Request textDocument/codeAction failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.ClassCastException: class com.redhat.qute.parser.expression.Parts cannot be cast to class com.redhat.qute.parser.expression.Part (com.redhat.qute.parser.expression.Parts and com.redhat.qute.parser.expression.Part are in unnamed module of loader 'app')
	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.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.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.ClassCastException: class com.redhat.qute.parser.expression.Parts cannot be cast to class com.redhat.qute.parser.expression.Part (com.redhat.qute.parser.expression.Parts and com.redhat.qute.parser.expression.Part are in unnamed module of loader 'app')
	at com.redhat.qute.services.QuteCodeActions.doCodeActionsForSimilarValues(QuteCodeActions.java:368)
	at com.redhat.qute.services.QuteCodeActions.doCodeActions(QuteCodeActions.java:128)
	at com.redhat.qute.services.QuteLanguageService.doCodeActions(QuteLanguageService.java:99)
	at com.redhat.qute.ls.template.TemplateFileTextDocumentService.lambda$codeAction$9(TemplateFileTextDocumentService.java:158)
	at com.redhat.qute.ls.commons.ModelTextDocuments.lambda$computeModelAsyncCompose$2(ModelTextDocuments.java:145)
	... 10 more

@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 3 times, most recently from 2dc0984 to bf8b5f4 Compare July 15, 2022 18:22
Copy link
Member

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Still a bit of work to support spelling errors for an object's properties/methods.

@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch from bf8b5f4 to aea1d0f Compare July 15, 2022 22:33
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 5 times, most recently from 0f13a51 to ee0ed06 Compare July 21, 2022 19:58
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 2 times, most recently from 264f53e to 58df6a2 Compare July 27, 2022 18:59
@angelozerr
Copy link
Contributor

You need to update QuteDiagnosticsInExpressionWithForSectionTest.undefinedObjectInElseBlock:60 expected: <3> but was: <4> because your similar value report a code action with "items" as similar value for "item".

@angelozerr
Copy link
Contributor

angelozerr commented Jul 28, 2022

@AlexXuChen as it required so many changes, I decided to create a draft PR with my suggestions, see my draft PR based on your PR at #682

All tests should work. I have implemented namespace similar value without testing, please write tests like I suggested in #670 (comment)

@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 4 times, most recently from 6e9e99d to 8b5453b Compare July 28, 2022 18:01
@AlexXuChen AlexXuChen marked this pull request as ready for review July 28, 2022 18:02
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 2 times, most recently from 63f121b to b0fb64d Compare July 28, 2022 18:46
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 2 times, most recently from 966d557 to 23ef690 Compare July 28, 2022 19:00
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch 4 times, most recently from 444cc78 to 03fd06f Compare July 29, 2022 13:29
…UndefinedNamespace

Signed-off-by: Alexander Chen <alchen@redhat.com>
@AlexXuChen AlexXuChen force-pushed the issue602-code-action-suggestion branch from 03fd06f to 94fa2de Compare July 29, 2022 13:42
@angelozerr angelozerr changed the title Added Qute CodeAction(s) for similar text suggestions Added similar text suggestion Code Action(s) for UndefinedObject and UndefinedNamespace Jul 29, 2022
@angelozerr angelozerr merged commit 03eec61 into redhat-developer:master Jul 29, 2022
@AlexXuChen AlexXuChen deleted the issue602-code-action-suggestion branch July 29, 2022 13:48
@angelozerr
Copy link
Contributor

Thanks a lot @AlexXuChen !

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.

CodeAction Did you mean ...? for undefined namespace, object, method
3 participants