VSCode Intellisense: "Add import from" only suggests relative path for `cn`

When using the Quick Fix menu in VSCode ("Cmd + ."), it only suggests the relative path to import my cn function. It DOES work correctly when I'm trying to add an import for something in my components directory (see screenshots). They appear to be set up the same so I'm not sure what gives. In my tsconfig.json file, I have
"paths": {
"@/*": ["./src/*"]
}
"paths": {
"@/*": ["./src/*"]
}
I don't think this is relevant, but my shadcn components.json file includes:
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
Solution:
I figured it out. I needed to set
"typescript.preferences.importModuleSpecifier": "non-relative"
"typescript.preferences.importModuleSpecifier": "non-relative"
in my VScode settings.json file...
Jump to solution
2 Replies
peteypie_
peteypie_6mo ago
Note: The import alias "@/lib/utils" does work fine, the issue is that I have to manually type it and Intellisense does not suggest it using the Quick Fix menu in VSCode. Oof. OK actually I see now that it only worked for the components import because I was already importing things from that alias. If I remove all of the imports from "@/components/ui/dropdown-menu", the Quick Fix menu also only suggests the relative path. So how do I get Intellisense to suggest my import aliases instead of the relative path?
Solution
peteypie_
peteypie_6mo ago
I figured it out. I needed to set
"typescript.preferences.importModuleSpecifier": "non-relative"
"typescript.preferences.importModuleSpecifier": "non-relative"
in my VScode settings.json file
Want results from more Discord servers?
Add your server
More Posts
Vite, React, useQuery, API, StreamingHey, guys! I am new here and i a junior. I was curious if anyone can give me an advice on one questGlobal variable `Astro` type is `any` when migrating from v3 to v4I'm migrating my project from Astro v3 to v4. Now, the linter gives me errors as `Astro` type is `anError when using uploadthig uploadFilesFromUrlI'm getting this error when uploading an image url to uploadthing ``` Failed to set fetch cache URL Best alternative to next-auth for use with credentialsSince next-auth doesn't fully support credential based authentication and mainly is built for oauth Notification/Announcement ServiceI'm looking of an announcement/Notification service for a project I'm building, the notification serError when running `pnpm db:push`When i try to `pnpm db:push` i get this error ``` dg-system on  main [✘!?] via 🍞 v1.0.11 via  v2Mutations on the trpc functions is throwing ["ERR_INTERNAL_ASSERTION"], queries are working fine.Why are my mutations not working as they should ? The tRPC mutation function I call does not executeIs this Theo's Only discord server(asking because of most recent video)Is this Theo's Only discord server(asking because of most recent video)Does Account table/model in create-t3-app get used at all if using EmailProvider for NextAuth?In the Prisma schema for a `create-t3-app` with NextAuth, the following `Account` model is in the `sdiscriminated union as propsis there anything noticeably wrong with this ```ts type SidebareOpenContentsProps = { showSkeleton