ねっる
autocmd User lsp_setup
\ if executable('efm-langserver')
\ | call lsp#register_server({
\ 'name': 'textlint',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'efm-langserver -c '..fnameescape(s:EfmLangServCfg_textlint())]},
\ 'allowlist': ['markdown', 'asciidoc']
\ })
\ | endif
function! s:EfmLangServCfg_textlint()
let l:temp = tempname()
let l:conf = {
\ 'version': 2,
\ 'languages': {
\ 'markdown': [],
\ 'asciidoc': []
\ }
\ }
let l:tool = {
\ 'lint-command': './node_modules/.bin/textlint -f unix --stdin --stdin-filename ${INPUT}',
\ 'lint-stdin': v:true,
\ 'lint-ignore-exit-code': v:true,
\ 'root-markers': ['.textlintrc'],
\ 'lint-formats': ['%f:%l:%c: %m [%trror/%r]']
\ }
call add(l:conf.languages.markdown, l:tool)
call add(l:conf.languages.asciidoc, l:tool)
call writefile([json_encode(l:conf)], l:temp)
return l:temp
endfunction