mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-16 23:14:27 +08:00
Add zig fmt support (#4198)
* Add zig fmt support * Review changes * Fix linter errors
This commit is contained in:
@@ -540,6 +540,11 @@ let s:default_registry = {
|
||||
\ 'function': 'ale#fixers#vfmt#Fix',
|
||||
\ 'suggested_filetypes': ['v'],
|
||||
\ 'description': 'A formatter for V source code.',
|
||||
\ },
|
||||
\ 'zigfmt': {
|
||||
\ 'function': 'ale#fixers#zigfmt#Fix',
|
||||
\ 'suggested_filetypes': ['zig'],
|
||||
\ 'description': 'Official formatter for Zig',
|
||||
\ }
|
||||
\}
|
||||
|
||||
|
||||
14
autoload/ale/fixers/zigfmt.vim
Normal file
14
autoload/ale/fixers/zigfmt.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
scriptencoding utf-8
|
||||
" Author: Arash Mousavi <arash-m>
|
||||
" Description: Official formatter for Zig.
|
||||
|
||||
call ale#Set('zig_zigfmt_executable', 'zig')
|
||||
|
||||
function! ale#fixers#zigfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'zig_zigfmt_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' fmt %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user