feat(format): add :lang csharp formatter
This commit is contained in:
parent
078bf0dd2e
commit
53fe5df6b5
2 changed files with 12 additions and 0 deletions
|
@ -3,6 +3,11 @@
|
|||
(use-package! csharp-mode
|
||||
:hook (csharp-mode . rainbow-delimiters-mode)
|
||||
:config
|
||||
(when (and (file-exists-p (expand-file-name "~/.dotnet/tools/dotnet-csharpier"))
|
||||
(file-exists-p ".config/dotnet-tools.json")
|
||||
(eq 0 (call-process-shell-command
|
||||
(format "grep -q 'dotnet-csharpier' %s" (expand-file-name ".config/dotnet-tools.json")) nil nil)))
|
||||
(set-formatter! 'csharpier '("dotnet" "tool" "run" "dotnet-csharpier") :modes '(csharp-mode)))
|
||||
(set-electric! 'csharp-mode :chars '(?\n ?\}))
|
||||
(set-rotate-patterns! 'csharp-mode
|
||||
:symbols '(("public" "protected" "private")
|
||||
|
|
|
@ -9,3 +9,10 @@
|
|||
(assert! (or (not (modulep! +tree-sitter))
|
||||
(modulep! :tools tree-sitter))
|
||||
"This module requires (:tools tree-sitter)")
|
||||
|
||||
(when (modulep! :editor format)
|
||||
(unless (and (file-exists-p (expand-file-name "~/.dotnet/tools/dotnet-csharpier"))
|
||||
(file-exists-p ".config/dotnet-tools.json")
|
||||
(eq 0 (call-process-shell-command
|
||||
(format "grep -q 'dotnet-csharpier' %s" (expand-file-name ".config/dotnet-tools.json")) nil nil)))
|
||||
(warn! "csharpier is not installed or setup as a local tool. Please see the module README. \nOtherwise, formatting will be disabled.")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue