2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
|
2015-06-15 09:06:10 +02:00
|
|
|
|
2019-02-18 17:40:57 -05:00
|
|
|
(after! csharp-mode
|
|
|
|
(add-hook 'csharp-mode-hook #'rainbow-delimiters-mode)
|
|
|
|
|
2019-09-26 13:50:36 -04:00
|
|
|
(when (featurep! +lsp)
|
|
|
|
(add-hook 'csharp-mode-local-vars-hook #'lsp!))
|
|
|
|
|
2019-02-18 17:40:57 -05:00
|
|
|
(set-electric! 'csharp-mode :chars '(?\n ?\}))
|
|
|
|
(set-rotate-patterns! 'csharp-mode
|
|
|
|
:symbols '(("public" "protected" "private")
|
|
|
|
("class" "struct")))
|
|
|
|
(sp-local-pair 'csharp-mode "<" ">"
|
|
|
|
:when '(+csharp-sp-point-in-type-p)
|
|
|
|
:post-handlers '(("| " "SPC"))))
|
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! omnisharp
|
2019-09-26 13:50:36 -04:00
|
|
|
:unless (featurep! +lsp)
|
2018-05-25 00:46:11 +02:00
|
|
|
:hook (csharp-mode . omnisharp-mode)
|
|
|
|
:commands omnisharp-install-server
|
2016-03-29 23:13:31 -04:00
|
|
|
:preface
|
|
|
|
(setq omnisharp-auto-complete-want-documentation nil
|
2018-02-04 04:49:05 -05:00
|
|
|
omnisharp-cache-directory (concat doom-cache-dir "omnisharp"))
|
2015-10-08 01:48:47 -04:00
|
|
|
:config
|
2019-07-26 19:57:13 +02:00
|
|
|
(defun +csharp-cleanup-omnisharp-server-h ()
|
2018-02-04 05:32:43 -05:00
|
|
|
"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)))
|
2019-07-26 19:57:13 +02:00
|
|
|
(add-hook! 'csharp-mode-hook
|
|
|
|
(add-hook 'kill-buffer-hook #'+csharp-cleanup-omnisharp-server-h nil t))
|
2018-02-04 05:32:43 -05:00
|
|
|
|
2018-09-07 22:08:11 -04:00
|
|
|
(set-company-backend! 'csharp-mode 'company-omnisharp)
|
2018-06-15 17:27:48 +02:00
|
|
|
(set-lookup-handlers! 'csharp-mode
|
2018-01-19 04:17:19 -05:00
|
|
|
:definition #'omnisharp-go-to-definition
|
|
|
|
:references #'omnisharp-find-usages
|
|
|
|
:documentation #'omnisharp-current-type-documentation)
|
|
|
|
|
2018-12-23 23:54:27 -05:00
|
|
|
(map! :localleader
|
|
|
|
:map omnisharp-mode-map
|
|
|
|
"b" #'omnisharp-recompile
|
2018-01-19 04:17:19 -05:00
|
|
|
(:prefix "r"
|
2018-12-23 23:54:27 -05:00
|
|
|
"u" #'omnisharp-fix-usings
|
|
|
|
"r" #'omnisharp-rename
|
|
|
|
"a" #'omnisharp-show-last-auto-complete-result
|
|
|
|
"o" #'omnisharp-show-overloads-at-point)
|
2019-10-04 17:49:28 -04:00
|
|
|
(:prefix "g"
|
2018-12-23 23:54:27 -05:00
|
|
|
"u" #'omnisharp-find-usages
|
|
|
|
"i" #'omnisharp-find-implementations
|
|
|
|
"f" #'omnisharp-navigate-to-current-file-member
|
|
|
|
"m" #'omnisharp-navigate-to-solution-member
|
|
|
|
"M" #'omnisharp-navigate-to-solution-file-then-file-member
|
|
|
|
"F" #'omnisharp-navigate-to-solution-file
|
|
|
|
"r" #'omnisharp-navigate-to-region
|
|
|
|
"ti" #'omnisharp-current-type-information
|
|
|
|
"td" #'omnisharp-current-type-documentation)
|
2018-01-19 04:17:19 -05:00
|
|
|
(:prefix "t"
|
2019-08-23 21:50:37 +01:00
|
|
|
"s" #'omnisharp-unit-test-at-point
|
|
|
|
"l" #'omnisharp-unit-test-last
|
|
|
|
"b" #'omnisharp-unit-test-buffer)))
|
2018-12-29 00:09:17 -05:00
|
|
|
|
|
|
|
|
2019-09-13 21:59:03 -04:00
|
|
|
;;;###package shader-mode
|
2018-12-29 00:09:17 -05:00
|
|
|
(when (featurep! +unity)
|
2019-09-13 21:59:03 -04:00
|
|
|
;; Unity shaders
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.shader\\'" . shader-mode))
|
2018-12-29 00:09:17 -05:00
|
|
|
|
|
|
|
(def-project-mode! +csharp-unity-mode
|
2019-07-21 14:49:09 +02:00
|
|
|
:modes '(csharp-mode shader-mode)
|
2018-12-29 00:09:17 -05:00
|
|
|
:files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper")))
|