mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -14,10 +14,10 @@ function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
||||
\ . ' -S -x c -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
@ -28,5 +28,5 @@ call ale#linter#Define('c', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#clang#GetCommand'}
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
29
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
29
sources_non_forked/ale/ale_linters/c/clangd.vim
Normal file
@ -0,0 +1,29 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('c_clangd_executable', 'clangd')
|
||||
call ale#Set('c_clangd_options', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangd_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#clangd#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangd_options')
|
||||
|
||||
return ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#clangd#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#clangd#GetProjectRoot',
|
||||
\})
|
@ -35,7 +35,7 @@ function! s:GetBuildDirectory(buffer) abort
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
|
32
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
32
sources_non_forked/ale/ale_linters/c/cquery.vim
Normal file
@ -0,0 +1,32 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_cquery_executable', 'cquery')
|
||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#c#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#c#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#cquery#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#c#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#c#cquery#GetInitializationOptions',
|
||||
\})
|
@ -14,10 +14,10 @@ function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . l:cflags
|
||||
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
||||
\ . ' -S -x c -fsyntax-only'
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
@ -28,5 +28,5 @@ call ale#linter#Define('c', {
|
||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
|
Reference in New Issue
Block a user