markjprice / cs11dotnet7

Repository for the Packt Publishing book titled "C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals" by Mark J. Price
566 stars 206 forks source link

Go to Definition in VSCode #90

Open flepow opened 2 months ago

flepow commented 2 months ago

Please check that your issue is not already in the errata aka list of corrections and improvements. Please note that PRs will be ignored because code in the repo must match the print book already published. Please raise an issue instead so I can handle it appropriately. All issues will be entered into the errata once closed. They will also be fixed in the next book edition.

You can delete the note above after reading it. Please complete as much information below as possible so that I can understand and fix the issue quickly. Screenshots can be especially useful. You can drag and drop images into the box. Thank you!

Chapter: 1 Page Number: 37 Section Title: Getting definitions of types and her members Step Number: 3 Problem to fix: No Definition Found in VSCode and C#12 Suggested solution: Other useful information e.g. OS, coding tools, and so on: Entering "omni" in the command palette says "no matching command" because OmniSharp has been disabled by C#12 in the latest update to VSCode. If OmniSharp is reinstalled, The C# Dev Kit must be disabled or OmniSharp will be ignored. If you disabled the C# Dev Kit "Go to Definition" is removed from the drop down if you right click the "int" keyword. None of the internet suggestions worked for me. What is your workaround in C#12 in VSCode? VS 2022 works fine.

markjprice commented 2 months ago

This issue with OmniSharp being missing appears in multiple errata entries:

https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/errata.md#page-8---installing-other-extensions

https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/errata.md#page-28---writing-code-using-visual-studio-code

https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/errata.md#page-31---adding-a-second-project-using-visual-studio-code

I recommend using the latest C# Dev Kit without OmniSharp. Go To Definition works fine with it.

markjprice commented 2 months ago

image

markjprice commented 2 months ago

An updated step-by-step is available in the .NET 8 book repo: https://github.com/markjprice/cs12dotnet8/blob/main/docs/code-editors/vscode.md