Intellisense not automatically working VSCode
Visual Studio Code's more advanced editing features (IntelliSense, refactoring tools, etc.) only work in C# files if you have a project.json
file or *.sln
file that VSCode is aware of. Open the folder (i.e. open the File menu and click Open Folder...) with the *.sln
file or project.json
and VSCode will attempt to find all project/solution files in the folder. If there are multiple projects, you may need to select one from the projects button on the right side of the status bar (bottom of the window).
From the VSCode website:
- Selecting a
project.json
-file is opening a DNX-project and VSCode will load that project plus the referenced projects- Selecting a
*.sln
-file is opening a MSBuild-project. It will load the referenced*.csproj
-projects and sibling or descendantproject.json
-files but no other project files that are referenced from the solution file.- Selecting a
folder
will make VSCode scan for*.sln
andproject.json
files and VSCode will attempt to load them all.
If you have a workspace and for some reason have multiple folders you may need to 'help' omnisharp a bit. I initially had a big project and added a solution for it further on - ending up with TWO workspace folders (one to a startup project and one to the solution). After composing that setup I experienced only the first project to have intellisense working.
Solution to get intellisense working was to make sure omnisharp worked its way from the solution instead of the project:
- Ctrl + Shift + p
- Write "OmniSharp: Select Project" and press Enter.
- Choose the solution workspace entry.
Inspiration gotten from 'swaner': https://github.com/OmniSharp/omnisharp-vscode/issues/1889