I'm using VSCode 1.19 and trying to "Go>Go to definition" in a C# file like in Visual Studio and it does nothing. In a .js file it works well and i'm guessing if there is some workaround this.
C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development on Windows, Linux, and macOS.
After stopping the C file, go & click the File button at the top left corner of the Visual Studio Code Editor, and select the Settings via Preferences, as shown below image. After clicking the Settings, it shows the image below. In this image, select the extension button to set the settings for the C Compiler.
Visual Studio Code is a lightweight, cross-platform development environment that runs on Windows, Mac, and Linux systems. The Microsoft C/C++ for Visual Studio Code extension supports IntelliSense, debugging, code formatting, auto-completion.
You have to change it so it runs in the terminal. Go to the menu Code > Preferences > Settings. In the User tab on the left panel, expand the Extensions section. Find and select Run Code Configuration.
There may be multiple "projects" in the folder and VSCode has selected the "wrong" one. (in VSCode terms "project" means the sln file)
Use ctrl-shift-P and select "OmniSharp: Select Project" to select the correct project (a .sln file).
If you have the Output window open with "OmniSharp Logs" selected, you will see it reading your csproj's. Once finished your goto definition will start to work
As written in the comments for @AndyPook's answer, another possible solution is to just restart OmniSharp.
CTRL + SHIFT + P -> OmniSharp: Restart OmniSharp
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