Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode Intellisense with version 5 is very slow #215

Open
francescocaveglia opened this issue Mar 27, 2023 · 6 comments
Open

VSCode Intellisense with version 5 is very slow #215

francescocaveglia opened this issue Mar 27, 2023 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@francescocaveglia
Copy link

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''

@itibbers
Copy link

itibbers commented Apr 3, 2023

same issue 👀

"typescript": "^4.9.5",
"typescript-plugin-css-modules": "^5.0.0"

@mrmckeb
Copy link
Owner

mrmckeb commented Apr 10, 2023

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:

  1. Make it opt-in.
  2. 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?

@vaakian
Copy link

vaakian commented Apr 17, 2023

same issue

"typescript": "^4.9.5",
"typescript-plugin-css-modules": "^5.0.1"

@mrmckeb mrmckeb added the help wanted Extra attention is needed label Jun 5, 2023
@nulladdict
Copy link

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.

@mrmckeb mrmckeb added the enhancement New feature or request label Sep 22, 2023
@mrmckeb
Copy link
Owner

mrmckeb commented Sep 22, 2023

I've labelled this with "help wanted" and it's open for contribution, but haven't found time to dig into this yet sorry.

@ezze
Copy link

ezze commented Oct 12, 2023

Any progress on this, guys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants