spacemacs/layers/+lang/csharp
syl20bnr 74fdbb6795 Refactor and simplify company backends declaration
Enabling a company backend for a specific mode was a tedious tasks with code
scattered at different locations, one for local variable definitions, one for
company hook function definitions and another where the backends were pushed to
the local variables (which was problematic, since we ended up pushing the same
backends over and over again with `SPC f e R`, pushes have been replaced by
add-to-list calls in the new macro).

All these steps are now put together at one place with the new macro
spacemacs|add-company-backends, check its docstring for more info on its
arguments.

This macro also allows to define arbitrary buffer local variables to tune
company for specific modes (similar to layer variables via a keyword :variables)

The code related to company backends management has been moved to the
auto-completion layer in the funcs.el file. A nice side effect of this move is
that it enforces correct encapsulation of company backends related code. We can
now easily detect if there is some configuration leakage when the
auto-completion layer is not used. But we loose macro expansion at file loading
time (not sue it is a big concern though).

The function spacemacs|enable-auto-complete was never used so it has been
deleted which led to the deletion of the now empty file core-auto-completion.el.

The example in LAYERS.org regarding auto-completion is now out of date and has
been deleted. An example to setup auto-completion is provided in the README.org
file of the auto-completion layer.
2017-01-02 00:39:04 -05:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
config.el Refactor and simplify company backends declaration 2017-01-02 00:39:04 -05:00
packages.el Refactor and simplify company backends declaration 2017-01-02 00:39:04 -05:00
README.org Format documenation files with doc-fmt tool 2016-04-12 23:31:38 -04:00

C# layer

/TakeV/spacemacs/media/commit/74fdbb6795018a93a665fa2c417589cd4cbd51fc/layers/+lang/csharp/img/csharp.png /TakeV/spacemacs/media/commit/74fdbb6795018a93a665fa2c417589cd4cbd51fc/layers/+lang/csharp/img/dotnet.png

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 Binding Description
SPC m c c Build the solution

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

Navigation

Key Binding Description
SPC m g f Go to solution file
SPC m g F Go to solution file then member
SPC m g c Go to member in current file
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 symbol under cursor

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

Tests

Key Binding Description
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

Code manipulation

Key Binding Description
SPC m o Auto complete overrides
SPC m i Fix usings/imports
SPC m = Format the current buffer