In-memory virtual file overlay over LSP without faking `didOpen`
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- go, typescript
- Domaine
- backend-api-design, developer-experience, tooling
Piste de recherche
Start at the tsgo --lsp LSP server and its API session pipe, then compare the existing RequestFileSystem layered snapshots and runWithTemporaryFileUpdate behavior. Define how a virtual-file update and null clear should reach the VFS, and verify that generated .ngtypecheck.ts files are available to standard LSP requests without entering openClientFiles or requiring didOpen/didClose bookkeeping.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🔍 Search Terms
virtual file
setVirtualFile
RequestFileSystem
openClientFiles
didOpen didClose
temporary file update
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Add an overlay mechanism over the LSP server interface (tsgo --lsp) to push in-memory file contents directly into TS-Go's VFS (for example, a custom notification like ts/setVirtualFile with { path, content }, where null clears the overlay) without treating the files as client-opened documents.
📃 Motivating Example
We're using tsgo --lsp (with the API session pipe) as our backend diagnostics and type-checking engine for the Angular Language Service. To type-check templates, Angular generates synthetic in-memory TypeScript files containing Type Check Blocks (like app.component.ngtypecheck.ts) that TS-Go needs to type-check alongside user code.
Right now, we feed these into TS-Go by sending synthetic textDocument/didOpen and textDocument/didChange notifications. While that works, treating these files as client-opened documents pollutes openClientFiles, artificially bumps project retention ref-counts in ProjectService, and forces us to manage synthetic open/close lifecycle bookkeeping for files that aren't actually open in the editor.
The API client already has some support for layered VFS snapshots (RequestFileSystem with { kind: "layer" } and runWithTemporaryFileUpdate), but we don't have an equivalent way to push un-opened virtual files over the LSP connection.
An overlay notification over LSP (something like setVirtualFile(path, content | null)) would let us push our generated type-check files directly into TS-Go's VFS without openClientFiles pollution or open/close bookkeeping.
💻 Use Cases
- What do you want to use this for?
To feed Angular's generated template type-checking code (.ngtypecheck.tsfiles containing Type Check Blocks) into TS-Go in memory.
We run tsgo --lsp as an out-of-proc semantic and diagnostics engine for both our dev server and our separate Angular Language Server. As users edit templates, we generate and update these synthetic .ngtypecheck.ts files so TS-Go can type-check them alongside the user's TypeScript code and answer semantic queries (hover, definition, completions). None of these synthetic files exist on disk, and they change frequently as templates are edited.
- What shortcomings exist with current approaches?
Over LSP, the only current way to provide in-memory content is viatextDocument/didOpenandtextDocument/didChange. BecausedidOpenis built for user-facing editor buffers, using it for internal synthetic files causes a few headaches:
- It registers the files in
openClientFiles, adding unnecessary tracking overhead for files the user never opened. - It inflates
ProjectServiceretention ref-counts, keeping configured projects alive longer than they should be or creating awkward project lifecycle behavior. - We have to build our own synthetic
didOpen/didClosebookkeeping layer just to keep TS-Go's internal project state clean.
The API client recently added layered snapshot file systems (RequestFileSystem with { kind: "layer" } and runWithTemporaryFileUpdate), but that's scoped to immutable snapshots in the Node API client rather than a long-running tsgo --lsp server session answering standard LSP requests.
- What workarounds are you using in the meantime?
In our language service facade, we currently fake the document lifecycle: we track synthetic version numbers, sendtextDocument/didOpenwhen generating a TCB,textDocument/didChangeas the template updates, and sendtextDocument/didClosewhen components are removed or projects unload. It works functionally, but it's fragile and forces us to manage artificial lifecycle bookkeeping for purely ephemeral compiler artifacts.
- Langage dominant
- Go
- Étoiles
- 112k
- Forks
- 15.4k
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 126
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoft/TypeScript
-
Won't Fix
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
microsoft/TypeScript#65107 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file locationPeut-être pris @timurzvural l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoft/TypeScript#65087 ·
Les mainteneurs répondent en général sous 1 jour
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'Peut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
microsoft/TypeScript#64758 ·
Les mainteneurs répondent en général sous 1 jour
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`Peut-être pris @rajnish-verma-22172 l’a pris il y a 13 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
microsoft/TypeScript#64742 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindingsPeut-être pris @dmety l’a pris il y a 26 jours. OuverteBug
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
microsoft/TypeScript#64661 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de microsoft/TypeScript
Issues similaires
-
agent-butler-finding chore
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
jordansmall/spindrift#6318 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Eyevinn/moqlivemock#166 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
JakeChampion/lang#14091 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
hyperledger/fabric-x-orderer#1409 ·
Les mainteneurs répondent en général sous 3 jours
-
get actions doesn't show the approval flag, and describe action shows it unformattedPeut-être pris @kenokech l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour