mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 14:43:35 +08:00 
			
		
		
		
	Updated plugins
This commit is contained in:
		| @ -12,7 +12,8 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort | ||||
|     let l:build_dir = ale#Var(a:buffer, 'c_build_dir') | ||||
|  | ||||
|     if empty(l:build_dir) | ||||
|         let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) | ||||
|         let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) | ||||
|         let l:build_dir = ale#path#Dirname(l:json_file) | ||||
|     endif | ||||
|  | ||||
|     " The extra arguments in the command are used to prevent .plist files from | ||||
|  | ||||
| @ -4,12 +4,6 @@ | ||||
| call ale#Set('cpp_clangd_executable', 'clangd') | ||||
| call ale#Set('cpp_clangd_options', '') | ||||
|  | ||||
| function! ale_linters#cpp#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#cpp#clangd#GetCommand(buffer) abort | ||||
|     return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) | ||||
| endfunction | ||||
| @ -19,5 +13,5 @@ call ale#linter#Define('cpp', { | ||||
| \   'lsp': 'stdio', | ||||
| \   'executable': {b -> ale#Var(b, 'cpp_clangd_executable')}, | ||||
| \   'command': function('ale_linters#cpp#clangd#GetCommand'), | ||||
| \   'project_root': function('ale_linters#cpp#clangd#GetProjectRoot'), | ||||
| \   'project_root': function('ale#c#FindProjectRoot'), | ||||
| \}) | ||||
|  | ||||
| @ -5,9 +5,12 @@ | ||||
| call ale#Set('cpp_clangtidy_executable', 'clang-tidy') | ||||
| " Set this option to check the checks clang-tidy will apply. | ||||
| call ale#Set('cpp_clangtidy_checks', []) | ||||
| " Set this option to manually set some options for clang-tidy. | ||||
| " Set this option to manually set some options for clang-tidy to use as compile | ||||
| " flags. | ||||
| " This will disable compile_commands.json detection. | ||||
| call ale#Set('cpp_clangtidy_options', '') | ||||
| " Set this option to manually set options for clang-tidy directly. | ||||
| call ale#Set('cpp_clangtidy_extra_options', '') | ||||
| call ale#Set('c_build_dir', '') | ||||
|  | ||||
| function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort | ||||
| @ -19,8 +22,12 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort | ||||
|     \   ? ale#Var(a:buffer, 'cpp_clangtidy_options') | ||||
|     \   : '' | ||||
|  | ||||
|     " Get the options to pass directly to clang-tidy | ||||
|     let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options') | ||||
|  | ||||
|     return '%e' | ||||
|     \   . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') | ||||
|     \   . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') | ||||
|     \   . ' %s' | ||||
|     \   . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') | ||||
|     \   . (!empty(l:options) ? ' -- ' . l:options : '') | ||||
|  | ||||
| @ -5,23 +5,17 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck') | ||||
| call ale#Set('cpp_cppcheck_options', '--enable=style') | ||||
|  | ||||
| function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort | ||||
|     " Search upwards from the file for compile_commands.json. | ||||
|     " | ||||
|     " If we find it, we'll `cd` to where the compile_commands.json file is, | ||||
|     " then use the file to set up import paths, etc. | ||||
|     let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') | ||||
|  | ||||
|     let l:cd_command = !empty(l:compile_commmands_path) | ||||
|     \   ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) | ||||
|     \   : '' | ||||
|     let l:compile_commands_option = !empty(l:compile_commmands_path) | ||||
|     \   ? '--project=compile_commands.json ' | ||||
|     let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer) | ||||
|     let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) | ||||
|     let l:buffer_path_include = empty(l:compile_commands_option) | ||||
|     \   ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) | ||||
|     \   : '' | ||||
|  | ||||
|     return l:cd_command | ||||
|     \   . '%e -q --language=c++ ' | ||||
|     \   . l:compile_commands_option | ||||
|     \   . ale#Var(a:buffer, 'cpp_cppcheck_options') | ||||
|     \   . '%e -q --language=c++' | ||||
|     \   . ale#Pad(l:compile_commands_option) | ||||
|     \   . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) | ||||
|     \   . l:buffer_path_include | ||||
|     \   . ' %t' | ||||
| endfunction | ||||
|  | ||||
|  | ||||
| @ -5,13 +5,15 @@ 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') | ||||
|     " Try to find cquery configuration files first. | ||||
|     let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') | ||||
|  | ||||
|     if empty(l:project_root) | ||||
|         let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery') | ||||
|     if !empty(l:config) | ||||
|         return fnamemodify(l:config, ':h') | ||||
|     endif | ||||
|  | ||||
|     return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' | ||||
|     " Fall back on default project root detection. | ||||
|     return ale#c#FindProjectRoot(a:buffer) | ||||
| endfunction | ||||
|  | ||||
| function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort | ||||
|  | ||||
| @ -9,7 +9,11 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort | ||||
|  | ||||
|     " -iquote with the directory the file is in makes #include work for | ||||
|     "  headers in the same directory. | ||||
|     return '%e -S -x c++ -fsyntax-only' | ||||
|     " | ||||
|     " `-o /dev/null` or `-o null` is needed to catch all errors, | ||||
|     " -fsyntax-only doesn't catch everything. | ||||
|     return '%e -S -x c++' | ||||
|     \   . ' -o ' . g:ale#util#nul_file | ||||
|     \   . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) | ||||
|     \   . ale#Pad(l:cflags) | ||||
|     \   . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -' | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Amir Salihefendic
					Amir Salihefendic