C# layer
Table of ContentsClose
1 Description
This layer adds experimental support for C# language using OmniSharp.
3 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.
3.1 Prerequisites
3.1.1 ASP.NET 5
Follow the instructions for your platform here.
3.1.2 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")
3.1.3 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.
4 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.
5 Key Bindings
5.2 File/Solution/Project manipulation
Key Binding | Description |
---|---|
SPC m f a |
Add the current file to solution |
SPC m f A |
Add files selected in dired to solution |
SPC m f r |
Remove the current file from solution |
SPC m f R |
Removed files selected in dired from solution |
SPC m p l |
Add reference to solution |
5.4 Helpers (documentation, info)
Key Binding | Description |
---|---|
SPC m h t |
Get type information for symbol under cursor |
SPC m h T |
Get type information for symbol under cursor and put it into kill-ring |
5.5 Refactoring
Key Binding | Description |
---|---|
SPC m r m |
Rename symbol under cursor |
SPC m r M |
Rename symbol under cursor interactively |
SPC m r r |
Refactor symbol under cursor |
5.6 OmniSharp server interaction
Key Binding | Description |
---|---|
SPC m s r |
Reload the solution |
SPC m s s |
Start the OmniSharp server |
SPC m s S |
Stop the OmniSharp server |