Flux lsp connection should not buffer; don't render the monaco editor until the lsp is ready
- Dominant language
- TypeScript
- Stars
- 117
- Forks
- 51
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 4
Description
The Monaco editor _assumes_ that all required lsps are ready before it initializes, so that it can immediately send the `initialize` message. Our current flux lsp consumption happens asynchronously, but we don't wait for it to load the wasm and the `Lsp` instance to be created before we create the `MonacoEditor` react component. This means there's a race condition where the monaco editor starts sending messages before the lsp is ready. The way we get around this is by [using a Buffer to check for those initializations and hold them in memory until the lsp server is ready](https://github.com/influxdata/ui/blob/master/src/languageSupport/languages/flux/lsp/worker/buffer.ts#L6), which also means we have to buffer everything.
There may still be a way to handle this without having to worry too much about order of operations (vscode doesn't have a problem with this, and my current theory is that it's about file opens, not editor initialization). However, the _easiest_ path forward to eliminate this complex code is to not render the monaco editor until the lsp is ready. This would eliminate a large chunk of code, and also be more in-line with how javascript fundamentally works.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.