Skip to content

Latest commit

 

History

History
105 lines (85 loc) · 4.56 KB

README.org

File metadata and controls

105 lines (85 loc) · 4.56 KB

C# layer

img/csharp.png

Table of Contents

Description

This layer adds support for C# language using the omnisharp-roslyn language server and corresponding omnisharp-emacs package.

Please report any issues encountered to omnisharp-emacs issue page on github. PRs are welcome too!

Features:

  • Syntax checking with flycheck (when syntax-checking layer is used)
  • Support for auto-completion (when auto-completion layer is used)
  • Refactoring
  • Navigation to cross-references
  • Inspecting types in metadata

Packages Included

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add csharp to the existing dotspacemacs-configuration-layers list in this file.

Before you can work with C# files you will need to install the server by invoking SPC m s i (or M-x omnisharp-install-server). Otherwise, if this fails for you, please see omnisharp-emacs/doc/server-installation.md.

While the server will start automatically where possible if the server needs to be started manually use SPC m s s (or M-x omnisharp-start-omnisharp-server). It will prompt a path to your .cpsroj or .sln file.

Caveats

  • You should use dotnet CLI tool from .NET Core download page or an IDE like Visual Studio or Xamarin Studio to manage solution and project files.
  • Debugging on command line is possible using SDB.
  • There can be only one server running at the same time. To switch to a different solution/project you need to invoke SPC m s S and SPC m s s to stop current server and start another one pointing to another solution/project.

Key bindings

Navigation

Key bindingDescription
SPC m g cGo to member in current file
SPC m g eList errors and warnings in solution
SPC m g fGo to solution file
SPC m g FGo to solution file then member
SPC m g gGo to definition
SPC m g GGo to definition in other window
SPC m g iFind implementations
SPC m g IFind implementations using ido
SPC m g mGo to solution member
SPC m g MGo to solution member in other window
SPC m g rGo to region
SPC m g sFind symbols using Helm
SPC m g uFind usages of symbol under cursor using Helm
SPC m g UFind usages of symbol under cursor using ido

Helpers (documentation, info)

Key bindingDescription
SPC m h tGet type information for symbol under cursor
SPC m h TGet type information for symbol under cursor and put it into kill-ring

Refactoring

Key bindingDescription
SPC m r mRename symbol under cursor
SPC m r MRename symbol under cursor interactively
SPC m r rRefactor under cursor

OmniSharp server interaction

Key bindingDescription
SPC m s iInstall OmniSharp server
SPC m s rReload the solution
SPC m s sStart the OmniSharp server
SPC m s SStop the OmniSharp server

Tests

Key bindingDescription
SPC m t bRun tests in current buffer