In-memory virtual file overlay over LSP without faking `didOpen`
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- go, typescript
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
🔍 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.
- 主要語言
- Go
- 星號
- 112k
- 分支
- 15.4k
- 平均合併
- 2 天 21 小時
- 30 天內合併 PR
- 126
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/TypeScript 的其他 Issue
-
Won't Fix
難度 2/5 1-3 小時 新手友好度 62/100
microsoft/TypeScript#65107 · 1 則留言 ·
維護者通常 1 天內回覆
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file location可能已有人在做 @timurzvural 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
microsoft/TypeScript#65087 ·
維護者通常 1 天內回覆
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'可能重新可做 關聯的 PR 已關閉且未合併。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/TypeScript#64758 ·
維護者通常 1 天內回覆
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`可能已有人在做 @rajnish-verma-22172 於 13 天前認領。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/TypeScript#64742 · 1 則留言 ·
維護者通常 1 天內回覆
-
Class names `eval` and `arguments` are not reported as invalid strict mode bindings可能已有人在做 @dmety 於 26 天前認領。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/TypeScript#64661 ·
維護者通常 1 天內回覆
查看 microsoft/TypeScript 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
hyperledger/fabric-x-orderer#1409 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
needs-area
難度 2/5 1-3 小時 新手友好度 68/100
Azure/typespec-azure#5936 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 72/100
github/gh-actions-lock#261 ·
維護者通常 1 天內回覆