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

LXTK saves diagnostic json in marker in wrong format #16

Closed
xcariba opened this issue Jul 17, 2020 · 2 comments · Fixed by #17
Closed

LXTK saves diagnostic json in marker in wrong format #16

xcariba opened this issue Jul 17, 2020 · 2 comments · Fixed by #17
Assignees
Labels
bug Something isn't working
Milestone

Comments

@xcariba
Copy link
Collaborator

xcariba commented Jul 17, 2020

LXTK serializes diagnostic markers in wrong format.
If you have code field in Diagnostic class with type Either which has its own serializer and deserializer inside lsp4j. You have to use EitherTypeAdapter if you want to work with them properly. My project uses this diagnostics and deserializer crashes if code field is present.

@pisv
Copy link
Collaborator

pisv commented Jul 17, 2020

For completeness, could you attach a stack trace?

@pisv pisv linked a pull request Jul 17, 2020 that will close this issue
@pisv pisv added the bug Something isn't working label Jul 17, 2020
@pisv pisv added this to the v0.2 milestone Jul 17, 2020
@xcariba
Copy link
Collaborator Author

xcariba commented Jul 17, 2020

Yep, exception occures when you try do deserialize diagnostic from marker

!MESSAGE Unexpected token BEGIN_OBJECT: expected STRING | NUMBER tokens.
!STACK 0
com.google.gson.JsonParseException: Unexpected token BEGIN_OBJECT: expected STRING | NUMBER tokens.
	at org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter.create(EitherTypeAdapter.java:196)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter.read(EitherTypeAdapter.java:172)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter.read(EitherTypeAdapter.java:40)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220)
	at com.google.gson.Gson.fromJson(Gson.java:888)
	at com.google.gson.Gson.fromJson(Gson.java:853)
	at com.google.gson.Gson.fromJson(Gson.java:802)
	at com.google.gson.Gson.fromJson(Gson.java:774)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants