mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 14:56:08 +00:00
vim-patch:9.1.1625: Autocompletion slow with include- and tag-completion (#35318)
Problem: Autocompletion slow with include- and tag-completion
Solution: Refactor ins_compl_interrupted() to also check for timeout,
further refactor code to skip outputting message when
performing autocompletion (Girish Palya).
Running `vim *` in `vim/src` was slower than expected when
'autocomplete' was enabled. Include-file and tag-file completion
sources were not subject to the timeout check, causing unnecessary
delays.
So apply the timeout check to these sources as well, improving
autocompletion responsiveness, refactor find_pattern_in_path() to take
an additional "silent" argument, to suppress any messages.
closes: vim/vim#17966
59e1d7f353
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
@@ -3852,9 +3852,10 @@ static char *get_line_and_copy(linenr_T lnum, char *buf)
|
||||
/// @param start_lnum first line to start searching
|
||||
/// @param end_lnum last line for searching
|
||||
/// @param forceit If true, always switch to the found path
|
||||
/// @param silent Do not print messages when ACTION_EXPAND
|
||||
void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool skip_comments,
|
||||
int type, int count, int action, linenr_T start_lnum, linenr_T end_lnum,
|
||||
int forceit)
|
||||
bool forceit, bool silent)
|
||||
{
|
||||
SearchedFile *files; // Stack of included files
|
||||
SearchedFile *bigger; // When we need more space
|
||||
@@ -4082,7 +4083,7 @@ void find_pattern_in_path(char *ptr, Direction dir, size_t len, bool whole, bool
|
||||
files[depth].name = curr_fname = new_fname;
|
||||
files[depth].lnum = 0;
|
||||
files[depth].matched = false;
|
||||
if (action == ACTION_EXPAND) {
|
||||
if (action == ACTION_EXPAND && !shortmess(SHM_COMPLETIONSCAN) && !silent) {
|
||||
msg_hist_off = true; // reset in msg_trunc()
|
||||
vim_snprintf(IObuff, IOSIZE,
|
||||
_("Scanning included file: %s"),
|
||||
@@ -4411,8 +4412,7 @@ exit_matched:
|
||||
msg(_("No included files"), 0);
|
||||
}
|
||||
}
|
||||
} else if (!found
|
||||
&& action != ACTION_EXPAND) {
|
||||
} else if (!found && action != ACTION_EXPAND && !silent) {
|
||||
if (got_int || ins_compl_interrupted()) {
|
||||
emsg(_(e_interr));
|
||||
} else if (type == FIND_DEFINE) {
|
||||
|
Reference in New Issue
Block a user