2015-01-28 20:12:25 +00:00
|
|
|
;;; packages.el --- csharp Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 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
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
|
|
|
company
|
|
|
|
csharp-mode
|
|
|
|
evil-matchit
|
|
|
|
ggtags
|
|
|
|
counsel-gtags
|
|
|
|
helm-gtags
|
|
|
|
omnisharp
|
|
|
|
flycheck
|
|
|
|
))
|
2015-01-28 20:12:25 +00:00
|
|
|
|
|
|
|
(defun csharp/init-omnisharp ()
|
2017-01-02 05:39:04 +00:00
|
|
|
;; Load omnisharp-mode with csharp-mode,
|
|
|
|
;; this should start the omnisharp server automatically
|
2015-01-28 20:12:25 +00:00
|
|
|
(add-hook 'csharp-mode-hook 'omnisharp-mode)
|
|
|
|
(use-package omnisharp
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-08-12 19:17:59 +00:00
|
|
|
:init
|
2017-08-20 16:53:07 +00:00
|
|
|
(add-to-list 'spacemacs-jump-handlers-csharp-mode
|
|
|
|
'(omnisharp-go-to-definition :async t))
|
2015-08-18 19:49:22 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2017-08-20 17:14:09 +00:00
|
|
|
;; [missing in roslyn] (spacemacs/declare-prefix-for-mode 'csharp-mode "mc" "csharp/compile")
|
|
|
|
;; [missing in roslyn] (spacemacs/declare-prefix-for-mode 'csharp-mode "mf" "csharp/file")
|
2015-08-31 20:16:58 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mg" "csharp/navigation")
|
2017-08-20 17:14:09 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mh" "csharp/documentation")
|
2015-08-31 20:16:58 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mr" "csharp/refactoring")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "ms" "csharp/server")
|
2019-04-26 23:42:21 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'csharp-mode "mt" "csharp/tests")
|
2017-08-20 17:14:09 +00:00
|
|
|
|
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
|
2017-01-02 05:39:04 +00:00
|
|
|
;; Only one compile command so use top-level
|
2017-08-20 17:14:09 +00:00
|
|
|
;; [missing in roslyn] "cc" 'omnisharp-build-in-emacs
|
|
|
|
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Solution/project manipulation
|
2017-08-20 17:14:09 +00:00
|
|
|
;; [missing in roslyn] "fa" 'omnisharp-add-to-solution-current-file
|
|
|
|
;; [missing in roslyn] "fA" 'omnisharp-add-to-solution-dired-selected-files
|
|
|
|
;; [missing in roslyn] "fr" 'omnisharp-remove-from-project-current-file
|
|
|
|
;; [missing in roslyn] "fR" 'omnisharp-remove-from-project-dired-selected-files
|
|
|
|
|
|
|
|
;; [missing in roslyn] "pl" 'omnisharp-add-reference
|
|
|
|
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Navigation
|
2018-01-10 04:26:08 +00:00
|
|
|
"ge" 'omnisharp-solution-errors
|
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
|
2017-08-20 17:14:09 +00:00
|
|
|
|
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
|
2017-08-20 17:14:09 +00:00
|
|
|
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Refactoring
|
2015-11-18 00:38:05 +00:00
|
|
|
"rm" 'omnisharp-rename
|
2018-10-21 07:59:47 +00:00
|
|
|
;; [Broken in roslyn] "rM" 'omnisharp-rename-interactively
|
2015-11-18 00:38:05 +00:00
|
|
|
"rr" 'omnisharp-run-code-action-refactoring
|
2017-08-20 17:14:09 +00:00
|
|
|
|
2017-01-02 05:39:04 +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
|
2017-08-20 17:14:09 +00:00
|
|
|
"si" 'omnisharp-install-server
|
|
|
|
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Tests
|
2017-08-20 17:14:09 +00:00
|
|
|
;; [missing in roslyn] "ta" 'omnisharp-unit-test-all
|
2018-10-21 07:59:47 +00:00
|
|
|
"tb" 'omnisharp-unit-test-buffer
|
2018-12-06 00:22:23 +00:00
|
|
|
"tp" 'omnisharp-unit-test-at-point
|
|
|
|
"tt" 'omnisharp-unit-test-last
|
2017-08-20 17:14:09 +00:00
|
|
|
|
2015-08-18 19:49:22 +00:00
|
|
|
;; Code manipulation
|
2018-10-21 07:59:47 +00:00
|
|
|
"u" 'omnisharp-auto-complete-overrides
|
|
|
|
"i" 'omnisharp-fix-usings
|
2017-08-20 17:14:09 +00:00
|
|
|
;; [missing in roslyn] "=" 'omnisharp-code-format
|
2019-04-27 00:07:37 +00:00
|
|
|
)
|
|
|
|
(spacemacs|hide-lighter omnisharp-mode))))
|
2015-04-03 21:12:56 +00:00
|
|
|
|
2016-05-30 02:39:21 +00:00
|
|
|
(defun csharp/post-init-company ()
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/package-used-p 'omnisharp)
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends company-omnisharp
|
|
|
|
:modes 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
|
2018-03-04 04:37:53 +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
|
2017-01-02 05:39:04 +00:00
|
|
|
(plist-put evilmi-plugins 'csharp-mode
|
|
|
|
'((evilmi-simple-get-tag evilmi-simple-jump)
|
|
|
|
(evilmi-c-get-tag evilmi-c-jump))))
|
2016-06-04 02:15:25 +00:00
|
|
|
(add-hook 'csharp-mode-hook 'turn-on-evil-matchit-mode))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2017-04-10 03:03:07 +00:00
|
|
|
(defun csharp/post-init-flycheck ()
|
|
|
|
(spacemacs/enable-flycheck 'csharp-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
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun csharp/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'csharp-mode))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun csharp/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'csharp-mode))
|