typescript-plugin-css-modules icon indicating copy to clipboard operation
typescript-plugin-css-modules copied to clipboard

Does not work in VSCode and a common SvelteKit project.

Open enyo opened this issue 1 year ago • 3 comments

I assume that this is related to #212 but I wasn't able to get it to work in normal .ts files either so I'm creating a new issue.

Here is the reproduction: https://github.com/enyo/typescript-css-modules-demo

There are only 2 commits:

  1. The first commit after doing npm create svelte@latest my-app
  2. My changes that add typescript-plugin-css-modules and show that there is no intellisense.

enyo avatar Feb 24 '24 11:02 enyo

I'm pretty sure that this is due to https://github.com/sveltejs/language-tools/issues/905

So I guess that this plugin can't do anything about it.

Maybe it's worth adding a note with a link to the issue to the README so svelte users don't need to bang their head against the table?

enyo avatar Feb 24 '24 13:02 enyo

It should work in ts/js files. You probably missed this section in the README https://github.com/mrmckeb/typescript-plugin-css-modules?tab=readme-ov-file#visual-studio-code. That's the first problem I encounter when opening your reproduction.

And for svelte files, it's explained in the issue you linked. The object needed for the language service plugin simply doesn't exist in the Svelte language server. I'll reply to the comment you asked in that issue. It also won't work in the +page.ts + +layout.ts files in a SvelteKit project because of the way zero-config type-safety was implemented in the typescript-svelte-plugin(not to be confused with the vscode extension or the svelte language server). So this is not something that can be fixed in typescript-plugin-css-modules.

jasonlyu123 avatar Feb 25 '24 05:02 jasonlyu123