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 type hierarchy provider as Language Server capability #1278

Merged
merged 10 commits into from
Nov 13, 2023

Conversation

lars-reimann
Copy link
Member

@lars-reimann lars-reimann commented Nov 8, 2023

Closes #1275

  • Handle type hierarchy requests in the Language Server
  • Add TypeHierarchyProvider as a new LSP service
  • Add the interface TypeHierarchyProvider and a no-op abstract implementation AbstractTypeHierarchyProvider to easily customize the responses for a given language
  • Add a type hierarchy provider for interfaces in Langium grammars

Test instructions:

Some automated tests are included. To check functionality in VS Code, create a Langium grammar with the following content:

interface A {}
interface B extends A {}

Place the cursor on the name of either interface and invoke the action "Types: Show Type Hierarchy". Via the button
image
you can switch between showing subtypes and supertypes of the selected interface.

@lars-reimann lars-reimann marked this pull request as ready for review November 8, 2023 14:17
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent contribution! 🎉

I have only a few remarks:

packages/langium/src/lsp/language-server.ts Show resolved Hide resolved
packages/langium/src/lsp/type-hierarchy-provider.ts Outdated Show resolved Hide resolved
@lars-reimann
Copy link
Member Author

Thanks for the feedback. I've adjusted the PR accordingly.

@lars-reimann lars-reimann force-pushed the type-hierarchy-provider branch from f6c4ae7 to 38522ba Compare November 11, 2023 08:33
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@spoenemann spoenemann merged commit 055f74d into eclipse-langium:main Nov 13, 2023
@lars-reimann lars-reimann deleted the type-hierarchy-provider branch November 13, 2023 11:00
@spoenemann spoenemann added this to the v3.0.0 milestone Jun 17, 2024
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.

Type hierarchy provider
2 participants