-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[Discussion] Enable reading workspace contents on GitHub.dev #46421
Comments
@JacksonKearl @jrieken On the VS Code side, do you currently have any plans for how to make a readonly view of the workspace contents available to other extensions? Initializing TS with a single blob seems like it would be the easiest approach for us. If the majority of workspaces only have a few MB or so of code, for the first iteration we could even skip using a |
/cc @joyceerhl who is owning the remote hub file system implementation. For anycode this is currently opaque and it simply consumes things via For the |
The implementation side of RemoteHub's indexing is just a |
From talking with @eamodio my understanding is that the tar approach we have is essentially a workaround for the limitations of the GitHub text search APIs and should go away when the GitHub search APIs improve. It's not clear when the search APIs will be improved, but I slightly worry about whether we should really be exposing that and having TypeScript depend on that implementation. |
@joyceerhl I agree we should consider if exposing the whole contents of the workspace to extension makes sense. With any code also needing this data though, I think it would be nice to see if we can come up with a generic solution instead of having each extension/language re-implement this functionality I'll keep talking with the TS team about our requirements for this. For experimentation purposes, it sounds like I may be able to hack something together using the remote hub file system provider today though? @JacksonKearl and @jrieken Good suggestion to look into |
One quick note from discussions today: the GitHub.dev case is kind of just a special case of working with a virtual file system. When working with arbitrary virtual file systems, we might not be able to easily or efficiently construct workspace contents blob that can be shared with TSServer. Idea 2 would likely work better in those cases then |
The TARs were originally just to deal with the lacking GitHub search apis, but they also became useful to avoid thrashing the GitHub api (and causing lots of latency) when an extension uses the |
@mjbvz the on-indexeddb representation is always a
It could be helpful for the vscode extension API to provide some sort of: type Contents = {path: string, uri, etc. ; contents: UInt8Array}; // maybe a Map instead
requestFullRepositoryContents(reason: string): Promise<Contents | null>; /* requestHighBandwidthMode? */ Where io-heavy operations could be gated on VS Code presenting some sort of UI to prompt for entering "high bandwidth" mode, perhaps with a list of the operations that have pending requests for the full contents and why (sorta like workspace trust). They could then either use |
As we're thinking about bringing Azure Repos support to parity with GitHub Repos support and generalizing the VirtualProvider concept, I prefer idea 2 for the flexibility it offers as well. (FWIW, the AzDO API supports returning blobs as zip files) In RemoteHub we have an internal getFileTree(workspaceUri: vscode.Uri): FileTree | undefined; |
It seems like the current direction to power this up is #47600. I'll close this issue and if we need to in the future, we can come back to this. |
Problem
On serverless web, the TypeScript server currently only knows about the files that VS Code opens as editors. This means that features such as cross-file navigation/IntelliSense will not work unless you open editor for each of the files involved
We've faced this problem with two other features for VS Code: search and our any code implementation (which uses tree sitter to provide limited IntelliSense for languages that don't yet have web enabled extensions). For those cases, we now download a copy of the entire repository to the user's browser so that we can index/process all files in the workspace
Since we already have a copy of the workspace contents, we should see if TypeScript is also able to use this data to provided better intellisense on github.dev. This issue lays out a few potential paths for implementing this.
Goals
Out of scope
node_modules
. For this discussions, files undernode_modules
are not considered part of the workspace contentsIdea 1) Initialize TS with the workspace contents
VS Code constructs a data structure representing the workspace contents and transfers this to TypeScript. TypeScript consults this data structure to read any unopened files.
To avoid creating multiple copies of the workspace contents, the data structure could be stored inside a
SharedArrayBuffer
. However we'd need to figure out how to represent the workspace data structure since TS would fundamentally just be getting a big blob of binary data that it needs to interpretAdvantages
Idea 2) VS Code as file reader
TypeScript delegates all file operations back through VS Code's TypeScript extension.
The first challenge with this approach that calls from TS back to VS Code would need to be synchronous. This could be implemented using a
SharedArrayBuffer
to synchronize message passingAdvantages
The text was updated successfully, but these errors were encountered: