【发布时间】:2020-09-25 06:05:02
【问题描述】:
我正在尝试为 Spectral OpenAPI linter (https://github.com/stoplightio/spectral) 定义错误格式。我的代码如下,但我看到的是,在我运行:make 之后,quickfix 窗口会填充来自 Spectral 的行,但我无法使用它导航到错误点。 Vim 中没有错误,快速修复窗口没有多大作用。
来自 Spectral 的消息如下所示:
/path/to/sample.yaml:25:9 error oas3-schema "Property `think` is not expected to be here."
我当前的 Vimscript 如下所示:
function! OpenAPIDetect()
if getline(1) =~ 'openapi:'
let &l:makeprg='spectral lint "' . expand('%') . '" -f text'
setlocal errorformat=%f:%l:%c\ (information\\|warning\\|error)\ (\\w\\|-)\+\ %m
setlocal errorformat+=%-GOpenAPI\ 3.x\ detected
endif
endfunction
augroup filetypedetect
au BufRead,BufNewFile *.{yml,yaml} call OpenAPIDetect()
augroup END
【问题讨论】:
标签: vim swagger openapi spectral