On Fri, 24 Apr 2020, Ryan Joseph via fpc-pascal wrote:
On Apr 24, 2020, at 4:25 PM, Arjan Adriaanse <ar...@adriaan.se> wrote:
Indeed with the current way JSON streaming is handled, optional values
are not considered. This needs more work and the issue is tracked
here https://github.com/arjanadriaanse/pascal-language-server/issues/7
[1].
We may need to rip up your nice streaming system and iterate over properties
then. Sven recently added custom attributes in the trunk which we could use to
mark the published properties (I think) but then we're inside the JSON RPC
library and we may lose control over this process.
You'd need nullable types for 'optional' values.
Your streaming library needs to be able to decide whether or not to stream an
integer.
AFAIK you could do that based on an attribute indicating a sentinel
value which should not be streamed.
You can do this with today's implementation with the OnStreamProperty event and some
dictionary of 'optional' properties.
TMyOptionals = specialize TDictionary<String,String>;
and as key use ClassName.PropName, and as value the sentinel value not to
stream.
Bit of a roundabout way, but at least can be done with the released FPC.
I don't think that requiring trunk would be a good idea for this project.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal