Open tom-tan opened 5 years ago
There is a decision to be made.
pyenv
, pipenv
or other toolsI think to use schema-salad is good. Because, I'm worry about the gap between schema-salad and generated code.
The generated code should be faster for validating documents, which would help the language server give real-time feedback. I recommend that solution.
However, the code generation framework probably needs some additional work to produce the same quality error messages as using schema-salad-tool.
@tetron Thank you for your suggestion! We will work on it using generated code.
However, the code generation framework probably needs some additional work to produce the same quality error messages as using schema-salad-tool.
Are there any issues filed in schema-salad repository or can you show concrete examples that produce different quality error messages?
I found there are several implementation issues:
Currently pylspclient does not provide a good way to support sending notifications from the server.
textDocument/publishDiagnostics
.LspEndpoint
already provides send_notification
method. However, to call it, we have to send LspEndpoint
object to other notification callbacks because validaitons for publishDiagnostics
are (in general) triggered by other notifications such as didChange
and didSave
.Currently, to generate Diagnostic
objects by using the code generated by schema-salad-tool
, we have to parse the messages in schema_salad.validate.ValidationException
.
The easiest way to do that is to use schema_salad.main.to_one_line_messages
but we have to add a runtime dependency to schema-salad. Ideally it is better to fix ValidationException
to provide a structured information rather than to provide an already formatted string.
I will consider how to fix them and will send pull requests if possible.
There is alternative to write a language server: https://github.com/openlawlibrary/pygls
There is alternative to write a language server: https://github.com/openlawlibrary/pygls
It was done by #12.
The codegen-ed parser does not work with the functions such as to_one_line_messages
because its error messages are quite different from the output of the original schema-salad-tool
.
It means that we have to implement another parser for the exception messages from the codegen-ed parser...
Now the main blocker is closed but there is another minor issue to be solved.
By achieving this, we do not have to implement other validation schemes.