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

Generate types from metamodel #458

Closed
wants to merge 1 commit into from
Closed

Generate types from metamodel #458

wants to merge 1 commit into from

Commits on Sep 19, 2022

  1. Generate types from metamodel

    This generates all the LSP types from the LSP metamodel, a new
    machine-readable format they have produced.
    
    This requires a pretty formidable amount of TH, but in return we get a
    hopefully much better maintenance process, and we won't always be behind
    or wrong as we have been. There are also some nice touches, like on GHC
    >9.2 we can now actually attach doucmentation to things we generate with
    TH, so we can transfer all the documentation from the metamodel to
    Haddock.
    
    This is going to result in a _lot_ of churn, enough so that I think it
    should be a new top-major version of `lsp-types`. In particular:
    
    - Various inconsistencies with the spec got fixed.
    - We aim for scrupulously matching the spec, even when that is weird, so
      there's a lot more `A |? Null` rather than `Maybe A` than there used
      to be.
    - The new version makes heavy use of anonymous records to handle the
      anonymous structure literals in the spec.
    - I took a fairly heavy-handed approach to avoiding name clashes in a
      reasonably future-proof way, but that means that a bunch of names
      changed, notably the constructors of `Method`/`SMethod`.
    
    This still needs a bunch of work:
    - [ ] `lsp-test` tests are broken for some reason
    - [ ] More documentation and tidying in `CodeGen`
    - [ ] Changelog
    - [ ] Explain how to update the metamodel in the README
    - [ ] Tidy up the generated documentation so that links go to the
      generated types not the LSP spec.
    - [ ] Ensure everything builds on all versions of GHC we support.
    
    Plus a bunch of other TODOs in the code. Any help would be welcome, but
    here are the top things I'm interested in feedback on:
    
    1. How does the new version look? Is the organization okay? I'll try and
       get some Haddock with the new documentation in place soonish so
       people can look at that without building it.
    2. The gnarly TH. Anyone who wants to dive in is more than welcome, it's
       not _too_ bad but it would be nice if we could figure out a way to
       make it less gnarly.
    michaelpj committed Sep 19, 2022
    Configuration menu
    Copy the full SHA
    1a549f1 View commit details
    Browse the repository at this point in the history