vscode-css-modules icon indicating copy to clipboard operation
vscode-css-modules copied to clipboard

Autocomplete for imports

Open FINDarkside opened this issue 3 years ago • 4 comments

I'm not sure if this is out of scope for this module, but it would be nice to have autocomplete when importing css modules. At the moment I have code like this

import styles from './Block.module.scss';

But vscode will never offer any suggestions when writing the import. Suggestions work just fine when actually using styles.

FINDarkside avatar Apr 08 '22 15:04 FINDarkside

I think it's out of scope, guys.

iChenLei avatar Apr 12 '22 02:04 iChenLei

it would be really nice

mindmind avatar May 06 '22 11:05 mindmind

Actually, this should have been implemented in TypeScript (and I'm sure it can easily be done), but for now I made it work in my extension: https://github.com/zardoy/typescript-vscode-plugins#file-extension-suggestions

import '@/styles/|' // | - files with .module.css will appear here

It works with any extensions in native way to TypeScript, so it will work with aliases, node_modules and so on...

zardoy avatar Jan 24 '23 21:01 zardoy

Will be available in TypeScript 5.0 and available today with TypeScript nightly extension (typescript@next), you just need to have module augmentation in project like import 'vite/client' (still important for js projects)

zardoy avatar Feb 17 '23 20:02 zardoy