Alfred and Spotlight don't detect VSCode even though I've it on shortcuts

I had the same problem and just managed to fix it.

I went to System Preferences > Spotlight > Search Results and then unchecked "Applications", then re-checked "Applications" and it instantly fixed the problem.