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

Implement labelDetails for CompletionItem #2556

Merged

Conversation

JessicaJHee
Copy link
Contributor

Fixes #2476

@JessicaJHee
Copy link
Contributor Author

Once we decide on the preferred look of this, I will update the tests to reflect the new behavior.

Current implementation:
Screenshot from 2023-03-24 15-29-15

@rgrunber
Copy link
Contributor

There's no telling how other clients may implements this, but here's what it looks like in VS Code. Some details do seem a bit redundant. For example, I don't think we need to mention the method signature twice. Maybe we need to hide certain things when we know labelDetails is supported.

Before
completion-vscode-current
After
completion-vscode-labeldetails

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 51a7022 to 9bc06eb Compare March 29, 2023 21:10
@JessicaJHee
Copy link
Contributor Author

Updated the behavior to remove the duplicate information and only show the declaring class on the right hand side.

image

@rgrunber
Copy link
Contributor

Maybe the label detail description (the element on the far right of the list) should incldue the fully qualified name ? Also, I notice isCompletionItemLabelDetailsSupport() isn't being called in any of the places we set the label details. I think we should still use it since we don't know if a client supports it.

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 9bc06eb to 0508204 Compare March 30, 2023 00:17
@jdneo
Copy link
Contributor

jdneo commented Mar 31, 2023

We received some user feedbacks that hope to show the return type of the method at right (That's also the way that IDEA displays the completion list)

image

The return type will disappear if the item has a long display content in our current implementation. And the situation may become worse if we display declaring type as detail.

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 0508204 to a2d9015 Compare April 3, 2023 17:23
@JessicaJHee
Copy link
Contributor Author

Here is the updated behavior for each use case:

createLabelWithTypeAndDeclaration

image

createMethodProposalLabel

image

createSimpleLabelWithType

image

createTypeProposalLabel

image

createJavadocTypeProposalLabel

image

createPackageProposalLabel

image

createAnonymousTypeLabel

image

createOverrideMethodProposalLabel

image

@jdneo
Copy link
Contributor

jdneo commented Apr 4, 2023

This looks pretty good!

One more case is about the snippets. We can put descriptions of the snippet as detail maybe.

IDEA example:

image

There is a list for postfix which might be helpful: #2288 (comment)

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from a2d9015 to 2afa83f Compare April 4, 2023 18:10
@JessicaJHee
Copy link
Contributor Author

Currently we have the description of the template shown on the right hand side:

For snippets:
image

For postfix:
image

I think this is helpful, but I can also make the change so it shows the evaluated snippet pattern instead (like how it works in IJ). What do you think? @rgrunber @jdneo

@jdneo
Copy link
Contributor

jdneo commented Apr 6, 2023

Looks good!

IJ shows description for general snippets and evaluated content for postfixes.

I think using descriptions are fine for now and we can change it if users ask.

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 2afa83f to 96ecbe0 Compare April 6, 2023 20:49
@JessicaJHee JessicaJHee marked this pull request as ready for review April 6, 2023 20:49
@rgrunber rgrunber self-requested a review April 6, 2023 21:20
@jdneo
Copy link
Contributor

jdneo commented Apr 10, 2023

Another feedback about UX. Currently the constructors will show the return type as void:

image

I'm thinking that, since the constructors in Java are always void, is it necessary to show it in the list? Looks like it does not provide much useful information to users. Leave it empty to make the list panel clearer might be better.

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 96ecbe0 to 96b220e Compare April 11, 2023 18:51
@rgrunber rgrunber mentioned this pull request Apr 12, 2023
@rgrunber
Copy link
Contributor

rgrunber commented Apr 12, 2023

Change looks pretty good from trying it out. The only thing we are losing is the ability to know the declaring class of a given method declaration, and only when it is selected :

completion-vscode-current

I think this is pretty minor though. I also noticed that the class snippet has no detail set but that's an existing issue that could be fixed outside this change.

@JessicaJHee JessicaJHee force-pushed the 2476-completion-item-labelDetails branch from 96b220e to 12fbc7d Compare April 12, 2023 12:56
@rgrunber rgrunber merged commit eed1621 into eclipse-jdtls:master Apr 12, 2023
@JessicaJHee
Copy link
Contributor Author

@jdneo @rgrunber Thanks very much for the thorough review!

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.

Implement labelDetails for CompletionItem
3 participants