ale
ale copied to clipboard
ALE takes long time for ale#c#FindCompileCommands
Information
VIM version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 13 2023 19:52:41)
Included patches: 1-1403
Operating System:
Windows10 + MSYS2 UCRT64
What went wrong
I have no special settings about ale.
" linter
packadd! vim-ale
let g:ale_virtualtext_cursor = 'disabled'
I'm editing a cpp file without compile_commands.json generated.
Everytime when linters begin to work, the editor hangs about 5s without any response.
After some simple profiling, it's the function! ale#c#FindCompileCommands(buffer) which costs about 4.5s everytime.
I added some debug code into this function, and found out it was called repeatedly at every lint and tried to recusive upwards until the root directory to find the compile_commands.json
Reproducing the bug
- I did this.
- Then this happened.
:ALEInfo
Expand
Current Filetype: cpp
Available Linters: ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'cspell', 'flawfinder']
Linter Aliases:
'cc' -> ['gcc', 'clang', 'g++', 'clang++']
Enabled Linters: ['cc', 'ccls', 'clangcheck', 'clangd', 'clangtidy', 'clazy', 'cppcheck', 'cpplint', 'cquery', 'cspell', 'flawfinder']
Ignored Linters: []
Suggested Fixers:
'astyle' - Fix C/C++ with astyle.
'clang-format' - Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.
'clangtidy' - Fix C/C++ and ObjectiveC files with clang-tidy.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'uncrustify' - Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.
Linter Variables:
let g:ale_cpp_cc_executable = '<auto>'
let g:ale_cpp_cc_header_exts = ['h', 'hpp']
let g:ale_cpp_cc_options = '-std=c++14 -Wall'
let g:ale_cpp_cc_use_header_lang_flag = -1
let g:ale_cpp_ccls_executable = 'ccls'
let g:ale_cpp_ccls_init_options = {}
let g:ale_cpp_clangcheck_executable = 'clang-check'
let g:ale_cpp_clangcheck_options = ''
let g:ale_cpp_clangd_executable = 'clangd'
let g:ale_cpp_clangd_options = ''
let g:ale_cpp_clangtidy_checks = []
let g:ale_cpp_clangtidy_executable = 'clang-tidy'
let g:ale_cpp_clangtidy_extra_options = ''
let g:ale_cpp_clangtidy_options = ''
let g:ale_cpp_clazy_checks = ['level1']
let g:ale_cpp_clazy_executable = 'clazy-standalone'
let g:ale_cpp_clazy_options = ''
let g:ale_cpp_cppcheck_executable = 'cppcheck'
let g:ale_cpp_cppcheck_options = '--enable=style'
let g:ale_cpp_cpplint_executable = 'cpplint'
let g:ale_cpp_cpplint_options = ''
let g:ale_cpp_cquery_cache_directory = '/home/XX/.cache/cquery'
let g:ale_cpp_cquery_executable = 'cquery'
let g:ale_cpp_flawfinder_executable = 'flawfinder'
let g:ale_cpp_flawfinder_minlevel = 1
let g:ale_cpp_flawfinder_options = ''
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'disabled'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) clang++
(finished - exit code 127) ['/usr/bin/bash', '-c', '''clang++'' -S -x c++ -o /dev/null -iquote ''/c/Users/XX/Desktop/test_link'' -I''/c/Users/XX/Desktop/test_link'' -std=c++14 -Wall - < ''/tmp/vjakU0Q/1/testlib.cpp''']
<<<NO OUTPUT RETURNED>>>
(executable check - failure) ccls
(executable check - success) clang-check
(finished - exit code 127) ['/usr/bin/bash', '-c', '''clang-check'' -analyze ''/c/Users/XX/Desktop/test_link/testlib.cpp'' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics']
<<<NO OUTPUT RETURNED>>>
(finished - exit code 127) ['/usr/bin/bash', '-c', '''clang++'' -S -x c++ -o /dev/null -iquote ''/c/Users/XX/Desktop/test_link'' -I''/c/Users/XX/Desktop/test_link'' -std=c++14 -Wall - < ''/tmp/vjakU0Q/2/testlib.cpp''']
<<<NO OUTPUT RETURNED>>>
(executable check - failure) ccls
(finished - exit code 127) ['/usr/bin/bash', '-c', '''clang++'' -S -x c++ -o /dev/null -iquote ''/c/Users/XX/Desktop/test_link'' -I''/c/Users/XX/Desktop/test_link'' -std=c++14 -Wall - < ''/tmp/vjakU0Q/3/testlib.cpp''']
<<<NO OUTPUT RETURNED>>>
(executable check - failure) ccls