jupyterlab-lsp icon indicating copy to clipboard operation
jupyterlab-lsp copied to clipboard

[wip] defer initialization until event loop is available

Open bollwyvl opened this issue 2 years ago • 1 comments

References

  • minimal fix for #851

Code changes

  • moves full initialization off critical path to starting JupyterServerApp
    • when it does initialize, moves potentially-expensive actions to a thread pool executor to not inadvertently block other early functions
    • when done, set a ready flag
  • makes more of the handler methods asynchronous, and wait on the ready flag

User-facing changes

  • slow startup would now be deferred, allowing the server to start more quickly
  • the initial request for language status might be delayed some
    • typically it takes a while and many hundreds of HTTP requests, to get all the way up to a full-rendered document that could even request whether a language server is available
  • the debug log message comes after the server announces its location, making it harder to find the server URL

Backwards-incompatible changes

  • n/a, though some of the internal methods

Future Work

  • this is still "blocks" (from an information theory perspective) the ability to start any session until all servers are discovered
    • theoretically with an isComplete flag on the response, we could handle partial setup better, and hoist more errors to the client log

Chores

  • [x] linted
  • [ ] tested
    • the new server initialize code isn't under unit test, probably should be
    • benchmark startup somehow?
  • [ ] documented
  • [ ] changelog entry

bollwyvl avatar Sep 12 '22 01:09 bollwyvl

Binder :point_left: Launch a binder notebook on branch bollwyvl/jupyterlab-lsp/gh-851-lazy-initialization

github-actions[bot] avatar Sep 12 '22 01:09 github-actions[bot]

Continued in #882

bollwyvl avatar Dec 11 '22 21:12 bollwyvl