mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
34
sources_non_forked/ale/ale_linters/cpp/cquery.vim
Normal file
34
sources_non_forked/ale/ale_linters/cpp/cquery.vim
Normal file
@ -0,0 +1,34 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C++
|
||||
|
||||
call ale#Set('cpp_cquery_executable', 'cquery')
|
||||
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#cpp#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#cpp#cquery#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cquery_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#cpp#cquery#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cquery#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#cpp#cquery#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#cpp#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#cpp#cquery#GetInitializationOptions',
|
||||
\ 'language': 'cpp',
|
||||
\})
|
@ -4,6 +4,7 @@
|
||||
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('cpp_flawfinder_options', '')
|
||||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_flawfinder_executable')
|
||||
|
@ -21,7 +21,8 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'g++',
|
||||
\ 'name': 'gcc',
|
||||
\ 'aliases': ['g++'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
|
||||
\ 'command_chain': [
|
||||
|
Reference in New Issue
Block a user