## 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** - Let TS provide cross-file IntelliSense in the browser - Let TS pick up on tsconfig files - Avoid keeping around multiple copies of the workspace contents (i.e. TS should not need another copy of the workspace contents) - Don't require making the TS Server async :) **Out of scope** - File watching. For now let's assume that only open files are changed. - Reading files out of `node_modules`. For this discussions, files under `node_modules` are not considered part of the workspace contents ## Idea 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 interpret **Advantages** - After the initial transfer, TS can work synchronously - Single transfer. The entire workspace contents would become available all at once. - We should be able to share the memory for the workspace contents between multiple different consumers ## 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 passing **Advantages** - We can construct a nicer api instead of expositing a data structure directly - TS can request the files on demand instead of dealing with the entire workspace contents