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

Not working on next.js project

Open ivnsch opened this issue 3 years ago • 2 comments

I installed this extension and it's not doing anything, navigation and autocomplete don't work.

I found a couple issues here where it appears that it should work on next.js (not react-only).

VSCode 1.73.1 Next 12.3.0

ivnsch avatar Nov 21 '22 07:11 ivnsch

Could you supply a reproduced demo?

clinyong avatar Nov 23 '22 02:11 clinyong

@clinyong actually, I just noticed that the problem is specific to ids (when using the id attribute instead of class). Is that a known limitation?

Also, when using classes, is there a way to prevent this selection?

Screen Shot 2022-11-24 at 16 30 44

These issues can be reproduced with a nextjs starter project:

npx create-next-app@latest nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"

ivnsch avatar Nov 24 '22 15:11 ivnsch

Yes, the id attribute is not supported. We can't prevent the selection because there isn't an api for extension to do this.

clinyong avatar Nov 30 '22 05:11 clinyong

Would a feature request for the id make sense? And about the api, would it make sense to open an issue on the vscode repo maybe (I could do it)?

Edit: actually, id is not so important to me. I can easily replace them with classes.

ivnsch avatar Nov 30 '22 18:11 ivnsch

I think the "duplicate definitions in Go to Definition" issue is documented over here:

  • https://github.com/clinyong/vscode-css-modules/issues/63

As I mentioned in my last comments, someone could open an issue in the microsoft/vscode or microsoft/TypeScript repos to present the use case clearly and ask for some way for an extension (or user configuration) to be able to disable useless definition entries in Go to Definition.

karlhorky avatar Jan 06 '23 13:01 karlhorky

For Next.js itself, you can also consider modifying the node_modules/next/types/global.d.ts file containing these types, as I mentioned in https://github.com/clinyong/vscode-css-modules/issues/63#issuecomment-1372851831

You could modify it permanently in your project using something like patch-package.

karlhorky avatar Jan 06 '23 13:01 karlhorky

@clinyong actually, I just noticed that the problem is specific to ids (when using the id attribute instead of class). Is that a known limitation?

Also, when using classes, is there a way to prevent this selection?

Screen Shot 2022-11-24 at 16 30 44

These issues can be reproduced with a nextjs starter project:

npx create-next-app@latest nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"

Duplicate https://github.com/clinyong/vscode-css-modules/issues/63

iChenLei avatar Jan 07 '23 03:01 iChenLei