[fpc-pascal] Pascal Language Server

Michael Van Canneyt michael at freepascal.org
Fri Apr 24 11:52:57 CEST 2020

On Fri, 24 Apr 2020, Ryan Joseph via fpc-pascal wrote:

>> On Apr 24, 2020, at 4:25 PM, Arjan Adriaanse <arjan at 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.


More information about the fpc-pascal mailing list