lang/csharp: minor refactor

Ensure csharp-mode specific config can work without omnisharp.
This commit is contained in:
Henrik Lissner 2019-02-18 17:40:57 -05:00
parent cee851f55b
commit e01781a3d9
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -1,5 +1,17 @@
;;; lang/csharp/config.el -*- lexical-binding: t; -*-
(after! csharp-mode
(add-hook 'csharp-mode-hook #'rainbow-delimiters-mode)
(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"))))
(def-package! omnisharp
:hook (csharp-mode . omnisharp-mode)
:commands omnisharp-install-server
@ -14,20 +26,12 @@
(add-hook! csharp-mode
(add-hook 'kill-buffer-hook #'omnisharp-stop-server nil t))
(set-electric! 'csharp-mode :chars '(?\n ?\}))
(set-company-backend! 'csharp-mode 'company-omnisharp)
(set-rotate-patterns! 'csharp-mode
:symbols '(("public" "protected" "private")
("class" "struct")))
(set-lookup-handlers! 'csharp-mode
:definition #'omnisharp-go-to-definition
:references #'omnisharp-find-usages
:documentation #'omnisharp-current-type-documentation)
(sp-local-pair 'csharp-mode "<" ">"
:when '(+csharp-sp-point-in-type-p)
:post-handlers '(("| " "SPC")))
(map! :localleader
:map omnisharp-mode-map
"b" #'omnisharp-recompile