2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: C# layer
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2019-05-07 08:53:56 +00:00
|
|
|
#+TAGS: general|layer|multi-paradigm|programming
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2017-08-20 17:45:49 +00:00
|
|
|
[[file:img/csharp.png]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2017-08-20 17:45:49 +00:00
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#packages-included][Packages Included]]
|
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#caveats][Caveats]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#navigation][Navigation]]
|
|
|
|
- [[#helpers-documentation-info][Helpers (documentation, info)]]
|
|
|
|
- [[#refactoring][Refactoring]]
|
|
|
|
- [[#omnisharp-server-interaction][OmniSharp server interaction]]
|
2018-10-21 07:59:47 +00:00
|
|
|
- [[#tests][Tests]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
2017-08-20 17:45:49 +00:00
|
|
|
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:
|
2017-08-28 01:44:46 +00:00
|
|
|
- Syntax checking with flycheck (when =syntax-checking= layer is used)
|
|
|
|
- Support for auto-completion (when =auto-completion= layer is used)
|
2017-08-20 17:45:49 +00:00
|
|
|
- Refactoring
|
|
|
|
- Navigation to cross-references
|
|
|
|
- Inspecting types in metadata
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Packages Included
|
2017-08-20 17:45:49 +00:00
|
|
|
- [[https://github.com/OmniSharp/omnisharp-emacs][omnisharp]]
|
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
|
|
|
|
2017-08-20 17:45:49 +00:00
|
|
|
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]].
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2018-10-21 07:59:47 +00:00
|
|
|
While the server will start automatically where possible if the
|
|
|
|
server needs to be started manually use ~SPC m s s~ (or
|
2017-08-20 17:45:49 +00:00
|
|
|
=M-x omnisharp-start-omnisharp-server=). It will prompt a path to your .cpsroj
|
2018-10-21 07:59:47 +00:00
|
|
|
or .sln file.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Caveats
|
2017-08-20 17:45:49 +00:00
|
|
|
- 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]].
|
2017-08-28 01:44:46 +00:00
|
|
|
- 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.
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2015-06-10 16:44:30 +00:00
|
|
|
** Navigation
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-----------------------------------------------|
|
2017-08-28 01:44:46 +00:00
|
|
|
| ~SPC m g c~ | Go to member in current file |
|
2018-01-10 04:26:08 +00:00
|
|
|
| ~SPC m g e~ | List errors and warnings in solution |
|
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 |
|
|
|
|
| ~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)
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+------------------------------------------------------------------------|
|
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
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-09-25 11:04:27 +00:00
|
|
|
|-------------+------------------------------------------|
|
|
|
|
| ~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 |
|
2017-08-20 17:45:49 +00:00
|
|
|
| ~SPC m r r~ | Refactor under cursor |
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
** OmniSharp server interaction
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+----------------------------|
|
2017-08-28 01:44:46 +00:00
|
|
|
| ~SPC m s i~ | Install OmniSharp server |
|
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 |
|
2018-10-21 07:59:47 +00:00
|
|
|
|
|
|
|
** Tests
|
|
|
|
|
2019-05-12 14:09:10 +00:00
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+----------------------------------|
|
|
|
|
| ~SPC m t b~ | Run tests in current buffer |
|
|
|
|
| ~SPC m t t~ | Run the last executed test again |
|
|
|
|
| ~SPC m t t~ | Run the test around point |
|