Reindex a source code in the VSCode

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:

Reload Session

You can reload the current session, with the workbench.action.reloadWindow command:

Open the Command Palette with Ctrl + Shift + P Then type Reload Window


Filter Files being Indexed

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++"
    ...
  ]
}

Set File Associations

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"]

Rebuild System Index

For Windows users, VS Code uses the system search index, so rebuilding that may help.


Network Drive Setup

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.


Ensure Intellisense Enabled

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.

Leave a Comment