Description
By accident (looking for a component library), I stumbled upon this TypeScript language service plugin:
https://www.npmjs.com/package/typescript-plugin-css-modules
It seems to cover very similar use cases.
https://www.npmjs.com/package/typescript-plugin-css-modules#visual-studio-code
Things that work when configuring VSCode to use the workspace TS version as described in the README above:
- Reporting non-existing classes as problems
- Jump-to-definition for both classes and CSS module file names
- Suggesting classes from CSS module in IntelliSense, as it parses the whole CSS module into a type definition
- This also works when using square brackets, typing in quotes in square brackets yields suggestions for existing classes, and because the plugin treats CSS modules as TS code, it also type-checks static identifiers that resolve to CSS classes (see Dynamic Selector Resolution #88)
- I haven't tried SCSS as I don't use it anymore, but according to the docs it's supported as well
So there seems to be a lot of overlap and at the moment, the TS server language plugin seems to have all the features discussed here in place already.
This is a discussion issue, I hope it doesn't come across as dismissive or rude!
Are there unique advantages to this extension that typescript-plugin-css-modules
can't offer?
Otherwise, I'm afraid all the work has already been done. Performance of the TS language server plugin seems great as well.