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

Deserialization support for AWS LSP extended InitializeResult #49

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

breedloj
Copy link
Contributor

@breedloj breedloj commented Oct 2, 2024

Description of changes:
AWS Flare LSPs extend the basic LSP InitializeResult with extended metadata, such as available chat commands. By default these additional properties are lost by LSP4j's deserialization logic. This change models the extended type and registers in a custom type adapter for GSON (LSP4j's deser library) to deserialize into the extended type and therefore surface the properties.

Keep in mind that there may be additional properties that need to be modeled to the extended InitializeResult, but I am illustrating the pattern for accessing the chat commands here.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


@Override
@SuppressWarnings("unchecked")
public final <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> type) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I had everything in this PR ready in a branch except for this class. Thanks for looking into it!

@breedloj breedloj merged commit f648b5c into main Oct 2, 2024
1 check passed
@breedloj breedloj deleted the breedloj/deserInitializeResult branch October 2, 2024 21:01
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.

2 participants