OmniSharp is a C# based console application that has a rich API to support code intelligence for the C# language. With OmniSharp as the server, any text editor that supports plugins can be turned into a C# Development environment.
OnmiSharp requires a fully functioning .NET Core SDK installed and available from the path. You should able to run dotnet --info
from Omnisharp's environment. Install a .NET Core SDK from: https://aka.ms/dotnet-download. If a custom installation is to be used, follow the instructions here.
This document is a rough overview of how to interact with OmniSharp, and what the various features are.
OmniSharp supports several interfaces over the command line. Depending on the interface, you need to use the corresponding package (see Downloading OmniSharp for more info).
-
Http (using the
omnisharp.http
package) The http interface allows you to start up the server and communicate with it over HTTP. This interface is pull based, so the server has no way to push information to the client. The client may listen to theStdout
stream for logging information from the server.You may specify the port for http using the
-p <port>
flag. -
Stdio (using the
omnisharp
package) Stdio uses the standard process interfaces. The server will readStdin
for requests, and pipe responses back out overStdout
. Each line on either interface is a single request / response. With this interface, the server can have a two-way relationship with the server, such that the server can intelligently provide information for the client to consume. This can be anything from Diagnostics, to new references, package restores, and so on.You may specify the encoding for
Stdin
andStdout
streams using-e <encoding>
flag.
When starting the server you must specify a solution file, or a directory where OmniSharp will find a solution.
OmniSharp.exe -s <solutionPath>
The server will detect the project and start up the project systems for the types of projects it finds. There's no way of loading new projects after the server has started.
You can turn on verbose logging with the -v
switch.
OmniSharp supports the ability to shut it self down in the event its host process dies. If for example it crashed, or the user force killed the process.
OmniSharp.exe --hostPID
For historical reasons OmniSharp defaults to using one-based indices. That means that the incoming requests assume that the first line of a file is 1
and the first column of a line is also 1
. A feature has been added for editors that default to zero-based indices, using this feature OmniSharp will automatically translate the indices to zero-based for you automatically. This is helpful when dealing with deserializing lots of objects on the Editor side.
OmniSharp.exe --zero-based-indices
A detailed list of the exposed settings can be found in our Wiki.
TODO: Plugins will be supported in the future