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

sendOpen after connection handlers are installed #202

Merged
merged 9 commits into from
Feb 29, 2020

Conversation

bollwyvl
Copy link
Collaborator

@bollwyvl bollwyvl commented Feb 23, 2020

Binder

References

Code changes

  • upgrade to newest "dockerfile-language-server-nodejs": "^0.0.22",

User-facing changes

  • dockerfile diagnostics show up every time

Backwards-incompatible changes

N/A

Chores

  • linted
  • tested
  • documented
  • changelog entry

@bollwyvl
Copy link
Collaborator Author

Some notes:

  • showing diagnostics
    Screenshot from 2020-02-22 21-35-32

  • not showing diagnostics
    Screenshot from 2020-02-22 21-34-12

It looks like when diagnostics are not showing, perhaps the document hasn't been fully initialized.

@bollwyvl
Copy link
Collaborator Author

Looks like the event is being fired before the diagnostic listener is actually installed:
Screenshot from 2020-02-22 21-48-30

So apparently, the docker server is just really fast to initialize and report diagnostics.

My first attempt will be to have adapter take over signaling that it wants to open a document by enqueuing this with the connection, rather than have the connection manager handle it...

package.json Show resolved Hide resolved
@@ -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);
Copy link
Collaborator Author

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.

Copy link
Member

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!

Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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.

Copy link
Member

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

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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...

@bollwyvl bollwyvl changed the title [wip] fix dockerfile diagnostics on first load sendOpen after connection handlers are installed Feb 23, 2020
@bollwyvl
Copy link
Collaborator Author

Checking it out on binder (link added to top), but pretty bullish on this fixing #201.

@bollwyvl
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully right/faster now...

Copy link
Collaborator Author

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.

Copy link
Member

@krassowski krassowski left a 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.

@bollwyvl
Copy link
Collaborator Author

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! 🚀 🎸

@bollwyvl
Copy link
Collaborator Author

Local test looks good, trying binder.

@bollwyvl
Copy link
Collaborator Author

last fail was pure-and-simple azure flake..

@bollwyvl
Copy link
Collaborator Author

Back to happy...

@krassowski
Copy link
Member

Thank you.

@krassowski krassowski merged commit a1aedf7 into jupyter-lsp:master Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dockerfile diagnostics don't always show up on first load
2 participants