Celty
Celty

Reputation: 21

Ctrl + click does not work with aliases path in VS Code

I'm using VS Code for my Vuejs project and I resolve the "src" path with "@", here is my config: enter image description here

And here is where I use the import statement with "@" enter image description here

The web runs fine but I cannot click to go to my file. Please help

Upvotes: 0

Views: 1825

Answers (1)

Icaruk
Icaruk

Reputation: 902

This worked for me!

{
  "compilerOptions": {
    "composite": true,
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
  },
  // vvv REMOVE
  "include": [
    "vite.config.js"
  ],
  // ^^^ REMOVE
  "exclude": [
    "node_modules",
    "dist",
    ".git"
  ]
}

If the paths that you import are not present in include VSCode will not detect them as "ctrl+clickable".

include doc:

Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later.

Upvotes: 0

Related Questions