lxtk-org / lxtk

Language Client/Server Toolkit
Eclipse Public License 2.0
33 stars 2 forks source link

Fix #16 - Diagnostics should use correct serializer adapter #17

Closed xcariba closed 4 years ago

xcariba commented 4 years ago

We can add EitherTypeAdapter in gson to serialize diagnostics in marker. Gson is properly initialized in lsp4j.jsonrpc here

We can use only Either adapter or we can add all adapter for safety. Or we can use something like new MessageJsonHandler(Map.of()).getDefaultGsonBuilder().create() for consistency.

pisv commented 4 years ago

Good catch! I introduced org.lxtk.jsonrpc.DefaultGson to handle this a while ago, but apparently some cases slipped through the cracks. It seems that DiagnosticMarkers, AbstractMarkerResolutionGenerator, and AbstractQuickAssistProcessor need to be updated to use DefaultGson.INSTANCE. (There is no need to have the gson field in those classes any longer.) Would you mind updating the PR?