mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-04 09:02:52 +08:00
Add fixer for OCaml ocp-indent (#2436)
This commit is contained in:
@@ -220,6 +220,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
\ 'description': 'Fix OCaml files with ocamlformat.',
|
||||
\ },
|
||||
\ 'ocp-indent': {
|
||||
\ 'function': 'ale#fixers#ocp_indent#Fix',
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
\ 'description': 'Fix OCaml files with ocp-indent.',
|
||||
\ },
|
||||
\ 'refmt': {
|
||||
\ 'function': 'ale#fixers#refmt#Fix',
|
||||
\ 'suggested_filetypes': ['reason'],
|
||||
|
||||
18
autoload/ale/fixers/ocp_indent.vim
Normal file
18
autoload/ale/fixers/ocp_indent.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Kanenobu Mitsuru
|
||||
" Description: Integration of ocp-indent with ALE.
|
||||
|
||||
call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent')
|
||||
call ale#Set('ocaml_ocp_indent_options', '')
|
||||
call ale#Set('ocaml_ocp_indent_config', '')
|
||||
|
||||
function! ale#fixers#ocp_indent#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable')
|
||||
let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config')
|
||||
let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config))
|
||||
\ . (empty(l:options) ? '': ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
Reference in New Issue
Block a user