🔍 Search Terms
extraFileExtensions
ScriptKind.Unknown
getDefaultProjectForFile
companion files
cold start project
openProjects
✅ Viability Checklist
⭐ Suggestion
Something like content mappers for registering extra extensions as included in the project but without the requirement of actually doing content mapping
📃 Motivating Example
We're currently prototyping the new Angular Language Service against TS-Go (tsgo --lsp with the API session pipe). In our setup, our extension manages a separate language server to handle Angular-specific template features, and uses TS-Go as the backend semantic and type-checking engine.
Because we manage our own compiler instance per tsconfig.json, we need to know which project owns a file when it's opened. We're running into a cold-start discovery problem when a user opens an external template first (e.g. app.component.html): getDefaultProjectForFile returns nothing because TS doesn't recognize .html as belonging to any configured project. Since Angular hasn't compiled yet, we don't know the TS ↔ HTML association either, so we don't know which tsconfig to load.
To work around this today, we do a "fake open dance" where we guess a sibling app.component.ts file, send a synthetic didOpen to TS-Go just to spin up the project and discover the tsconfig path, and then boot our compiler.
Content Mappers don't really fit here because they require transforming foreign files into virtual .ts ASTs and generating .ts output. For Angular, HTML files are external companion templates—our template type-checking code is generated out-of-band in separate .ngtypecheck.ts files. Forcing a Content Mapper onto .html files just introduces unwanted .ts AST generation and emit overhead.
Previously, extraFileExtensions with ScriptKind.Unknown kept projects active when matched by include globs. Since non-TS extensions in include globs are more standard now with content mappers, we're fine requiring .html in include. A lightweight extension registration (or a no-transform companion mode that lets include globs associate .html with ProjectService without generating virtual .ts ASTs) would eliminate the cold-start issue and the fake open workaround.
💻 Use Cases
-
What do you want to use this for?
Angular language service
-
What shortcomings exist with current approaches?
Mentioned above
-
What workarounds are you using in the meantime?
attempting to open a ts file with the same name
🔍 Search Terms
extraFileExtensions
ScriptKind.Unknown
getDefaultProjectForFile
companion files
cold start project
openProjects
✅ Viability Checklist
⭐ Suggestion
Something like content mappers for registering extra extensions as included in the project but without the requirement of actually doing content mapping
📃 Motivating Example
We're currently prototyping the new Angular Language Service against TS-Go (
tsgo --lspwith the API session pipe). In our setup, our extension manages a separate language server to handle Angular-specific template features, and uses TS-Go as the backend semantic and type-checking engine.Because we manage our own compiler instance per
tsconfig.json, we need to know which project owns a file when it's opened. We're running into a cold-start discovery problem when a user opens an external template first (e.g.app.component.html):getDefaultProjectForFilereturns nothing because TS doesn't recognize.htmlas belonging to any configured project. Since Angular hasn't compiled yet, we don't know the TS ↔ HTML association either, so we don't know which tsconfig to load.To work around this today, we do a "fake open dance" where we guess a sibling
app.component.tsfile, send a syntheticdidOpento TS-Go just to spin up the project and discover the tsconfig path, and then boot our compiler.Content Mappers don't really fit here because they require transforming foreign files into virtual
.tsASTs and generating.tsoutput. For Angular, HTML files are external companion templates—our template type-checking code is generated out-of-band in separate.ngtypecheck.tsfiles. Forcing a Content Mapper onto.htmlfiles just introduces unwanted.tsAST generation and emit overhead.Previously,
extraFileExtensionswithScriptKind.Unknownkept projects active when matched byincludeglobs. Since non-TS extensions inincludeglobs are more standard now with content mappers, we're fine requiring.htmlininclude. A lightweight extension registration (or a no-transform companion mode that letsincludeglobs associate.htmlwithProjectServicewithout generating virtual.tsASTs) would eliminate the cold-start issue and the fake open workaround.💻 Use Cases
What do you want to use this for?
Angular language service
What shortcomings exist with current approaches?
Mentioned above
What workarounds are you using in the meantime?
attempting to open a ts file with the same name