Reputation: 1474
I've just switched to vscode from atom. I miss the path autocomplete when you import a file. In atom, all the files that are in my workspace are automatically searched for the matching keyword. However, in vscode, only the node modules and the relative directories are searched. This forces me to guess the directory structure to get to the file I want to import. Is there a way to make vscode search for all the files in the workspace directory (excluding external modules)?
Upvotes: 1
Views: 4204
Reputation: 317
If you create a jsconfig.json
file in your project root, with target
and module
complierOptions
, than VSCode will autocomplete your imports.
Official docs: https://code.visualstudio.com/docs/languages/jsconfig
An example of jsconfig.json
:
{
"include": ["src"],
"exclude": [
".cache",
"build",
"node_modules",
"**/node_modules/*",
"**/.cache/*",
"**/build/*"
],
"compilerOptions": {
"jsx": "react-jsx",
"target": "es2020",
"module": "commonjs",
"strict": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true
}
}
Upvotes: 0
Reputation: 101
I would suggest you take a look at this extension for vs code...I use it all the time and it is great.
Upvotes: 2