VSCode Intellisense with version 5 is very slow
francescocaveglia opened this issue ยท 7 comments
VSCode Intellisense with version 5 is very slow
typescrpt@5 and typescript-plugin-css-modules@5: ~50''
typescrpt@4 and typescript-plugin-css-modules@4: ~2''
same issue ๐
"typescript": "^4.9.5",
"typescript-plugin-css-modules": "^5.0.0"
Hi there,
I've been digging into this today. With the move to TypeScript 5.x, the previous methods we used were deprecated (at least, we could no longer extend them).
As a result, we now need to provide a fresh script snapshot every time TypeScript requests one. As CSS modules often rely on imports, and we're using different renderers (Less, Sass, etc), caching becomes more complicated.
I think a quick fix here would be to add some kind of caching. I'm thinking:
- Make it opt-in.
- Use a short, time-based cache. Maybe 2-5 seconds.
Do you (@francescocaveglia or @itibbers) have an example project you could share, or something you could simply create with dummy data?
same issue
"typescript": "^4.9.5",
"typescript-plugin-css-modules": "^5.0.1"
In my project it takes a couple of seconds for every completion (we use scss, but it shouldn't matter). This means things like console.
completions just don't work.
Here's a repro with lots of dummy css modules: https://github.com/nulladdict/typescript-plugin-css-modules-repro-215
Unfortunate thing is that it affects every single completion even if the entire module graph was reused (in logs updateGraphWorker
says structureChanged: false structureIsReused:: Completely
while still taking a couple of seconds to complete)
I don't think short time-based caching would solve the issue, instead it would make completions periodically take long time, which is still not usable. Ideally we would need to update the cache only if files known to TS change.
I'm not sure if it's possible, but we can also try to skip snapshotting if we're autocompleting something unrelated to css module.
I've labelled this with "help wanted" and it's open for contribution, but haven't found time to dig into this yet sorry.
Any progress on this, guys?