-
Notifications
You must be signed in to change notification settings - Fork 148
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
sendOpen after connection handlers are installed #202
sendOpen after connection handlers are installed #202
Conversation
@@ -294,21 +294,29 @@ export abstract class JupyterLabWidgetAdapter | |||
this.on_foreign_document_opened, | |||
this | |||
); | |||
|
|||
await this.connect(virtual_document).catch(console.warn); | |||
return await this.connect(virtual_document).catch(console.warn); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than changing the output signature of this, we could change the input signature and add an deferOpen = false
: foreign documents would be opened immediately, presumably, as all the features would already be connected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please - this would make it much easier to understand in the future!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, pushed this around. on_foreign
and reload_connection
will both try to sendOpen
as the adapter will have been fully initialized by that point, i'm pretty sure.
this.documentsToOpen = []; | ||
} | ||
|
||
sendOpenWhenReady(documentInfo: IDocumentInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this is the best way, but seemed the most straightforward. i guess it could notify that it did open each document, but nobody would be listening right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we are not allowed to send anything before receiving InitializeResult
:
Until the server has responded to the initialize request with an InitializeResult, the client must not send any additional requests or notifications to the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should change ws-connection to complain much more loudly about that... but maybe not on this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another approach: once this is in, instead of failing (or dropping messages on the floor, as it currently does), add Connection.ready: Promise<void>
, and have everything except initialize
do an await
on that. Would have to do some digging around to see if that's viable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried this out on a branch... breaks a bunch of things. doesn't mean it's not worth doing, just needs more than some simple checks...
Checking it out on binder (link added to top), but pretty bullish on this fixing #201. |
Yep, looks good on binder. |
@@ -31,6 +31,9 @@ jobs: | |||
- script: ${{ parameters.env_docs }} || ${{ parameters.env_docs }} || ${{ parameters.env_docs }} | |||
displayName: docs dependencies | |||
|
|||
- script: ${{ platform.activate }} && conda uninstall -y pytest-cov | |||
displayName: remove coverage to prevent warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding this to remove warning, but also to trigger another run (haven't found anything else worth trying/changing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hopefully right/faster now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now takes 6s rather than 1min, though I did forget to add pip to the env... we'll see how the current run goes: not strictly required for merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I agree with your suggestion on moving some of the logic to connect_document
.
Thanks for the quick reviews. Provided this passes (doing a full run locally, too), and you don't see any other glaring issues, I don't plan on doing anything else on it at this time! 🚀 🎸 |
Local test looks good, trying binder. |
last fail was pure-and-simple azure flake.. |
Back to happy... |
Thank you. |
References
Code changes
"dockerfile-language-server-nodejs": "^0.0.22",
User-facing changes
Backwards-incompatible changes
N/A
Chores