Skip to content

Latest commit

 

History

History
143 lines (112 loc) · 5.54 KB

README.org

File metadata and controls

143 lines (112 loc) · 5.54 KB

C# layer

img/csharp.png img/dotnet.png

Table of Contents

Description

This layer adds experimental support for C# language using OmniSharp.

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.

Prerequisites

ASP.NET 5

Follow the instructions for your platform here.

curl

You’ll need curl to be able to use the Omnisharp package. Use your favorite package manager to install it (on Windows you can use chocolatey).

Be sure to make the curl binary available to your PATH environment variable, or set the variable omnisharp--curl-executable-path in your dotfile function dotspacemacs-config:

(setq-default omnisharp--curl-executable-path "/PATH/TO/CURL/curl")

Omnisharp server

You have to compile the OmniSharp server following the instructions which can be found here.

Don’t forget to add the server binary directory to your system PATH environment variable. The full path the binary can also be directly referenced in the variable omnisharp-server-executable-path (put this in your dotspacemacs-config function):

(setq-default omnisharp-server-executable-path "/PATH/TO/OMNISHARP/OmniSharpServer")

OmniSharp should now automatically load and start a server when you open a .cs file.

Caveats

  • It’s currently not possible to create a C# solution outside of an IDE such as MonoDevelop, it’s therefore recommended that you install it to create your solutions.
  • Debugging is possible using SDB.

Key Bindings

Compilation

Key BindingDescription
SPC m c cBuild the solution

File/Solution/Project manipulation

Key BindingDescription
SPC m f aAdd the current file to solution
SPC m f AAdd files selected in dired to solution
SPC m f rRemove the current file from solution
SPC m f RRemoved files selected in dired from solution
SPC m p lAdd reference to solution

Navigation

Key BindingDescription
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 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

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 rRefactor symbol under cursor

OmniSharp server interaction

Key BindingDescription
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 aRun all tests in project
SPC m t bRun all tests in current file/fixture
SPC m t tRun test under cursor

Code manipulation

Key BindingDescription
SPC m oAuto complete overrides
SPC m iFix usings/imports
SPC m =Format the current buffer