Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement validation using schema salad #11

Open
1 task
tom-tan opened this issue Jan 16, 2019 · 9 comments
Open
1 task

Implement validation using schema salad #11

tom-tan opened this issue Jan 16, 2019 · 9 comments

Comments

@tom-tan
Copy link
Member

tom-tan commented Jan 16, 2019

By achieving this, we do not have to implement other validation schemes.

  • textDocument/publishDiagnostics
@tom-tan tom-tan created this issue from a note in Requests/Notifications to be implemented (To do) Jan 16, 2019
@tom-tan
Copy link
Member Author

tom-tan commented Jan 16, 2019

There is a decision to be made.

  • How to use schema-salad?
    • Use schema-salad and a schema for each version
      • Pros
        • Mostly complete
        • Easier to test with the latest schema and schema salad
      • Cons
        • It needs runtime dependency to schema-salad
          • Users have to maintain the dependency by using pyenv, pipenv or other tools
    • Use a generated code from the schema for each version
      • Pros
        • It can move the dependency of schema-salad from runtime to building time
          • i.e., when shipping to PyPI
          • It makes users less worries about dependency
      • Cons
        • There may be a gap between schema-salad with the schema and generated code
        • Longer building time (needs code generation phase for each version)
        • A little bit complicated to test with the latest schema and schema salad

@manabuishii
Copy link
Collaborator

I think to use schema-salad is good.
Because, I'm worry about the gap between schema-salad and generated code.

@tetron
Copy link

tetron commented Jan 16, 2019

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.

@tom-tan
Copy link
Member Author

tom-tan commented Jan 18, 2019

@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?

@tom-tan
Copy link
Member Author

tom-tan commented Jan 18, 2019

I found there are several implementation issues:

  • Currently pylspclient does not provide a good way to support sending notifications from the server.

    • Typical notification to use this feature is 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.

@tom-tan
Copy link
Member Author

tom-tan commented Mar 22, 2019

There is alternative to write a language server: https://github.com/openlawlibrary/pygls

@tom-tan
Copy link
Member Author

tom-tan commented Mar 28, 2019

There is alternative to write a language server: https://github.com/openlawlibrary/pygls

It was done by #12.

@tom-tan
Copy link
Member Author

tom-tan commented Mar 28, 2019

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...

@tom-tan
Copy link
Member Author

tom-tan commented Oct 30, 2019

Now the main blocker is closed but there is another minor issue to be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants