redhat-developer / quarkus-ls

Language server for Quarkus tooling
Eclipse Public License 2.0
44 stars 15 forks source link

Support for Evaluation of CompletionStage and Uni Objects #832

Closed angelozerr closed 1 year ago

angelozerr commented 1 year ago

Support for Evaluation of CompletionStage and Uni Objects

Fixes #826

angelozerr commented 1 year ago

Here the file that I have used for test:

{@java.util.concurrent.CompletableFuture<java.util.List<String>> items}

{#for item in items}
    {item.blank}
{/for}

and here a demo:

CompletionStageDemo

angelozerr commented 1 year ago

I notice that there are some trouble when the expected items is not an iterable like:

{@String items}

{#for item in items}
    {item.blank}
{/for}

We have a popup error when we try to hover name property, teh inlay hint shows String after item although it should not show the type. I need to investigate the problem.

But I think the problem is the same in master.

angelozerr commented 1 year ago

We have a popup error when we try to hover name property, teh inlay hint shows String after item although it should not show the type. I need to investigate the problem.

It should be fixed.

angelozerr commented 1 year ago

Ok the PR can be reviewed now. I have wrotten a lot of tests, so I'm more confident to integrate it in the release.

@fbricon @datho7561 @JessicaJHee please play with my PR to check I have not broken something.

datho7561 commented 1 year ago

Doesn't seem to be working for me:

uni-auto-await-not-working

datho7561 commented 1 year ago

Actually, the completion is working, the code lens for the {#if is working, but the validation is not working. Another case where it's broken:

method-invocation-uni

angelozerr commented 1 year ago

@datho7561 is the sample https://github.com/redhat-developer/quarkus-ls/pull/832#issuecomment-1487002171 is working for you?

angelozerr commented 1 year ago

Could you share your sample please.

datho7561 commented 1 year ago

CompletionStagePOJO.java

package org.acme;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import io.smallrye.mutiny.Uni;

public class CompletionStagePOJO {
    public Uni<List<String>> getMyStrings() {
        return Uni.createFrom().item(Arrays.asList("my string", "my other string"));
    }

    public CompletableFuture<List<String>> getOtherStrings() {
        return CompletableFuture.completedFuture(Arrays.asList("my string", "my other string"));
    }
}

completion-stage-template.html

{@org.acme.CompletionStagePOJO obj}

{#for stringElt in obj.myStrings}
    {stringElt.codePointAt(0)}
{/for}

{obj.myStrings.add("sandwich")}
angelozerr commented 1 year ago

Doesn't seem to be working for me:

It should working now, I didn't the cover of Java Type returned by a method. Thanks for haved testing this usecase.