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

Add support for LSP-standard TypeHierarchy #2769

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

mickaelistria
Copy link
Contributor

But keep legacy command which is still used by vscode-java.

Also-by: Mickael Istria [email protected]

But keep legacy command which is still used by vscode-java.

Signed-off-by: Shi Chen <[email protected]>
Also-by: Mickael Istria <[email protected]>
@mickaelistria
Copy link
Contributor Author

/cc @CsCherrYY this is an adaptation of your patch in #2033 , retaining existing typehierarchy commands so those can still be used by vscode-java. This patch would allow other clients to benefit from LSP-standard type hierarchy without breaking vscode-java.

@rgrunber rgrunber self-requested a review July 25, 2023 12:33
@rgrunber rgrunber self-assigned this Jul 25, 2023
@rgrunber rgrunber added this to the End August 2023 milestone Jul 27, 2023
Copy link
Contributor

@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.

Looks fine to me.

I did notice that we don't check if the client supporst the type hierarchy client capability from initialize, but we also don't seem to do it for the call hierarchy provider, so I guess we can leave it like this for now.

Given that Eclipse IDE intends to support, and vscode-languageclient already does (but I think we are overriding it with our delegate use) it should be fine for now.

@rgrunber rgrunber merged commit e843c2c into eclipse-jdtls:master Aug 23, 2023
@mickaelistria
Copy link
Contributor Author

Thank you!

@mickaelistria
Copy link
Contributor Author

Unfortunately, build https://ci.eclipse.org/ls/job/jdt-ls-master/1789/ has failed. Is this related?

@testforstephen
Copy link
Contributor

Looks fine to me.

I did notice that we don't check if the client supporst the type hierarchy client capability from initialize, but we also don't seem to do it for the call hierarchy provider, so I guess we can leave it like this for now.

Given that Eclipse IDE intends to support, and vscode-languageclient already does (but I think we are overriding it with our delegate use) it should be fine for now.

image

In VS Code, we see two "show type hierarchy" menus with this PR merged. Apparently we need a client flag to control whether to register type hierarchy in init handler.

@rgrunber
Copy link
Contributor

Right. Then we definitely need it for clients to behave correctly.

@mickaelistria
Copy link
Contributor Author

I just tried and confirm it's working well in Eclipse IDE!

Apparently we need a client flag to control whether to register type hierarchy in init handler.

I hope flag to disable standard operations will be opt-out (so clients that do support standard LSP won't have to enable anything particular, others will have to set the flag to disable LSP's standard typeHierarchy).

But at this stage, wouldn't it be simpler on mid-term for VSCode-Java to also adopt the LSP official TypeHierarchy? What's missing in it to retain the legacy command?

@testforstephen
Copy link
Contributor

The standard LSP only supports supertype and subtypes, but no class hierarchy view. The current vscode-java supports 3 different views, and keep it to avoid feature loss.

@rgrunber
Copy link
Contributor

#2814 should fix the issue.

@rgrunber
Copy link
Contributor

rgrunber commented Aug 24, 2023

@mickaelistria the previous approach was signalling the server provides type hierarchy without first checking whether the client supports dynamic registration. Now the spec is followed correctly with the recent PR.

You can try it out to see if it still works. I think it should because I don't see setTypeHierarchy(..) anywhere in https://github.com/eclipse/lsp4e/blob/a60390688b37ae879bd773679ef73d7e542b77f9/org.eclipse.lsp4e/src/org/eclipse/lsp4e/internal/SupportedFeatures.java#L67-L122 , so the language server should register the static capability for the Eclipse IDE, which is what was probably happening before.

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 this pull request may close these issues.

4 participants