I've started to get errors Unable to open 'header.h': File not found
when I try to jump to var/func definition via [Ctrl+Click] after I've deleted/renamed several files.
Is it possible to force reindex source code?
This question is a few years old now, but this is an issue I've seen a lot, and can usually be fixed with one of the following 5 options:
You can reload the current session, with the workbench.action.reloadWindow
command:
Open the Command Palette with Ctrl + Shift + P Then type
Reload Window
For C/C++ projects specificially, sometimes the intellisense indexing can be really slow, and feel like it's not working. One solution for this is to limit what it indexes with something like limitSymbolsToIncludedHeaders
, or reduce the amount of parsed files in c_cpp_properties.json
"browse": {
"path": [
"/usr/include/",
"/usr/local/include/",
"${workspaceRoot}/../include",
"${workspaceRoot}/dir2",
"${workspaceRoot}/dir3/src/c++"
...
]
}
Sometimes the file associations are incorrect, so files are not indexed as expected.
This can be fixed by adding something similar to this into your VS Code settings (settings.json
):
"intelephense.files.associations": ["*.php", "*.phtml", "*.inc", "*.module", "*.install", "*.theme", ".engine", ".profile", ".info", ".test"]
For Windows users, VS Code uses the system search index, so rebuilding that may help.
If you're project is sourced on a network drive, there's an extra step involved to get indexing working, by mounting to a local drive. This is a known issue (see #4008), which can be resolved by mounting the app from a fixed drive or mapping the network drive to a local drive letter (e.g. if your network drive is located at \\NETWORKPATH\home\USER\REPO\GITREPO
, then map it to X:/
on your local machine.
Finally, it may seem obvious, but just confirm that Intellisense is actually enabled, with editor.tabCompletion
in your settings.json. And if you're searching with results not displaying, ensure there aren't any filters preventing results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With