#Dynamic Virtual File Support in TypeScript 5.9.2 Causes Debug Failure

15 messages · Page 1 of 1 (latest)

cold juniper
#

Hi TypeScript team,

I’m developing a custom TypeScript plugin and encountering a persistent Debug Failure in 5.9.2 when trying to provide virtual files. My goal is to dynamically supply temporary modules that don’t exist on disk so they can be imported and have default exports during editing in VSCode. I’ve tried overriding readFile, fileExists, and getScriptSnapshot on serverLanguageHost, but every approach triggers the same failure in _ProjectService.setDocument and getOrCreateSourceFileByPath. It seems tsserver doesn’t fully support fully dynamic virtual files in this version. Could you clarify if this is expected, or suggest a safe way to implement virtual modules dynamically within a plugin without causing Debug Failure?

pulsar slate
cold juniper
#

i create a basic plugin like this

cold juniper
#

for example
if the containing file is a ts or z file, check it. If there is no file with the name ts file, resolve it anyway.

#

no matter what I do, no matter what I override from the host, it always gives this error

#

if I can figure this out or decide for sure whether it will happen or not, it would be great for me.

#

and

#

i think the library you suggested will not work for me, I am aiming to make a real-time plugin

frigid cloud
cold juniper
frigid cloud
cold juniper
#

I see, then it is definitely not supported at the moment