doomemacs/modules/lang/csharp/config.el
Henrik Lissner d8b1e469bc
Introduce autodefs to replace some settings
+ :popup -> set-popup-rule!
+ :popups -> set-popup-rules!
+ :company-backend -> set-company-backend!
+ :evil-state -> set-evil-initial-state!

I am slowly phasing out the setting system (def-setting! and set!),
starting with these.

What are autodefs? These are functions that are always defined, whether
or not their respective modules are enabled. However, when their modules
are disabled, they are replaced with macros that no-op and don't
waste time evaluating their arguments.

The old set! function will still work, for a while.
2018-06-15 03:42:01 +02:00

54 lines
2 KiB
EmacsLisp

;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(map-put auto-mode-alist '"\\.shader$" 'dshader-mode) ; unity shaders
(def-package! omnisharp
:hook (csharp-mode . omnisharp-mode)
:commands omnisharp-install-server
:preface
(setq omnisharp-auto-complete-want-documentation nil
omnisharp-cache-directory (concat doom-cache-dir "omnisharp"))
:config
(add-hook 'csharp-mode-hook #'flycheck-mode)
(defun +csharp|cleanup-omnisharp-server ()
"Clean up the omnisharp server once you kill the last csharp-mode buffer."
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
(omnisharp-stop-server)))
(add-hook! csharp-mode (add-hook 'kill-buffer-hook #'omnisharp-stop-server nil t))
(set-company-backend! 'csharp-mode '(company-omnisharp))
(set! :lookup 'csharp-mode
:definition #'omnisharp-go-to-definition
:references #'omnisharp-find-usages
:documentation #'omnisharp-current-type-documentation)
(map! :map omnisharp-mode-map
:localleader
:n "b" #'omnisharp-recompile
(:prefix "r"
:n "i" #'omnisharp-fix-code-issue-at-point
:n "u" #'omnisharp-fix-usings
:n "r" #'omnisharp-rename
:n "a" #'omnisharp-show-last-auto-complete-result
:n "o" #'omnisharp-show-overloads-at-point)
(:prefix "f"
:n "u" #'omnisharp-find-usages
:n "i" #'omnisharp-find-implementations
:n "f" #'omnisharp-navigate-to-current-file-member
:n "m" #'omnisharp-navigate-to-solution-member
:n "M" #'omnisharp-navigate-to-solution-file-then-file-member
:n "F" #'omnisharp-navigate-to-solution-file
:n "r" #'omnisharp-navigate-to-region
:n "ti" #'omnisharp-current-type-information
:n "td" #'omnisharp-current-type-documentation)
(:prefix "t"
:n "r" (λ! (omnisharp-unit-test "fixture"))
:n "s" (λ! (omnisharp-unit-test "single"))
:n "a" (λ! (omnisharp-unit-test "all")))))