Omnisharp: the tooling behind the C# integration in VS Code - Day 18 - 24 days of "Front-end Development with ASP.NET Core, Angular, and Bootstrap"

We are entering the last week of the calendar, and we are also reaching the end of the book. Today is time to look at the cross-platform tools used to develop ASP.NET Core application on any platform. We'll have a look at Visual Studio Code, and specifically how the C# integration works.

Visual Studio Code is just a simple text editor, with no language-specific features or knowledge. All language-specific tools are coming as external extensions, either developed by Microsoft or by the community.

So how can Visual Studio Code show Intellisense when you type .NET code, or provide refactoring suggestions or show compilation errors in real time? This is done using Omnisharp. Here is an extract from chapter 8 of book, which briefly explains what Omnisharp is.

All these features, as far as their support for .NET Core is
concerned, are possible thanks to OmniSharp. OmniSharp is a set of OSS
projects that work together for bringing .NET development to any text
editor.

The base layer is a server that runs Roslyn and analyzes the files of
the project that is open inside the editor.

On top of this there is an API (REST-based over HTTP or over pipes)
that allows clients (text editors via their extensions) to query the
code model to get intellisense, parameter information, the references
to a variable, or the definition of a method. At the top layer are all
the editor-specific extensions that display the information retrieved
from the OmniSharp server in a user-friendly way. The top layer also
includes other features that are purely client-side such as code
formatting or snippet expansion. It is also the extensions that
interact with the debugger to provide all the features needed for
debugging your code.

OmniSharp extensions have been developed for the most popular text
editors on the market. Apart from Visual Studio Code, there are
extensions for Atom, Vim, Sublime, and even Emacs. This means that you
can continue using your favorite text editor and still be able to get
all the benefit of a rich code-editing experience powered by
OmniSharp.