-
Notifications
You must be signed in to change notification settings - Fork 4
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
Multiple Entries on Go to Definition #68
Multiple Entries on Go to Definition #68
Comments
I tried the changes from #70 out just now in More details:
|
@karlhorky Can u also let me know the typescript version you are using in your project ? One thing I tried in the example In this case it works. Will continue to debug further Screen.Recording.2023-02-01.at.19.51.48.mov |
I tried with the following, neither seem to work (tried reloading the editor as well between switching):
In the video above, there are two things that may be different:
|
@karlhorky That was my bad . However it doesn't make any difference. Even if I open the entire I may have a potential fix which I would try . I will keep you posted |
Seems like it is reproducible in the Change to this directory, install the dependencies and open VS Code using: cd examples/next-js-app-dir-css-modules
npm install
code .
|
@karlhorky So I shipped 1.6.4 (latest) which fixes the problem. As pointed out here Viijay-Kr/typescript-cleanup-definitions#1 (comment) The extension was not shipped with node_modules which resulted in a error where plugin could not be loaded since the |
Indeed, Thanks for this, nice work! Closing. |
@Viijay-Kr Hmm... need to reopen this :( Looks like this Next.js entry removal is broken again in version Here's the project repo: https://github.com/upleveled/next-js-example-winter-2023-vienna-austria Here's the config I tried:
{
"reactTsScss.autoComplete": true,
"reactTsScss.baseDir": "src",
"reactTsScss.cleanUpDefs": [
"*.module.css",
"*.module.scss",
"*.module.sass",
"*.module.less",
"*.module.styl",
"node_modules/next/types/global.d.ts"
],
"reactTsScss.codelens": false,
"reactTsScss.cssAutoComplete": true,
"reactTsScss.cssDefinitions": true,
"reactTsScss.cssSyntaxColor": true,
"reactTsScss.definition": true,
"reactTsScss.diagnostics": true,
"reactTsScss.peekProperties": true,
"reactTsScss.references": false,
"reactTsScss.tsconfig": "./tsconfig.json",
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
} |
Ah to be clear, this only happens when cmd-clicking on the import path at the top ( Maybe this never worked to cmd-click on the import path 🤔 Would be great to be able to get it also enabled to be 1-click if possible. Using cmd-click on each CSS class still works as it did before 🙌 🎉 Kapture.2023-03-05.at.13.41.07.mp4 |
Hey @karlhorky how is it going ? 👋🏼.
Yeah , this is true , the plugin never considers the import path as mentioned here by Do you think its a bad experience ? |
I'm well thanks! You're good too I trust? Which of @zardoy's comments in Viijay-Kr/typescript-cleanup-definitions#1 are you referring to? I see this comment which refers to a path, but is this actually related to a cmd-click on the path of the import?
Since all other cmd-clicks work with a single click, I would expect that this one would also work this way for UX consistency. |
I'm specifically referring to the part where he mentions about neglecting useful definitions in the first comment he did However , in this case , import statements definitely is not useful , so I guess imports are not handled gracefully. I will try to find some time in the coming week, the work should be done in the plugin so if @zordoy is able to pitch in it would be great. |
If possible, I'll try to help next week as well |
@Viijay-Kr ha! I see you try to mention me in many wrong ways 😆 And do you mean you something like this? https://github.com/zardoy/typescript-vscode-plugins/blob/2cd6a12d4e651db69d176770023c2e5247ce85aa/typescript/src/definitions.ts#LL146C13-L156C15 as you see its just a few lines of code, shouldn't be hard... |
In the
app/page.tsx
file in the Next.js app dir examplecmd
-clicking on thestyles.code
property to trigger Go to Definition in VS Code shows an extra entry of thenode_modules/next/types/global.d.ts
file with the*.module.css
type definition.This makes it no longer a one-click Go to Definition interaction. It would be great to get rid of these generic
*.module.css
/*.module.scss
/*.module.sass
entries so that it's a single click again.This is also a problem with other extensions:
Potential approach
It seems that @zardoy has found a potentially interesting approach in his extension TypeScript Essential Plugins (repo). Some interesting parts of the code:
If I'm understanding correctly, this is filtering out previous definitions if they have the name
*.module.css
, which could also be extended to include*.module.scss
and*.module.sass
.The text was updated successfully, but these errors were encountered: