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

Add LSP to the Binder image #26

Merged
merged 5 commits into from
Jan 4, 2022
Merged

Add LSP to the Binder image #26

merged 5 commits into from
Jan 4, 2022

Conversation

krassowski
Copy link
Member

@krassowski krassowski commented Oct 24, 2021

Closes #24.

Binder: https://mybinder.org/v2/gh/krassowski/jupyterlab-plugin-playground/add-lsp?urlpath=lab

Screenshot from 2021-10-24 14-21-40

Note: we can hold this while I investigate migrating to a newer server (jupyter-lsp/jupyterlab-lsp#697) and we could improve the default theme of the completer so that the detail is shown below the label not next to it (so it is not as spread out).

@jtpio
Copy link
Member

jtpio commented Oct 28, 2021

Thanks!

This is really great and incrementally lowers the bar for authoring small extensions.

I wonder if we can get autocomplete to work on the JupyterLab API as well, for example when trying complete methods on the palette:

image

@krassowski
Copy link
Member Author

In TypeScript - yes (already works if types are provided); in JS - I don't think it is possible with either javascript-typescript-langserver nor typescript-language-server. Begs a question if we should consider using typescript with lax rules (allow implicit any, etc) and compile with tsc or babel instead.

@krassowski
Copy link
Member Author

Instead of babel we could try sucrase as in ipython/ipython#13376 - definitely worth experimenting.

@bollwyvl
Copy link

compile with tsc ... sucrase

Hmm... I think figuring out a way to use the in-browser equivalent of tsc in the browser is going to give a developer better bang for their buck than babel or sucrase. While it is a bit heavy, it's the devil we know, and is going to have the best tooling.

On the broader point: the distribution of typings (or LSIF) should probably become a thing we by enable by default in e.g. @jupyterlab/builder and/or extension-cookiecutter-ts, depending on the work required.

Specifically on sucrase: while it seems to do a lot of nice things for interactive work, much like babel, some of the tricks it enables might not transfer well into a "production" extension.

@krassowski krassowski marked this pull request as ready for review December 19, 2021 18:30
@krassowski
Copy link
Member Author

This now works (as in "the state is acceptable") but because the TypeScript filter expects the client to filter completions on their side we need to implement this to make it actually more useful; I opened jupyter-lsp/jupyterlab-lsp#728.

@krassowski
Copy link
Member Author

Ok, going for tsc is actually feasible. We can use transformers to swap the imports with whatever we like (tokens for @jupyterlab/ and requires for anything else. Webpacking is an issue but there are know workarounds: microsoft/TypeScript#39436

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

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

Looks good on Binder, thanks!

image

@jtpio jtpio added the enhancement New feature or request label Jan 4, 2022
@jtpio jtpio merged commit 6c01210 into jupyterlab:master Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add LSP extension to the binder image
3 participants