I have a NextJS project that I'd like to disable searching for text in the .next
folder.
Following this answer, I've added this to my preferences:
But still, I'm getting search results for that folder:
What could be the reason for this?
I have a NextJS project that I'd like to disable searching for text in the .next
folder.
Following this answer, I've added this to my preferences:
But still, I'm getting search results for that folder:
What could be the reason for this?
That works for me very easily. Here, I am searching for a div tag in a web project that has hundreds of them. If I exclude the "src" folder, none are found.
It is more tricky because there are ways of accidentally disabling your global exclusions.
From the VS Code help:
VS Code excludes some folders by default to reduce the number of search results that you are not interested in (for example: node_modules). Open settings to change these rules under the files.exclude and search.exclude section.
Note that glob patterns in the search view work differently than in settings such as files.exclude and search.exclude. In the settings, you must use **/example to match a folder named example in subfolder folder1/example in your workspace. In the search view, the ** prefix is assumed. The glob patterns in these settings are always evaluated relative to the path of the workspace folder.
Also note the Use Exclude Settings and Ignore Files toggle button in the files to exclude box. The toggle determines whether to exclude files that are ignored by your .gitignore files and/or matched by your files.exclude and search.exclude settings.
That last paragraph is the potential trap. I think it says, if you de-toggle it, then even though you have told VS Code in the settings to exclude ".next", it will nevertheless search everything including ".next".