The classes used for progress API all have a kind property which is used in the LSP protocol so that the client knows if it's a begin, progress or end message:
If we add back the __init__ method, then kind is properly serialised and the progress example works.
PS: very few of the protocol classes are using default values like this, maybe there is only the ones used for progress and also CreateFileDeleteFile and DeleteFile.
PPS: an easy workaround is to specify the kind explicitly
The classes used for progress API all have a
kind
property which is used in the LSP protocol so that the client knows if it's a begin, progress or end message:https://github.com/openlawlibrary/pygls/blob/4772250f8ede25aee8e457dae5bca394aeccdd2f/pygls/lsp/types/basic_structures.py#L442-L459
When these classes are used, usually the
kind
attribute is not set in the constructor, as we can see in the json example, it is: https://github.com/openlawlibrary/pygls/blob/4772250f8ede25aee8e457dae5bca394aeccdd2f/examples/json-extension/server/server.py#L205and the kind is not passed explicitly like that:
Because it is default value of the model, it's not needed to specify the kind and this is more elegant to not pass the kind.
The whole progress example stopped working after b84098cc05426877ba62dce75aeec2ba4fa45056 , more specifically this chunk which removes this code:
https://github.com/openlawlibrary/pygls/blob/ee17487e4f40f971e7ec6f7711fa8334c5b7b127/pygls/lsp/types/basic_structures.py#L57-L63
This block was responsible for serialising the
kind
attributes that are set as default values.As we can see in log file, this message is serialised without kind.
If we add back the
__init__
method, thenkind
is properly serialised and the progress example works.PS: very few of the protocol classes are using default values like this, maybe there is only the ones used for progress and also
CreateFile
DeleteFile
andDeleteFile
.PPS: an easy workaround is to specify the
kind
explicitly