doomemacs/modules/lang/csharp/config.el
Henrik Lissner 09cb4f6716
Major refactor & optimization of how modules load their packages
Now that we are loading package autoloads files (as part of the
generated doom-package-autoload-file when running make autoloads), many
:commands properties are redundant. In fact, many def-package! blocks
are redundant.

In some cases, we can do without a config.el file entirely, and can move
into the autoloads file or rely entirely on package autoloads.

Also, many settings have been moved in their module's autoloads files,
which makes them available ASAP; their use no longer depends on module
load order.

This gained me a modest ~10% boost in startup speed.
2018-05-25 00:46:16 +02:00

54 lines
2 KiB
EmacsLisp

;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-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")))))