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 support for Notebooks to LSP #1399

Closed
dbaeumer opened this issue Jan 17, 2022 · 5 comments
Closed

Add support for Notebooks to LSP #1399

dbaeumer opened this issue Jan 17, 2022 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality new request
Milestone

Comments

@dbaeumer
Copy link
Member

Notebooks are getting more and more popular. We should investigate if we can provide first class support for notebooks in LSP.

A first possible draft can be found here: https://github.com/microsoft/vscode-languageserver-node/blob/78ee13a4bafdd831411dd3fb66c8083d3c8ca9b1/protocol/src/common/proposed.notebooks.md#L1

@dbaeumer dbaeumer added feature-request Request for new features or functionality new request labels Jan 17, 2022
@dbaeumer dbaeumer added this to the On Deck milestone Jan 17, 2022
@dbaeumer dbaeumer self-assigned this Jan 17, 2022
@rchiodo
Copy link

rchiodo commented Jan 18, 2022

LGTM.

@michaelmesser
Copy link
Contributor

michaelmesser commented Jan 19, 2022

Will servers be notified when a cell is evaluated?

@dbaeumer
Copy link
Member Author

dbaeumer commented Jan 19, 2022

@michaelmesser We discussed this and it is not part of the current proposal. But I think it would be easy to add if clients support it.

@chrisjsewell
Copy link

chrisjsewell commented Oct 15, 2022

Heya, thanks for the added support!

It's all great, except I've had one issue, in https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#notebookDocument_synchronization:

Cell text documents have an URI however servers should not rely on any format for this URI

Is there something we can do about this?

The use case is that,
many language servers perform some form of analysis on files not opened by the client (e.g. https://github.com/microsoft/pyright on Python module files), then allow these to be referenced in e.g. definition lookups, returning the standard file URI scheme in the Definition data returned to the client.

What if you know the notebook "path+cell index+position range" of a definition, say for an ID in a Markdown cell, and want to return this to the client.
How can you do this in a client-agnostic way?

Happy to open in another issue?


On a side note, I can't for the life of me find where in the code base of vscode cell URI is actually computed e.g. vscode-notebook-cell:/path/to/Untitled.ipynb#W2sZmlsZQ%3D%3D?

Obviously the 2 refers to the cell index, and I worked out that ZmlsZQ%3D%3D is actually file (after URL decoding, then base64 encoding) 🤷


edit: well at least I found how this is generated: https://github.com/microsoft/vscode/blob/81d2ccccc9c153e088df3f3805f8255d36f82f90/src/vs/workbench/contrib/notebook/common/notebookCommon.ts#L537

but yeh, some form of common, cross-client, schema would be great

@dbaeumer
Copy link
Member Author

@chrisjsewell I see your desire for this, but it would require editors to follow the LSP specification which is very hard to achieve. This is why in LSP we don't enforce URI formats.

I will close the issue since the notebook support got added in 3.17. @chrisjsewell please feel free to open another issue for the URI request.

@dbaeumer dbaeumer modified the milestones: On Deck, 3.17 Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality new request
Projects
None yet
Development

No branches or pull requests

4 participants