-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Let's say we have a note.h
header file with massive comment like below:
/*# --------------- #*/
/*# date:... #*/
/*# ... #*/
/*# (x30000) #*/
Navigating inside this kind of files is extremely slow on my computer, it takes about 9 sec for each time trying to get_context(). Here is the profile log with profile func *
command.
FUNCTION context#popup#update_context()
Defined: ~\AppData\Local\nvim-data\lazy\context.vim\autoload\context\popup.vim:1
Called 19 times
Total time: 9.457598
Self time: 0.000512
count total (s) self (s)
19 9.456698 0.000127 let [lines, base_line] = context#popup#get_context()
19 0.000110 0.000082 call context#util#echof('> context#popup#update_context', len(lines))
" NOTE: we remember context lines and baseline indent per window so we can
" redraw them in #layout when the window layout changes
19 0.000044 let w:context.lines = lines
19 0.000116 0.000075 let [w:context.level, w:context.indent] = g:context.Border_indent(base_line)
19 0.000121 0.000074 call s:show_cursor()
19 0.000449 0.000050 call s:show()
But, since they are just comments, no actually "context" there can be found, so I think in some case we can just abort with some abort mechanism.
I knows there are settings like g:context_filetype_blacklist
and g:context_buftype_blacklist
, but in this case, the filetype is cpp
and buftype is empty, so I can not use these settings to avoid this issue.
Finally, I have tried added the following lines inside context#popup#get_context()
, and it kinds of work, but maybe there is better way doing this, or let user decide the aborting threshold.
let text = getline(line_number) " empty for invalid lines
if context#line#should_skip(text)
let skipped += 1
" call context#util#echof('skip', line_number)
+ if skipped > 1000
+ return [[], 0]
+ endif
continue
endif
I really like this plugin and hope this issue can be fixed.
Thanks :)