summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/dotnet_format.vim18
2 files changed, 23 insertions, 0 deletions
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 15a6632d..975d02f6 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -396,6 +396,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['dart'],
\ 'description': 'Fix Dart files with dart format.',
\ },
+\ 'dotnet-format': {
+\ 'function': 'ale#fixers#dotnet_format#Fix',
+\ 'suggested_filetypes': ['cs'],
+\ 'description': 'Fix C# files with dotnet format.',
+\ },
\ 'xmllint': {
\ 'function': 'ale#fixers#xmllint#Fix',
\ 'suggested_filetypes': ['xml'],
diff --git a/autoload/ale/fixers/dotnet_format.vim b/autoload/ale/fixers/dotnet_format.vim
new file mode 100644
index 00000000..b44a28bd
--- /dev/null
+++ b/autoload/ale/fixers/dotnet_format.vim
@@ -0,0 +1,18 @@
+" Author: ghsang <gwonhyuksang@gmail.com>
+" Description: Integration of dotnet format with ALE.
+
+call ale#Set('cs_dotnet_format_executable', 'dotnet')
+call ale#Set('cs_dotnet_format_options', '')
+
+function! ale#fixers#dotnet_format#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable')
+ let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . ' format'
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' --folder --include %t "$(dirname %t)"',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction