mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-10 21:42:31 +08:00
add rego support (#4199)
* add opa fmt fixer for rego files * add opa linter * add basic tests for linter and fixer * add cspell to the docs
This commit is contained in:
committed by
GitHub
parent
5479b58660
commit
75d2413425
@@ -526,6 +526,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['pascal'],
|
||||
\ 'description': 'Fix Pascal files with ptop.',
|
||||
\ },
|
||||
\ 'opafmt': {
|
||||
\ 'function': 'ale#fixers#opafmt#Fix',
|
||||
\ 'suggested_filetypes': ['rego'],
|
||||
\ 'description': 'Fix rego files with opa fmt.',
|
||||
\ },
|
||||
\ 'vfmt': {
|
||||
\ 'function': 'ale#fixers#vfmt#Fix',
|
||||
\ 'suggested_filetypes': ['v'],
|
||||
|
||||
15
autoload/ale/fixers/opafmt.vim
Normal file
15
autoload/ale/fixers/opafmt.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" Description: Fixer for rego files
|
||||
|
||||
call ale#Set('opa_fmt_executable', 'opa')
|
||||
call ale#Set('opa_fmt_options', '')
|
||||
|
||||
function! ale#fixers#opafmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'opa_fmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'opa_fmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' fmt'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user