spacemacs/layers/+lang/csharp/README.org
2017-08-27 21:44:46 -04:00

100 lines
4.4 KiB
Org Mode

#+TITLE: C# layer
[[file:img/csharp.png]]
* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#features][Features:]]
- [[#packages-included][Packages Included]]
- [[#install][Install]]
- [[#caveats][Caveats]]
- [[#key-bindings][Key Bindings]]
- [[#navigation][Navigation]]
- [[#helpers-documentation-info][Helpers (documentation, info)]]
- [[#refactoring][Refactoring]]
- [[#omnisharp-server-interaction][OmniSharp server interaction]]
* Description
This layer adds support for C# language using the [[https://github.com/OmniSharp/omnisharp-roslyn][omnisharp-roslyn]] language
server and corresponding [[https://github.com/OmniSharp/omnisharp-emacs][omnisharp-emacs]] package.
Please report any issues encountered to [[https://github.com/OmniSharp/omnisharp-emacs/issues][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
- [[https://github.com/OmniSharp/omnisharp-emacs][omnisharp]]
* 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 [[https://github.com/OmniSharp/omnisharp-emacs/blob/master/doc/server-installation.md][omnisharp-emacs/doc/server-installation.md]].
The server needs to be started manually with ~SPC m s s~ (or with
=M-x omnisharp-start-omnisharp-server=). It will prompt a path to your .cpsroj
or .sln file. In the future the server will be started automatically however for
now this is required.
* Caveats
- You should use =dotnet= CLI tool from [[https://www.microsoft.com/net/download/core][.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 [[https://github.com/mono/sdb][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 Binding | Description |
|-------------+-----------------------------------------------|
| ~SPC m g c~ | Go to member in current file |
| ~SPC m g f~ | Go to solution file |
| ~SPC m g F~ | Go to solution file then member |
| ~SPC m g g~ | Go to definition |
| ~SPC m g G~ | Go to definition in other window |
| ~SPC m g i~ | Find implementations |
| ~SPC m g I~ | Find implementations using ido |
| ~SPC m g m~ | Go to solution member |
| ~SPC m g M~ | Go to solution member in other window |
| ~SPC m g r~ | Go to region |
| ~SPC m g s~ | Find symbols using Helm |
| ~SPC m g u~ | Find usages of symbol under cursor using Helm |
| ~SPC m g U~ | Find usages of symbol under cursor using ido |
** 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 |
** 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 under cursor |
** OmniSharp server interaction
| Key Binding | Description |
|-------------+----------------------------|
| ~SPC m s i~ | Install OmniSharp server |
| ~SPC m s r~ | Reload the solution |
| ~SPC m s s~ | Start the OmniSharp server |
| ~SPC m s S~ | Stop the OmniSharp server |