mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-03 08:32:50 +08:00
add: support for nickel format as Nickel fixer (#4665)
Nickel(https://nickel-lang.org/) is a configuration language, like Jsonnet, Cue, Dhall. `nickel`(https://github.com/tweag/nickel) is the main command to run, export and also format Nickel code. this commit adds `nickel format` as a Nickel fixer, together with some tests and documentation.
This commit is contained in:
@@ -635,7 +635,12 @@ let s:default_registry = {
|
||||
\ 'function': 'ale#fixers#erbformatter#Fix',
|
||||
\ 'suggested_filetypes': ['eruby'],
|
||||
\ 'description': 'Apply erb-formatter -w to eruby/erb files.',
|
||||
\ }
|
||||
\ },
|
||||
\ 'nickel_format': {
|
||||
\ 'function': 'ale#fixers#nickel_format#Fix',
|
||||
\ 'suggested_filetypes': ['nickel'],
|
||||
\ 'description': 'Fix nickel files with nickel format',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
16
autoload/ale/fixers/nickel_format.vim
Normal file
16
autoload/ale/fixers/nickel_format.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: Yining <zhang.yining@gmail.com>
|
||||
" Description: nickel format as ALE fixer for Nickel files
|
||||
|
||||
call ale#Set('nickel_nickel_format_executable', 'nickel')
|
||||
call ale#Set('nickel_nickel_format_options', '')
|
||||
|
||||
function! ale#fixers#nickel_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'nickel_nickel_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'nickel_nickel_format_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' format'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user