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

Ignore synthetic method in Qute template #723

Closed
datho7561 opened this issue Aug 25, 2022 · 7 comments · Fixed by #724
Closed

Ignore synthetic method in Qute template #723

datho7561 opened this issue Aug 25, 2022 · 7 comments · Fixed by #724
Labels
Milestone

Comments

@datho7561
Copy link
Contributor

Give the following template:

{@java.lang.String myString}

{myString.|}

If you open completion at the |, there are two completion results (lambda$chars$0, and lambda$codePoints$1) that refer to lambdas defined in CharSequence. When you go to apply one of these completion results, it inserts just the word lambda, which results in a broken Qute template.

Additionally, if you type out the entire suggestion manually:

{@java.lang.String myString}

{myString.lambda$chars$0}

No error is reported in the file.

@angelozerr
Copy link
Contributor

We should check if Qute can support lambda and if it is supported is it expected?

@mkouba have you some idea about using lambda in Qute template?

@mkouba
Copy link
Collaborator

mkouba commented Aug 26, 2022

We should check if Qute can support lambda and if it is supported is it expected?

@mkouba have you some idea about using lambda in Qute template?

Lambdas are not supported and there's no plan to add the support so far.

I think that the code completion should ignore all synthetic/bridge, void, non-public methods.

@angelozerr
Copy link
Contributor

Lambdas are not supported and there's no plan to add the support so far.

Thanks for your info.

I think that the code completion should ignore all synthetic/bridge, void, non-public methods.

It should work like this.

@angelozerr
Copy link
Contributor

I think the fix should be done here

by adding a condition with lambda method:

if (method.isConstructor() || !method.exists() || method.isLambdaMethod()) {

@angelozerr
Copy link
Contributor

angelozerr commented Aug 26, 2022

It doesn't work. @rgrunber do you know how to filter those lamnda method. For instance with this method (named lambda$codePoint$1)
image

method.isLambdaMethod() returns false? Have you some idea how to filter those lambda methods?

@mkouba
Copy link
Collaborator

mkouba commented Aug 26, 2022

It should work like this.

I don't see a check for synthetic methods there. Maybe just add something like Modifier.isSynthetic(method.getFlags())? I've never worked with org.eclipse.jdt before so I might be completely wrong...

@angelozerr
Copy link
Contributor

Flags.isSynthetic(method.getFlags()) seems working, thank a lot @mkouba for your great suggestion!

@angelozerr angelozerr changed the title Completion for String methods in Qute template includes some lambdas Ignore synthetic method in Qute template Aug 26, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Aug 26, 2022
Fixes redhat-developer#723

Signed-off-by: azerr <azerr@redhat.com>
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Aug 26, 2022
Fixes redhat-developer#723

Signed-off-by: azerr <azerr@redhat.com>
@angelozerr angelozerr added this to the 0.13.0 milestone Aug 26, 2022
angelozerr pushed a commit to angelozerr/quarkus-ls that referenced this issue Aug 26, 2022
Fixes redhat-developer#723

Signed-off-by: azerr <azerr@redhat.com>
datho7561 pushed a commit that referenced this issue Aug 26, 2022
Fixes #723

Signed-off-by: azerr <azerr@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants