I realized that I can't use ctrl + .
shortcut to import other C#
classes. This shortcut works just fine for other file types like typescript.
I have uninstalled and installed back again. I also installed old version of VS code too. But nothing worked.
As I shown above, there is no import feature shows up when I do ctrl + .
. Those are only the choices I was given. It's fine using without it but it's also annoying to import those files manually typed.
The C# language features in VS Code are provided by a service called Omnisharp.
A couple of things you could try:
- Restart Omnisharp (
Omnisharp: Restart OmniSharp
from the command pallette (ctrl + shift p on windows) )
- check for errors in the Omnisharp log (ctrl + ' to bring up output pane then select output window then Omnisharp Log from the dropdown)
- Enable debugger logging in Omnisharp
Have you tried clearing out Visual Studio cache by any chance? Make sure Visual Studio is closed before attempting this. It is typically located at: C:\Users\Your User Name\AppData\Local\Microsoft\VisualStudio\
This cache could easily get corrupted and usually doesn't get cleared between re-installations.
Also, if previous doesn't work, try clearing temp directory as well - C:\Users\Your user name\AppData\Local\Temp
Few more additions to check
Check if Keyboard layout settings in Tools-> Options -> Environment -> Keyboard is set to Visual C# 2005
Check for IntelliSense settings in Tools -> Options -> Text Editor -> C# -> Formatting, for anything that may have caused the defaults to change
Hope this helps!
I faced into a similar situation. In My case I had several .csproj files and one solution file. Make sure to add all .csproj file to .sln file.
dotnet sln add <.csproj file path>.
Make sure to restart omnisharp.
In Mac -> (command + shift + p => select Omnisharp: Restart OmniSharp)