-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Virtual documents without file paths #122
Comments
Didn’t know how DrRacket handle this? |
DrRacket doesn't need the file path. It doesn't need to know the path if no relative path |
I saw the notebook document uri looks like this: A simple fix could be
|
Do you mean support any URI (even for unsaved documents that have no file path at all), or only the subset like notebook cells, where there is something like a file path that could be extracted...? I started to experiment with entirely removing all uses of the file path (storing only an opaque URI) before filing this issue... But then I noticed Perhaps I was scared away too easily though, and those things can just be removed without issues...? |
Do you think introduce a virtual filesystem for vscode-notebook-cell will work? It still have a path, just different from default filesystem. |
What do you mean by "virtual filesystem" here...? Just extracting the embedded file path, or something more? The Extracting the file path seems to imply maintaining some bit of code (either in clients or the server) for each possible URI scheme to work out a sensible file path from it (if one is even possible at all), and to me this seems like a somewhat unfortunate thing to maintain that would best be avoided (since new virtual URIs may appear at any time). Ideally, we could move towards a solution that treats the URIs as opaque and avoids file paths entirely. |
Because we can load syntax first and no provide path to Footnotes |
It's not any URI contains a file path. But it's not important, as the code never reads the current file, it only reads the other files it rely on. For example, a test in We only need to make sure we know its path or hypothetical path if there is a relative It's not easy to replace all path with uri in the code. There are many places where assume the source of document is a path. I tried it today but can't make this change easily. VFS is an ideal solution especially if we have, say https, ssh URI in the future. But it means more work than the simple fix. And probably no one will have these problems and report them in recent years. |
I made a change: https://github.com/6cdh/racket-langserver/tree/remove-uri-limit But I can't get it work with notebooks, it seems to require extra config in the extension. please try this commit. |
Ah wow, seems like a clever approach! 😄
Yes, there are several additional steps:
I've done these things locally and tested it with your langserver branch, and overall it solves the file path issue, so that's great! 😄 Unsaved files now work as expected (once you manually mark them as Racket files). For notebook cells, the langserver does run (which is the focus of this issue), but you then quickly encounter a separate problem that IRacket doesn't really want the notebook cell to have @6cdh, I'd recommend submitting a PR with your langserver branch. Thanks for working on this! 😄 |
Some editors (at least VS Code) support "virtual" documents which are not saved anywhere on the filesystem. These include things like unsaved documents, notebook cells, etc. These virtual documents have some non-
file
URI scheme.The language server currently assumes it is always working a document from the filesystem, as various components try to load the file from disk, split the path for directory traversal, etc. It would be great if the language server could be updated to work entirely from the document contents provided by the client without assuming it is stored in a filesystem somewhere.
As a workaround, the editor client can write these virtual documents to a temporary file and provide that to language server instead, but it would be much better to remove the filesystem requirement from the server entirely.
The text was updated successfully, but these errors were encountered: