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

Refactor LSPConnection, ConnectionManager #165

Merged
merged 67 commits into from
Feb 9, 2020

Conversation

bollwyvl
Copy link
Collaborator

@bollwyvl bollwyvl commented Jan 19, 2020

References

This has been mentioned a few places (e.g. #76), but doesn't have a concrete issue. Whoops!

Code changes

Changes the design contract to support:

  • exactly one ConnectionManager per application (instead of one per Notebook/Editor)
  • one LSPConnection per language (instead of one per Editor/Cell(!))
    • therefore one WebSocket
  • in at least one feature highlight.ts, instead of waiting for the emit, the results are consumed directly behind a promise (or Thenable, but who's counting)
    • we probably want to use this pattern all over for request/response style messages
    • otherwise, i was getting duplicate "same token" highlights in totally crazy places in unrelated editors
    • we need to generally start testing with multiple documents open, as these might already be issues

In addition, this lazy-loads the connection.ts and all of lsp-ws-connection when the first language server is requested via await import.

User-facing changes

Apart from the initial delay loading the 1.5mb slug of lsp-ws-connection, this generally makes things much snappier, as each additional document/cell adds very little overhead.

Backwards-incompatible changes

No doubt, a lot of things that were expecting to "just work" will need to be more aware of the documentUri... I haven't merged up to master, so perhaps the recent completion fixes will uncover new issues.

Chores

  • linted
  • tested
  • documented
  • changelog entry

@bollwyvl
Copy link
Collaborator Author

Probably need to put this down for a bit.

  • all of the acceptance tests are passing. I've || echod the jest tests for now on azure so i can get some eyes on other OSes.
  • most of the unit tests working, and will be able to figure out the editor is undefined, but haven't dug into what rename is doing, so can't really tell why they might be failing.

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 2, 2020

Also taking a look on binder to see if the slow connection issues are cleared up:
Binder

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 2, 2020

Ugh. It looks like binder installs r-studio from apt/random shell scripts now: no idea what that's going to do to the r language server install we have.

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 2, 2020

Hooray CI and binder both working the first time :P

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 4, 2020

Still haven't merged in docs branch, but am otherwise starting to feel like this is done...

@bollwyvl bollwyvl changed the title [wip] Refactor LSPConnection, ConnectionManager Refactor LSPConnection, ConnectionManager Feb 4, 2020
bollwyvl added a commit to bollwyvl/jupyterlab-lsp that referenced this pull request Feb 8, 2020
@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020

Noticed some more stuff in looking into #190, doing some more work here...

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020

Similar to https://github.com/krassowski/jupyterlab-lsp/pull/165#issuecomment-581177638, i've also moved the kernelChanged handling up to the plugin level.

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020

Of note to the above: it's possible for a file editor to also have a kernel attached to it and provide completion (and even execution). Not going to handle on this PR, but probably also needs some love.

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020

Ah: that change won't work, because the kernel_info never comes back from the No Kernel. This is probably not desirable, will just revert.

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020

Well, the docker test is just being a jerk on osx, but I really can't think of anything else I want to do on this, having done the docs piece directly over on #177. I feel like we should probably merge this and move forward.

@krassowski
Copy link
Member

Will do some local testing and merge today!

@bollwyvl
Copy link
Collaborator Author

bollwyvl commented Feb 9, 2020 via email

@krassowski krassowski merged commit fcf7b65 into jupyter-lsp:master Feb 9, 2020
@krassowski
Copy link
Member

Thank you!

bollwyvl added a commit to bollwyvl/jupyterlab-lsp that referenced this pull request Feb 11, 2020
@bollwyvl bollwyvl mentioned this pull request Feb 11, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants