2015-01-28 20:12:25 +00:00
|
|
|
;;; packages.el --- csharp Layer packages File for Spacemacs
|
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-01-28 20:12:25 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq csharp-packages
|
2015-04-09 03:57:22 +00:00
|
|
|
'(
|
|
|
|
company
|
2016-08-13 13:43:37 +00:00
|
|
|
csharp-mode
|
2016-06-04 02:15:25 +00:00
|
|
|
evil-matchit
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
|
|
|
helm-gtags
|
2015-04-09 03:57:22 +00:00
|
|
|
omnisharp
|
|
|
|
))
|
2015-01-28 20:12:25 +00:00
|
|
|
|
|
|
|
(defun csharp/init-omnisharp ()
|
|
|
|
;; Load omnisharp-mode with csharp-mode, this should start the omnisharp server automatically
|
|
|
|
(add-hook 'csharp-mode-hook 'omnisharp-mode)
|
|
|
|
(use-package omnisharp
|
|
|
|
:defer t
|
2015-08-12 19:17:59 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(when (configuration-layer/package-usedp 'company)
|
|
|
|
;; needed to avoid an error when fetching doc using company
|
|
|
|
;; Note: if you are using a roslyn based omnisharp server you can
|
|
|
|
;; set back this variable to t.
|
|
|
|
(setq omnisharp-auto-complete-want-documentation nil))
|
2016-08-13 13:43:37 +00:00
|
|
|
(push 'company-omnisharp company-backends-csharp-mode)
|
2016-09-04 16:24:43 +00:00
|
|
|
(add-to-list 'spacemacs-jump-handlers-csharp-mode
|
2016-08-13 13:43:37 +00:00
|
|
|
'omnisharp-go-to-definition))
|
2015-08-18 19:49:22 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-08-31 20:16:58 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mc" "csharp/compile")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mf" "csharp/file")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mg" "csharp/navigation")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mh" "csharp/documentation")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mr" "csharp/refactoring")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "ms" "csharp/server")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mt" "csharp/tests")
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'csharp-mode
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Compile
|
2015-11-18 00:38:05 +00:00
|
|
|
"cc" 'omnisharp-build-in-emacs ;; Only one compile command so use top-level
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Solution/project manipulation
|
2015-11-18 00:38:05 +00:00
|
|
|
"fa" 'omnisharp-add-to-solution-current-file
|
|
|
|
"fA" 'omnisharp-add-to-solution-dired-selected-files
|
|
|
|
"fr" 'omnisharp-remove-from-project-current-file
|
|
|
|
"fR" 'omnisharp-remove-from-project-dired-selected-files
|
|
|
|
"pl" 'omnisharp-add-reference
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Navigation
|
2015-11-18 00:38:05 +00:00
|
|
|
"gG" 'omnisharp-go-to-definition-other-window
|
|
|
|
"gu" 'omnisharp-helm-find-usages
|
2015-09-25 11:04:27 +00:00
|
|
|
"gU" 'omnisharp-find-usages-with-ido
|
2015-11-18 00:38:05 +00:00
|
|
|
"gs" 'omnisharp-helm-find-symbols
|
|
|
|
"gi" 'omnisharp-find-implementations
|
2015-09-25 11:04:27 +00:00
|
|
|
"gI" 'omnisharp-find-implementations-with-ido
|
2015-11-18 00:38:05 +00:00
|
|
|
"gr" 'omnisharp-navigate-to-region
|
|
|
|
"gm" 'omnisharp-navigate-to-solution-member
|
|
|
|
"gM" 'omnisharp-navigate-to-solution-member-other-window
|
|
|
|
"gf" 'omnisharp-navigate-to-solution-file
|
|
|
|
"gF" 'omnisharp-navigate-to-solution-file-then-file-member
|
2015-09-25 11:04:27 +00:00
|
|
|
"gc" 'omnisharp-navigate-to-current-file-member
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Help, documentation, info
|
2015-11-18 00:38:05 +00:00
|
|
|
"ht" 'omnisharp-current-type-information
|
|
|
|
"hT" 'omnisharp-current-type-information-to-kill-ring
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Refactoring
|
2015-11-18 00:38:05 +00:00
|
|
|
"rm" 'omnisharp-rename
|
2015-09-25 11:04:27 +00:00
|
|
|
"rM" 'omnisharp-rename-interactively
|
2015-11-18 00:38:05 +00:00
|
|
|
"rr" 'omnisharp-run-code-action-refactoring
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Server manipulation, inspired spacemacs REPL bindings since C# does not provice a REPL
|
2015-11-18 00:38:05 +00:00
|
|
|
"ss" 'omnisharp-start-omnisharp-server
|
|
|
|
"sS" 'omnisharp-stop-server
|
|
|
|
"sr" 'omnisharp-reload-solution
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Tests
|
2015-11-18 00:38:05 +00:00
|
|
|
"ta" 'omnisharp-unit-test-all
|
|
|
|
"tb" 'omnisharp-unit-test-fixture
|
|
|
|
"tt" 'omnisharp-unit-test-single
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Code manipulation
|
2015-11-18 00:38:05 +00:00
|
|
|
"u" 'omnisharp-auto-complete-overrides
|
|
|
|
"i" 'omnisharp-fix-usings
|
|
|
|
"=" 'omnisharp-code-format))))
|
2015-04-03 21:12:56 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun csharp/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook csharp-mode))
|
2016-06-04 02:15:25 +00:00
|
|
|
|
2016-08-13 13:43:37 +00:00
|
|
|
(defun csharp/init-csharp-mode ()
|
|
|
|
(use-package csharp-mode
|
2016-09-05 02:29:41 +00:00
|
|
|
:defer t))
|
2016-08-13 13:43:37 +00:00
|
|
|
|
2016-06-04 02:15:25 +00:00
|
|
|
(defun csharp/post-init-evil-matchit ()
|
|
|
|
(with-eval-after-load 'evil-matchit
|
|
|
|
(plist-put evilmi-plugins 'csharp-mode '((evilmi-simple-get-tag evilmi-simple-jump)
|
|
|
|
(evilmi-c-get-tag evilmi-c-jump))))
|
|
|
|
(add-hook 'csharp-mode-hook 'turn-on-evil-matchit-mode))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
|
|
|
(defun csharp/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'csharp-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
|
|
|
(defun csharp/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'csharp-mode))
|