mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-17 16:45:11 +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:
27
test/fixers/test_nickel_format_fixer_callback.vader
Normal file
27
test/fixers/test_nickel_format_fixer_callback.vader
Normal file
@@ -0,0 +1,27 @@
|
||||
Before:
|
||||
Save g:ale_nickel_nickel_format_executable
|
||||
Save g:ale_nickel_nickel_format_options
|
||||
Save &l:expandtab
|
||||
Save &l:shiftwidth
|
||||
Save &l:tabstop
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
Execute(The nickel_format callback should return 'nickel format' as default command):
|
||||
setlocal noexpandtab
|
||||
Assert
|
||||
\ ale#fixers#nickel_format#Fix(bufnr('')).command =~# '^' . ale#Escape('nickel') . ' format',
|
||||
\ "Default command name is expected to be 'nickel format'"
|
||||
|
||||
Execute(The nickel executable and options should be configurable):
|
||||
let g:ale_nickel_nickel_format_executable = 'foobar'
|
||||
let g:ale_nickel_nickel_format_options = '--some-option'
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('foobar')
|
||||
\ . ' format'
|
||||
\ . ' --some-option',
|
||||
\ },
|
||||
\ ale#fixers#nickel_format#Fix(bufnr(''))
|
||||
Reference in New Issue
Block a user