Add support for V: "v" (compiler) and "vfmt" fixer. (#3622)

* v: add "v fmt" fixer.

* v: add "v" (build) linter.

* v: fix vlint complaints and add documentation.

* v: add tests.

* v: use ale#Pad().
This commit is contained in:
fiatjaf
2021-03-26 03:38:57 -03:00
committed by GitHub
parent b1f95dc4fb
commit 655f0070cd
12 changed files with 279 additions and 0 deletions

View File

@@ -440,6 +440,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#ptop#Fix',
\ 'suggested_filetypes': ['pascal'],
\ 'description': 'Fix Pascal files with ptop.',
\ },
\ 'vfmt': {
\ 'function': 'ale#fixers#vfmt#Fix',
\ 'suggested_filetypes': ['v'],
\ 'description': 'A formatter for V source code.',
\ }
\}

View File

@@ -0,0 +1,13 @@
" Author: fiatjaf <fiatjaf@alhur.es>
" Description: Integration of `v fmt` with ALE.
call ale#Set('v_vfmt_options', '')
function! ale#fixers#vfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'v_v_executable')
let l:options = ale#Var(a:buffer, 'v_vfmt_options')
return {
\ 'command': ale#Escape(l:executable) . ' fmt' . ale#Pad(l:options)
\}
endfunction

View File

@@ -53,6 +53,7 @@ let s:default_ale_linters = {
\ 'text': [],
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\}
" Testing/debugging helper to unload all linters.