mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-30 14:45:29 +08:00
Add fixer for "dotnet format" (#3879)
The .NET ecosystem has an official tool for formatting its files: `dotnet format` This adds support for that tool to ALE.
This commit is contained in:
@@ -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'],
|
||||
|
||||
18
autoload/ale/fixers/dotnet_format.vim
Normal file
18
autoload/ale/fixers/dotnet_format.vim
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user