2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: C# layer
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
[[file:img/csharp.png]] [[file:img/dotnet.png]]
|
|
|
|
|
2016-03-31 02:59:55 +00:00
|
|
|
* Table of Contents :TOC_4_gh:noexport:
|
|
|
|
- [[#description][Description]]
|
|
|
|
- [[#packages-included][Packages Included]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#prerequisites][Prerequisites]]
|
|
|
|
- [[#aspnet-5][ASP.NET 5]]
|
|
|
|
- [[#curl][curl]]
|
|
|
|
- [[#omnisharp-server][Omnisharp server]]
|
|
|
|
- [[#caveats][Caveats]]
|
|
|
|
- [[#key-bindings][Key Bindings]]
|
|
|
|
- [[#compilation][Compilation]]
|
|
|
|
- [[#filesolutionproject-manipulation][File/Solution/Project manipulation]]
|
|
|
|
- [[#navigation][Navigation]]
|
|
|
|
- [[#helpers-documentation-info][Helpers (documentation, info)]]
|
|
|
|
- [[#refactoring][Refactoring]]
|
|
|
|
- [[#omnisharp-server-interaction][OmniSharp server interaction]]
|
|
|
|
- [[#tests][Tests]]
|
|
|
|
- [[#code-manipulation][Code manipulation]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
This layer adds experimental support for C# language using [[https://github.com/OmniSharp/omnisharp-emacs][OmniSharp]].
|
|
|
|
|
|
|
|
* Packages Included
|
|
|
|
- [[https://github.com/OmniSharp/omnisharp-emacs][OmniSharp-emacs]]
|
2016-04-13 03:31:38 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
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.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Prerequisites
|
|
|
|
*** ASP.NET 5
|
2017-04-26 13:50:19 +00:00
|
|
|
Follow the instructions for your platform [[https://github.com/aspnet/home#user-content-get-started][here]].
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
*** curl
|
2017-04-26 13:50:19 +00:00
|
|
|
You'll need [[https://curl.haxx.se/][curl]] to be able to use the Omnisharp package. Use your favorite
|
2015-06-10 16:44:30 +00:00
|
|
|
package manager to install it (on Windows you can use [[https://chocolatey.org/][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=:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default omnisharp--curl-executable-path "/PATH/TO/CURL/curl")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
*** Omnisharp server
|
|
|
|
You have to compile the OmniSharp server following the instructions which can
|
|
|
|
be found [[https://github.com/OmniSharp/omnisharp-server][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):
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(setq-default omnisharp-server-executable-path "/PATH/TO/OMNISHARP/OmniSharpServer")
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
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
|
2015-06-10 21:16:01 +00:00
|
|
|
[[http://www.monodevelop.com/][MonoDevelop]], it's therefore recommended that you install it to create your
|
|
|
|
solutions.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
- Debugging is possible using [[https://github.com/mono/sdb][SDB]].
|
2016-04-13 03:31:38 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Key Bindings
|
|
|
|
** Compilation
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+--------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m c c~ | Build the solution |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** File/Solution/Project manipulation
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+-----------------------------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~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 |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Navigation
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+-----------------------------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m g f~ | Go to solution file |
|
|
|
|
| ~SPC m g F~ | Go to solution file then member |
|
2016-01-09 03:42:14 +00:00
|
|
|
| ~SPC m g c~ | Go to member in current file |
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m g g~ | Go to definition |
|
|
|
|
| ~SPC m g G~ | Go to definition in other window |
|
|
|
|
| ~SPC m g i~ | Find implementations |
|
2015-09-25 11:04:27 +00:00
|
|
|
| ~SPC m g I~ | Find implementations using ido |
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~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 |
|
2015-09-25 11:04:27 +00:00
|
|
|
| ~SPC m g U~ | Find usages of symbol under cursor using ido |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Helpers (documentation, info)
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+------------------------------------------------------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~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 |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Refactoring
|
|
|
|
|
2015-09-25 11:04:27 +00:00
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+------------------------------------------|
|
|
|
|
| ~SPC m r m~ | Rename symbol under cursor |
|
2016-01-09 03:42:14 +00:00
|
|
|
| ~SPC m r M~ | Rename symbol under cursor interactively |
|
2015-09-25 11:04:27 +00:00
|
|
|
| ~SPC m r r~ | Refactor symbol under cursor |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** OmniSharp server interaction
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+----------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m s r~ | Reload the solution |
|
|
|
|
| ~SPC m s s~ | Start the OmniSharp server |
|
|
|
|
| ~SPC m s S~ | Stop the OmniSharp server |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Tests
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+---------------------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m t a~ | Run all tests in project |
|
|
|
|
| ~SPC m t b~ | Run all tests in current file/fixture |
|
|
|
|
| ~SPC m t t~ | Run test under cursor |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** Code manipulation
|
|
|
|
|
|
|
|
| Key Binding | Description |
|
|
|
|
|-------------+---------------------------|
|
2015-06-12 01:23:07 +00:00
|
|
|
| ~SPC m o~ | Auto complete overrides |
|
|
|
|
| ~SPC m i~ | Fix usings/imports |
|
|
|
|
| ~SPC m =~ | Format the current buffer |
|