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

Do not give CodeActions for stale diagnostics #694

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

rgrunber
Copy link
Member

@rgrunber rgrunber commented Aug 4, 2022

Signed-off-by: Roland Grunberg rgrunber@redhat.com

See eclipse/lsp4mp#273 . It turns out we have the same issue in Qute templates. As @angelozerr mentions, if you have a template like :

{#for item in items}
{/for}

and change items quickly, it can occur.

[Error - 2:59:06 p.m.] Request textDocument/codeAction failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.ClassCastException: class com.redhat.qute.parser.template.sections.ForSection cannot be cast to class com.redhat.qute.parser.expression.ObjectPart (com.redhat.qute.parser.template.sections.ForSection and com.redhat.qute.parser.expression.ObjectPart 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$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.template.sections.ForSection cannot be cast to class com.redhat.qute.parser.expression.ObjectPart (com.redhat.qute.parser.template.sections.ForSection and com.redhat.qute.parser.expression.ObjectPart are in unnamed module of loader 'app')
	at com.redhat.qute.services.codeactions.QuteCodeActionForUndefinedObject.doCodeActions(QuteCodeActionForUndefinedObject.java:77)
	at com.redhat.qute.services.QuteCodeActions.doCodeActions(QuteCodeActions.java:98)
	at com.redhat.qute.services.QuteLanguageService.doCodeActions(QuteLanguageService.java:101)
	at com.redhat.qute.ls.template.TemplateFileTextDocumentService.lambda$codeAction$9(TemplateFileTextDocumentService.java:161)
	at com.redhat.qute.ls.commons.ModelTextDocuments.lambda$computeModelAsyncCompose$1(ModelTextDocuments.java:144)
	... 7 more

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
@rgrunber rgrunber added the bug Something isn't working label Aug 4, 2022
@angelozerr angelozerr merged commit 41da2c7 into redhat-developer:master Aug 4, 2022
@angelozerr
Copy link
Contributor

It works like a charm, thanks @rgrunber !

@angelozerr angelozerr added this to the 0.13.0 milestone Aug 4, 2022
@rgrunber rgrunber deleted the stale-diagnostics branch August 4, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants