omnisharp

URL: https://github.com/OmniSharp/omnisharp-roslyn

plugins.lsp.servers.omnisharp.enable

Whether to enable https://github.com/omnisharp/omnisharp-roslyn OmniSharp server based on Roslyn workspaces

omnisharp-roslyn can be installed by downloading and extracting a release from here. OmniSharp can also be built from source by following the instructions here.

OmniSharp requires the dotnet-sdk to be installed.

By default, omnisharp-roslyn doesn’t have a cmd set. This is because nvim-lspconfig does not make assumptions about your path. You must add the following to your init.vim or init.lua to set cmd to the absolute path ($HOME and ~ are not expanded) of the unzipped run script or binary.

For go_to_definition to work fully, extended textDocument/definition handler is needed, for example see omnisharp-extended-lsp.nvim

require'lspconfig'.omnisharp.setup {
    cmd = { "dotnet", "/path/to/omnisharp/OmniSharp.dll" },

    settings = {
      FormattingOptions = {
        -- Enables support for reading code style, naming convention and analyzer
        -- settings from .editorconfig.
        EnableEditorConfigSupport = true,
        -- Specifies whether 'using' directives should be grouped and sorted during
        -- document formatting.
        OrganizeImports = nil,
      },
      MsBuild = {
        -- If true, MSBuild project system will only load projects for files that
        -- were opened in the editor. This setting is useful for big C# codebases
        -- and allows for faster initialization of code navigation features only
        -- for projects that are relevant to code that is being edited. With this
        -- setting enabled OmniSharp may load fewer projects and may thus display
        -- incomplete reference lists for symbols.
        LoadProjectsOnDemand = nil,
      },
      RoslynExtensionsOptions = {
        -- Enables support for roslyn analyzers, code fixes and rulesets.
        EnableAnalyzersSupport = nil,
        -- Enables support for showing unimported types and unimported extension
        -- methods in completion lists. When committed, the appropriate using
        -- directive will be added at the top of the current file. This option can
        -- have a negative impact on initial completion responsiveness,
        -- particularly for the first few completion sessions after opening a
        -- solution.
        EnableImportCompletion = nil,
        -- Only run analyzers against open files when 'enableRoslynAnalyzers' is
        -- true
        AnalyzeOpenDocumentsOnly = nil,
      },
      Sdk = {
        -- Specifies whether to include preview versions of the .NET SDK when
        -- determining which version to use for project loading.
        IncludePrereleases = true,
      },
    },
}

.

Type: boolean

Default: false

Example: true

Declared by:

plugins.lsp.servers.omnisharp.package

The omnisharp package to use.

Type: null or package

Default: pkgs.omnisharp-roslyn

Declared by:

plugins.lsp.servers.omnisharp.autostart

Controls if the FileType autocommand that launches a language server is created. If false, allows for deferring language servers until manually launched with :LspStart (|lspconfig-commands|).

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.lsp.servers.omnisharp.cmd

A list where each entry corresponds to the blankspace delimited part of the command that launches the server.

The first entry is the binary used to run the language server. Additional entries are passed as arguments.

Type: null or (list of string)

Default:

[
  "OmniSharp"
]

Declared by:

plugins.lsp.servers.omnisharp.extraOptions

Extra options for the omnisharp language server.

Type: attribute set of anything

Default: { }

Declared by:

plugins.lsp.servers.omnisharp.filetypes

Set of filetypes for which to attempt to resolve {root_dir}. May be empty, or server may specify a default value.

Type: null or (list of string)

Default: null

Declared by:

plugins.lsp.servers.omnisharp.rootDir

A function (or function handle) which returns the root of the project used to determine if lspconfig should launch a new language server, or attach a previously launched server when you open a new buffer matching the filetype of the server.

Type: null or lua function string

Default: null

Plugin default: "nil"

Declared by: