ratmice / nimbleparse_lsp

lsp server for grmtools lex & yacc
Other
7 stars 1 forks source link

Replace parse_thread closure with a self-referential struct #33

Open ratmice opened 1 year ago

ratmice commented 1 year ago

Currently we have a closure which references data which the closure owns (parse_thread.rs:init()). Which is the extent we can do within safe rust. Limitations are that we cannot implement traits for a closure since the type of closures are not nameable. This isn't currently an issue since the trait we would want to implement (tower_lsp's LanguageServer) requires various bounds beyond those we can supply. Thus currently we spawn a thread for this closure and implement LanguageServer over types with channels and move some endpoints into the closure.

Once the work mentioned in https://github.com/ebkalderon/tower-lsp/issues/284 is in a state which it can be tested, try replacing the closure with a self referential struct probably using ouroboros. This could in theory cleanup quite a lot of indirection through channels for both input/output through the parse thread. If we can manage to implement the new trait bound requirements discussed there.