haskell / lsp

Haskell library for the Microsoft Language Server Protocol
364 stars 90 forks source link

Generate types via new `metaModel.json` #421

Closed michaelpj closed 1 year ago

michaelpj commented 2 years ago

https://github.com/microsoft/language-server-protocol/issues/67

There's a machine-readable specification of the protocol coming. It's specified in a non-standard way, so we'd have to do some work to process it, but it's probably still better than doing it by hand!

michaelpj commented 2 years ago

Extremely WIP branch here: https://github.com/michaelpj/lsp/tree/mpj/metamodel

I had to do the types for the metamodel manually since it seems like there isn't a maintained JSON schema library in Haskell, sadly.

Codegen is going to be annoying. In particular we're going to have to deal with all the anonymous intersections and unions that the spec throws around. Often we rationalized those into e.g. sensible sum types, but I'm not sure if we can do that here...

michaelpj commented 2 years ago

I'm making significant progress on this. I'm currently trying to deal with all the Methods, which is a bit annoying since they've added a bunch more, and we have a lot of huge pattern matches for dealing with them. I may end up punting on this for the first version.

michaelpj commented 1 year ago

PR: https://github.com/haskell/lsp/pull/458

michaelpj commented 1 year ago

PR merged