lsp-types icon indicating copy to clipboard operation
lsp-types copied to clipboard

Empty array is always assumed to be a `Flat` in `DocumentSymbolResponse`

Open tonyxty opened this issue 1 year ago • 0 comments

An empty array in DocumentSymbolResponse is always interpreted as Flat([]). When the server is known to always return a Nested result, this makes it inconvenient to handle the result. A similar situation happens with GotoDefinitionResponse, where an empty array is always assumed to be an array of Locations instead of LocationLinks.

Would it be worthwhile to provide an option to control which variant an empty array deserializes as? It can be implemented by declaring an alternative enum with different ordering of variants, but that seems a bit boilerplate.

tonyxty avatar Dec 29 '23 06:12 tonyxty