Open rhysd opened 4 years ago
Should be supported in general, but might be buggy/broken.
Try running it with -l debug
.
OK, let me have a try. Thank you for the advice.
btw: having this (Windows) tested on CI via GitHub actions would be good I think - in case you feel like contributing this.
Since I'm relying on covimerage in several projects, of course I'd like to contribute 😉 You mean adding GitHub Action workflow to run tests for covimerage on CI?
Yes. Currently it is using CircleCI, which could be kept, but we could switch to GitHub actions for testing on Windows.
As for the issue: also try set -x
(or the equivalent for Windows, if that does not work), to see what gets run really, i.e. if covimerage is exiting non-zero there really.
OK, I think I can try to add a new GitHub Actions workflow to this repo.
I'm not familiar with Windows so I also don't know the replacement of set -x
..
I tried --loglevel debug --verbose
and got following single output before covimerage
exited with non-zero status:
Parsing file: profile.txt
https://github.com/rhysd/clever-f.vim/runs/408672158?check_suite_focus=true#step:7:27
It was output here:
I don't know why this line was not output:
I think dumping the profile output would be useful.
FWIW, from release page, it says the latest version is 0.1.6. But on my action workflow, covimerage --version
says 0.2.1. I'm not understanding this mimatch.
FWIW, from release page, it says the latest version is 0.1.6. But on my action workflow,
covimerage --version
says 0.2.1. I'm not understanding this mimatch.
I've pushed missing tags now.
I've pushed missing tags now.
Thanks.
I could retrieve profile output as follows:
https://gist.github.com/rhysd/d550409c4eb22a66cac97cc1a1cb6748
SCRIPT D:\a\clever-f.vim\clever-f.vim\plugin\clever-f.vim
Sourced 1 time
Total time: 0.000260
Self time: 0.000260
count total (s) self (s)
1 0.000007 if exists('g:loaded_clever_f') && g:loaded_clever_f
finish
1 0.000001 endif
1 0.000025 noremap (clever-f-f) clever_f#find_with('f')
1 0.000010 noremap (clever-f-F) clever_f#find_with('F')
1 0.000009 noremap (clever-f-t) clever_f#find_with('t')
1 0.000008 noremap (clever-f-T) clever_f#find_with('T')
1 0.000008 noremap (clever-f-reset) clever_f#reset()
1 0.000010 noremap (clever-f-repeat-forward) clever_f#repeat(0)
1 0.000009 noremap (clever-f-repeat-back) clever_f#repeat(1)
1 0.000004 if ! exists('g:clever_f_not_overwrites_standard_mappings')
1 0.000006 nmap f (clever-f-f)
1 0.000005 xmap f (clever-f-f)
1 0.000005 omap f (clever-f-f)
1 0.000076 nmap F (clever-f-F)
1 0.000005 xmap F (clever-f-F)
1 0.000005 omap F (clever-f-F)
1 0.000005 nmap t (clever-f-t)
1 0.000005 xmap t (clever-f-t)
1 0.000005 omap t (clever-f-t)
1 0.000005 nmap T (clever-f-T)
1 0.000005 xmap T (clever-f-T)
1 0.000005 omap T (clever-f-T)
1 0.000001 endif
1 0.000006 let g:loaded_clever_f = 1
SCRIPT D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim
Sourced 1 time
Total time: 0.000828
Self time: 0.000828
count total (s) self (s)
1 0.000057 let s:save_cpo = &cpo
1 0.000014 set cpo&vim
" constants
1 0.000010 let s:ON_NVIM = has('nvim')
" configurations
1 0.000006 let g:clever_f_across_no_line = get(g:, 'clever_f_across_no_line', 0)
1 0.000004 let g:clever_f_ignore_case = get(g:, 'clever_f_ignore_case', 0)
1 0.000004 let g:clever_f_use_migemo = get(g:, 'clever_f_use_migemo', 0)
1 0.000005 let g:clever_f_fix_key_direction = get(g:, 'clever_f_fix_key_direction', 0)
1 0.000005 let g:clever_f_show_prompt = get(g:, 'clever_f_show_prompt', 0)
1 0.000004 let g:clever_f_smart_case = get(g:, 'clever_f_smart_case', 0)
1 0.000005 let g:clever_f_chars_match_any_signs = get(g:, 'clever_f_chars_match_any_signs', '')
1 0.000004 let g:clever_f_mark_cursor = get(g:, 'clever_f_mark_cursor', 1)
1 0.000005 let g:clever_f_hide_cursor_on_cmdline = get(g:, 'clever_f_hide_cursor_on_cmdline', 1)
1 0.000004 let g:clever_f_timeout_ms = get(g:, 'clever_f_timeout_ms', 0)
1 0.000004 let g:clever_f_mark_char = get(g:, 'clever_f_mark_char', 1)
1 0.000022 let g:clever_f_repeat_last_char_inputs = get(g:, 'clever_f_repeat_last_char_inputs', ["\"])
1 0.000004 let g:clever_f_mark_direct = get(g:, 'clever_f_mark_direct', 0)
" below variable must be set before loading this script
1 0.000004 let g:clever_f_clean_labels_eagerly = get(g:, 'clever_f_clean_labels_eagerly', 1)
" highlight labels
1 0.000003 augroup plugin-clever-f-highlight
1 0.000005 autocmd!
1 0.000012 autocmd ColorScheme * highlight default CleverFDefaultLabel ctermfg=red ctermbg=NONE cterm=bold,underline guifg=red guibg=NONE gui=bold,underline
1 0.000002 augroup END
1 0.000017 highlight default CleverFDefaultLabel ctermfg=red ctermbg=NONE cterm=bold,underline guifg=red guibg=NONE gui=bold,underline
" Priority of highlight customization is:
" High: When g:clever_f_*_color
" Middle: :highlight in a colorscheme
" Low: Default highlights
" When the variable is defined, it should be linked with :hi! since :hi does
" not overwrite existing highlight group. (#50)
1 0.000003 if g:clever_f_mark_cursor
1 0.000005 if exists('g:clever_f_mark_cursor_color')
execute 'highlight! link CleverFCursor' g:clever_f_mark_cursor_color
1 0.000002 else
1 0.000004 highlight link CleverFCursor Cursor
1 0.000001 endif
1 0.000001 endif
1 0.000002 if g:clever_f_mark_char
1 0.000004 if exists('g:clever_f_mark_char_color')
execute 'highlight! link CleverFChar' g:clever_f_mark_char_color
1 0.000001 else
1 0.000003 highlight link CleverFChar CleverFDefaultLabel
1 0.000001 endif
1 0.000001 endif
1 0.000002 if g:clever_f_mark_direct
if exists('g:clever_f_mark_direct_color')
execute 'highlight! link CleverFDirect' g:clever_f_mark_direct_color
else
highlight link CleverFDirect CleverFDefaultLabel
endif
1 0.000001 endif
1 0.000002 if g:clever_f_clean_labels_eagerly
1 0.000002 augroup plugin-clever-f-permanent-finalizer
1 0.000003 autocmd!
1 0.000018 autocmd WinEnter,WinLeave,CmdWinLeave * if g:clever_f_mark_char | call s:remove_highlight() | endif
1 0.000001 augroup END
1 0.000001 endif
1 0.000002 augroup plugin-clever-f-finalizer
1 0.000003 autocmd!
1 0.000001 augroup END
" initialize the internal state
1 0.000003 let s:last_mode = ''
1 0.000003 let s:previous_map = {}
1 0.000003 let s:previous_pos = {}
1 0.000002 let s:first_move = {}
1 0.000002 let s:migemo_dicts = {}
1 0.000003 let s:previous_char_num = {}
1 0.000003 let s:timestamp = [0, 0]
" keys are mode string returned from mode()
1 0.000004 function! clever_f#reset() abort
let s:previous_map = {}
let s:previous_pos = {}
let s:first_move = {}
let s:migemo_dicts = {}
" Note:
" [0, 0] may be invalid because the representation of return value of reltime() depends on implementation.
let s:timestamp = [0, 0]
call s:remove_highlight()
return ''
endfunction
" hidden API for debug
1 0.000002 function! clever_f#_reset_all() abort
call clever_f#reset()
let s:last_mode = ''
let s:previous_char_num = {}
autocmd! plugin-clever-f-finalizer
unlet! s:moved_forward
return ''
endfunction
1 0.000003 function! s:remove_highlight() abort
for h in filter(getmatches(), 'v:val.group ==# "CleverFChar"')
call matchdelete(h.id)
endfor
endfunction
1 0.000002 function! s:is_timedout() abort
let cur = reltime()
let rel = reltimestr(reltime(s:timestamp, cur))
let elapsed_ms = float2nr(str2float(rel) * 1000.0)
let s:timestamp = cur
return elapsed_ms > g:clever_f_timeout_ms
endfunction
" highlight characters to which the cursor can be moved directly
1 0.000003 function! s:mark_direct(forward, count) abort
let line = getline('.')
let [_, l, c, _] = getpos('.')
if (a:forward && c == len(line)) || (!a:forward && c == 1)
" there is no matching characters
return []
endif
if g:clever_f_ignore_case
let line = tolower(line)
endif
let char_count = {}
let matches = []
let indices = a:forward ? range(c, len(line) - 1, 1) : range(c - 2, 0, -1)
for i in indices
let ch = line[i]
" only matches to ASCII
if ch !~# '^[\x00-\x7F]$' | continue | endif
let ch_lower = tolower(ch)
let char_count[ch] = get(char_count, ch, 0) + 1
if g:clever_f_smart_case && ch =~# '\u'
" uppercase characters are doubly counted
let char_count[ch_lower] = get(char_count, ch_lower, 0) + 1
endif
if char_count[ch] == a:count ||
\ (g:clever_f_smart_case && char_count[ch_lower] == a:count)
" NOTE: should not use `matchaddpos(group, [...position])`,
" because the maximum number of position is 8
let m = matchaddpos('CleverFDirect', [[l, i + 1]])
call add(matches, m)
endif
endfor
return matches
endfunction
" introduce public function for test
1 0.000003 function! clever_f#_mark_direct(forward, count) abort
return s:mark_direct(a:forward, a:count)
endfunction
1 0.000003 function! s:mark_char_in_current_line(map, char) abort
let regex = '\%' . line('.') . 'l' . s:generate_pattern(a:map, a:char)
call matchadd('CleverFChar', regex , 999)
endfunction
" Note:
" \x80\xfd` seems to be sent by a terminal.
" Below is a workaround for the sequence.
1 0.000002 function! s:getchar() abort
while 1
let cn = getchar()
if type(cn) != type('') || cn !=# "\x80\xfd`"
return cn
endif
endwhile
endfunction
1 0.000003 function! s:include_multibyte_char(str) abort
return strlen(a:str) != clever_f#compat#strchars(a:str)
endfunction
1 0.000002 function! clever_f#find_with(map) abort
if a:map !~# '^[fFtT]$'
throw "Error: Invalid mapping '" . a:map . "'"
endif
if &foldopen =~# '\<\%(all\|hor\)\>'
while foldclosed(line('.')) >= 0
foldopen
endwhile
endif
let current_pos = getpos('.')[1 : 2]
let mode = s:mode()
if current_pos != get(s:previous_pos, mode, [0, 0])
let back = 0
if g:clever_f_mark_cursor
let cursor_marker = matchadd('CleverFCursor', '\%#', 999)
redraw
endif
" block-NONE does not work on Neovim
if g:clever_f_hide_cursor_on_cmdline && !s:ON_NVIM
let guicursor_save = &guicursor
set guicursor=n-o:block-NONE
let t_ve_save = &t_ve
set t_ve=
endif
try
if g:clever_f_mark_direct
let direct_markers = s:mark_direct(a:map =~# '\l', v:count1)
redraw
endif
if g:clever_f_show_prompt | echon 'clever-f: ' | endif
let s:previous_map[mode] = a:map
let s:first_move[mode] = 1
let cn = s:getchar()
if cn == char2nr("\")
return "\"
endif
if index(map(deepcopy(g:clever_f_repeat_last_char_inputs), 'char2nr(v:val)'), cn) == -1
let s:previous_char_num[mode] = cn
else
if has_key(s:previous_char_num, s:last_mode)
let s:previous_char_num[mode] = s:previous_char_num[s:last_mode]
else
echohl ErrorMsg | echo 'Previous input not found.' | echohl None
return ''
endif
endif
let s:last_mode = mode
if g:clever_f_timeout_ms > 0
let s:timestamp = reltime()
endif
if g:clever_f_mark_char
call s:remove_highlight()
if mode ==# 'n' || mode ==? 'v' || mode ==# "\" ||
\ mode ==# 'ce' || mode ==? 's' || mode ==# "\"
augroup plugin-clever-f-finalizer
autocmd CursorMoved call s:maybe_finalize()
autocmd InsertEnter call s:finalize()
augroup END
call s:mark_char_in_current_line(s:previous_map[mode], s:previous_char_num[mode])
endif
endif
if g:clever_f_show_prompt | redraw! | endif
finally
if g:clever_f_mark_cursor | call matchdelete(cursor_marker) | endif
if g:clever_f_mark_direct
for m in direct_markers
call matchdelete(m)
endfor
endif
if g:clever_f_hide_cursor_on_cmdline && !s:ON_NVIM
" Set default value at first then restore (#49)
" For example, when the value is a:blinkon0, it does not affect cursor shape so cursor
" shape continues to disappear.
set guicursor&
if &guicursor !=# guicursor_save
let &guicursor = guicursor_save
endif
let &t_ve = t_ve_save
endif
endtry
else
" when repeated
let back = a:map =~# '\u'
if g:clever_f_fix_key_direction
let back = s:previous_map[mode] =~# '\u' ? !back : back
endif
" reset and retry if timed out
if g:clever_f_timeout_ms > 0 && s:is_timedout()
call clever_f#reset()
return clever_f#find_with(a:map)
endif
endif
return clever_f#repeat(back)
endfunction
1 0.000002 function! clever_f#repeat(back) abort
let mode = s:mode()
let pmap = get(s:previous_map, mode, '')
let prev_char_num = get(s:previous_char_num, mode, 0)
if pmap ==# ''
return ''
endif
" ignore special characters like \
if type(prev_char_num) == type('') && char2nr(prev_char_num) == 128
return ''
endif
if a:back
let pmap = s:swapcase(pmap)
endif
if mode[0] ==? 'v' || mode[0] ==# "\"
let cmd = s:move_cmd_for_visualmode(pmap, prev_char_num)
else
let inclusive = mode ==# 'no' && pmap =~# '\l'
let cmd = printf("%s:\call clever_f#find(%s, %s)\",
\ inclusive ? 'v' : '',
\ string(pmap), prev_char_num)
endif
return cmd
endfunction
" absolutely moved forward?
1 0.000003 function! s:moves_forward(p, n) abort
if a:p[0] != a:n[0]
return a:p[0] < a:n[0]
endif
if a:p[1] != a:n[1]
return a:p[1] < a:n[1]
endif
return 0
endfunction
1 0.000003 function! clever_f#find(map, char_num) abort
let before_pos = getpos('.')[1 : 2]
let next_pos = s:next_pos(a:map, a:char_num, v:count1)
if next_pos == [0, 0]
return
endif
let moves_forward = s:moves_forward(before_pos, next_pos)
" update highlight when cursor moves across lines
let mode = s:mode()
if g:clever_f_mark_char
if next_pos[0] != before_pos[0]
\ || (a:map ==? 't' && !s:first_move[mode] && clever_f#compat#xor(s:moved_forward, moves_forward))
call s:remove_highlight()
call s:mark_char_in_current_line(a:map, a:char_num)
endif
endif
let s:moved_forward = moves_forward
let s:previous_pos[mode] = next_pos
let s:first_move[mode] = 0
endfunction
1 0.000002 function! s:finalize() abort
autocmd! plugin-clever-f-finalizer
call s:remove_highlight()
let s:moved_forward = 0
endfunction
1 0.000002 function! s:maybe_finalize() abort
let pp = get(s:previous_pos, s:last_mode, [0, 0])
if getpos('.')[1 : 2] != pp
call s:finalize()
endif
endfunction
1 0.000003 function! s:move_cmd_for_visualmode(map, char_num) abort
let next_pos = s:next_pos(a:map, a:char_num, v:count1)
if next_pos == [0, 0]
return ''
endif
let m = s:mode()
call setpos("''", [0] + next_pos + [0])
let s:previous_pos[m] = next_pos
let s:first_move[m] = 0
return '``'
endfunction
1 0.000003 function! s:search(pat, flag) abort
if g:clever_f_across_no_line
return search(a:pat, a:flag, line('.'))
else
return search(a:pat, a:flag)
endif
endfunction
1 0.000003 function! s:should_use_migemo(char) abort
if !g:clever_f_use_migemo || a:char !~# '^\a$'
return 0
endif
if !g:clever_f_across_no_line
return 1
endif
return s:include_multibyte_char(getline('.'))
endfunction
1 0.000002 function! s:load_migemo_dict() abort
let enc = &l:encoding
if enc ==# 'utf-8'
return clever_f#migemo#utf8#load_dict()
elseif enc ==# 'cp932'
return clever_f#migemo#cp932#load_dict()
elseif enc ==# 'euc-jp'
return clever_f#migemo#eucjp#load_dict()
else
let g:clever_f_use_migemo = 0
throw 'Error: ' . enc . ' is not supported. Migemo is disabled.'
endif
endfunction
1 0.000003 function! s:generate_pattern(map, char_num) abort
let char = type(a:char_num) == type(0) ? nr2char(a:char_num) : a:char_num
let regex = char
let should_use_migemo = s:should_use_migemo(char)
if should_use_migemo
if !has_key(s:migemo_dicts, &l:encoding)
let s:migemo_dicts[&l:encoding] = s:load_migemo_dict()
endif
let regex = s:migemo_dicts[&l:encoding][regex] . '\&\%(' . char . '\|\A\)'
elseif stridx(g:clever_f_chars_match_any_signs, char) != -1
let regex = '\[!"#$%&''()=~|\-^\\@`[\]{};:+*<>,.?_/]'
elseif char ==# '\'
let regex = '\\'
endif
let is_exclusive_visual = &selection ==# 'exclusive' && s:mode()[0] ==? 'v'
if a:map ==# 't' && !is_exclusive_visual
let regex = '\_.\ze\%(' . regex . '\)'
elseif is_exclusive_visual && a:map ==# 'f'
let regex = '\%(' . regex . '\)\zs\_.'
elseif a:map ==# 'T'
let regex = '\%(' . regex . '\)\@<=\_.'
endif
if !should_use_migemo
let regex = '\V'.regex
endif
return ((g:clever_f_smart_case && char =~# '\l') || g:clever_f_ignore_case ? '\c' : '\C') . regex
endfunction
1 0.000003 function! s:next_pos(map, char_num, count) abort
let mode = s:mode()
let search_flag = a:map =~# '\l' ? 'W' : 'bW'
let cnt = a:count
let pattern = s:generate_pattern(a:map, a:char_num)
if a:map ==? 't' && get(s:first_move, mode, 1)
if !s:search(pattern, search_flag . 'c')
return [0, 0]
endif
let cnt -= 1
endif
while 0 < cnt
if !s:search(pattern, search_flag)
return [0, 0]
endif
let cnt -= 1
endwhile
return getpos('.')[1 : 2]
endfunction
1 0.000002 function! s:swapcase(char) abort
return a:char =~# '\u' ? tolower(a:char) : toupper(a:char)
endfunction
" Drop forced visual mode character ('nov' -> 'no')
1 0.000002 function! s:mode() abort
let mode = mode(1)
if mode =~# '^no'
let mode = mode[0 : 1]
endif
return mode
endfunction
1 0.000008 let &cpo = s:save_cpo
1 0.000004 unlet s:save_cpo
FUNCTION 24_move_cmd_for_visualmode()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:370
Called 26 times
Total time: 0.005676
Self time: 0.000807
count total (s) self (s)
26 0.004725 0.000159 let next_pos = s:next_pos(a:map, a:char_num, v:count1)
26 0.000058 if next_pos == [0, 0]
return ''
26 0.000019 endif
26 0.000388 0.000085 let m = s:mode()
26 0.000224 call setpos("''", [0] + next_pos + [0])
26 0.000086 let s:previous_pos[m] = next_pos
26 0.000060 let s:first_move[m] = 0
26 0.000029 return '``'
FUNCTION 24_include_multibyte_char()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:182
Called 20 times
Total time: 0.000230
Self time: 0.000158
count total (s) self (s)
20 0.000223 0.000151 return strlen(a:str) != clever_f#compat#strchars(a:str)
FUNCTION clever_f#repeat()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:290
Called 259 times
Total time: 0.024171
Self time: 0.014626
count total (s) self (s)
259 0.004278 0.000856 let mode = s:mode()
259 0.000989 let pmap = get(s:previous_map, mode, '')
259 0.000994 let prev_char_num = get(s:previous_char_num, mode, 0)
259 0.000388 if pmap ==# ''
return ''
259 0.000188 endif
" ignore special characters like \
259 0.001182 if type(prev_char_num) == type('') && char2nr(prev_char_num) == 128
3 0.000003 return ''
256 0.000183 endif
256 0.000315 if a:back
52 0.000712 0.000265 let pmap = s:swapcase(pmap)
256 0.000471 endif
256 0.001256 if mode[0] ==? 'v' || mode[0] ==# "\"
26 0.005814 0.000138 let cmd = s:move_cmd_for_visualmode(pmap, prev_char_num)
230 0.000296 else
230 0.000632 let inclusive = mode ==# 'no' && pmap =~# '\l'
230 0.002361 let cmd = printf("%s:\call clever_f#find(%s, %s)\", inclusive ? 'v' : '', string(pmap), prev_char_num)
256 0.000205 endif
256 0.000353 return cmd
FUNCTION 24_should_use_migemo()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:392
Called 361 times
Total time: 0.002249
Self time: 0.002019
count total (s) self (s)
361 0.001053 if !g:clever_f_use_migemo || a:char !~# '^\a$'
335 0.000439 return 0
26 0.000021 endif
26 0.000043 if !g:clever_f_across_no_line
6 0.000007 return 1
20 0.000014 endif
20 0.000340 0.000110 return s:include_multibyte_char(getline('.'))
FUNCTION 24_mark_char_in_current_line()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:165
Called 105 times
Total time: 0.039145
Self time: 0.005871
count total (s) self (s)
105 0.034236 0.000963 let regex = '\%' . line('.') . 'l' . s:generate_pattern(a:map, a:char)
105 0.004826 call matchadd('CleverFChar', regex , 999)
FUNCTION clever_f#find_with()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:186
Called 270 times
Total time: 0.135118
Self time: 0.066131
count total (s) self (s)
270 0.002498 if a:map !~# '^[fFtT]$'
1 0.004384 throw "Error: Invalid mapping '" . a:map . "'"
269 0.000240 endif
269 0.003383 if &foldopen =~# '\<\%(all\|hor\)\>'
270 0.001478 while foldclosed(line('.')) >= 0
1 0.000002 foldopen
270 0.000403 endwhile
269 0.000241 endif
269 0.001605 let current_pos = getpos('.')[1 : 2]
269 0.004568 0.000996 let mode = s:mode()
269 0.001315 if current_pos != get(s:previous_pos, mode, [0, 0])
95 0.000144 let back = 0
95 0.000547 if g:clever_f_mark_cursor
95 0.000799 let cursor_marker = matchadd('CleverFCursor', '\%#', 999)
95 0.002919 redraw
95 0.000087 endif
" block-NONE does not work on Neovim
95 0.000274 if g:clever_f_hide_cursor_on_cmdline && !s:ON_NVIM
95 0.000258 let guicursor_save = &guicursor
95 0.001306 set guicursor=n-o:block-NONE
95 0.000282 let t_ve_save = &t_ve
95 0.000459 set t_ve=
95 0.000084 endif
95 0.000093 try
95 0.000162 if g:clever_f_mark_direct
3 0.001536 0.000038 let direct_markers = s:mark_direct(a:map =~# '\l', v:count1)
3 0.000017 redraw
95 0.000083 endif
95 0.000417 if g:clever_f_show_prompt | echon 'clever-f: ' | endif
95 0.000342 let s:previous_map[mode] = a:map
95 0.000252 let s:first_move[mode] = 1
95 0.001820 0.000455 let cn = s:getchar()
95 0.000424 if cn == char2nr("\")
4 0.000007 return "\"
91 0.000073 endif
91 0.000874 if index(map(deepcopy(g:clever_f_repeat_last_char_inputs), 'char2nr(v:val)'), cn) == -1
84 0.000303 let s:previous_char_num[mode] = cn
7 0.000007 else
7 0.000024 if has_key(s:previous_char_num, s:last_mode)
3 0.000013 let s:previous_char_num[mode] = s:previous_char_num[s:last_mode]
4 0.000003 else
4 0.000031 echohl ErrorMsg | echo 'Previous input not found.' | echohl None
4 0.000006 return ''
3 0.000002 endif
87 0.000070 endif
87 0.000187 let s:last_mode = mode
87 0.000161 if g:clever_f_timeout_ms > 0
3 0.000009 let s:timestamp = reltime()
87 0.000067 endif
87 0.000126 if g:clever_f_mark_char
87 0.001961 0.000433 call s:remove_highlight()
87 0.000327 if mode ==# 'n' || mode ==? 'v' || mode ==# "\" || mode ==# 'ce' || mode ==? 's' || mode ==# "\"
86 0.000213 augroup plugin-clever-f-finalizer
86 0.000598 autocmd CursorMoved call s:maybe_finalize()
86 0.000515 autocmd InsertEnter call s:finalize()
86 0.000127 augroup END
86 0.035676 0.000682 call s:mark_char_in_current_line(s:previous_map[mode], s:previous_char_num[mode])
87 0.000085 endif
87 0.000068 endif
87 0.000347 if g:clever_f_show_prompt | redraw! | endif
95 0.000130 finally
95 0.000544 if g:clever_f_mark_cursor | call matchdelete(cursor_marker) | endif
95 0.000142 if g:clever_f_mark_direct
25 0.000027 for m in direct_markers
22 0.000045 call matchdelete(m)
25 0.000021 endfor
95 0.000077 endif
95 0.000232 if g:clever_f_hide_cursor_on_cmdline && !s:ON_NVIM
" Set default value at first then restore (#49)
" For example, when the value is a:blinkon0, it does not affect cursor shape so cursor
" shape continues to disappear.
95 0.001610 set guicursor&
95 0.000343 if &guicursor !=# guicursor_save
let &guicursor = guicursor_save
95 0.000077 endif
95 0.000478 let &t_ve = t_ve_save
95 0.000075 endif
95 0.000102 endtry
174 0.000154 else
" when repeated
174 0.001373 let back = a:map =~# '\u'
174 0.000442 if g:clever_f_fix_key_direction
15 0.000093 let back = s:previous_map[mode] =~# '\u' ? !back : back
174 0.000239 endif
" reset and retry if timed out
174 0.000738 0.000625 if g:clever_f_timeout_ms > 0 && s:is_timedout()
2 0.000103 0.000008 call clever_f#reset()
2 0.000007 return clever_f#find_with(a:map)
172 0.000197 endif
259 0.000261 endif
259 0.025223 0.001052 return clever_f#repeat(back)
FUNCTION clever_f#_mark_direct()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:161
Called 10 times
Total time: 0.007595
Self time: 0.000078
count total (s) self (s)
10 0.007590 0.000073 return s:mark_direct(a:forward, a:count)
FUNCTION 24_swapcase()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:473
Called 52 times
Total time: 0.000447
Self time: 0.000447
count total (s) self (s)
52 0.000427 return a:char =~# '\u' ? tolower(a:char) : toupper(a:char)
FUNCTION 24_search()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:384
Called 256 times
Total time: 0.057383
Self time: 0.057383
count total (s) self (s)
256 0.000488 if g:clever_f_across_no_line
25 0.030142 return search(a:pat, a:flag, line('.'))
231 0.000209 else
231 0.025555 return search(a:pat, a:flag)
endif
FUNCTION 24_load_migemo_dict()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:404
Called 3 times
Total time: 0.024653
Self time: 0.000577
count total (s) self (s)
3 0.000005 let enc = &l:encoding
3 0.000005 if enc ==# 'utf-8'
3 0.024638 0.000563 return clever_f#migemo#utf8#load_dict()
elseif enc ==# 'cp932'
return clever_f#migemo#cp932#load_dict()
elseif enc ==# 'euc-jp'
return clever_f#migemo#eucjp#load_dict()
else
let g:clever_f_use_migemo = 0
throw 'Error: ' . enc . ' is not supported. Migemo is disabled.'
endif
FUNCTION 24_finalize()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:357
Called 2 times
Total time: 0.000069
Self time: 0.000028
count total (s) self (s)
2 0.000015 autocmd! plugin-clever-f-finalizer
2 0.000049 0.000008 call s:remove_highlight()
2 0.000004 let s:moved_forward = 0
FUNCTION 24_mark_direct()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:121
Called 13 times
Total time: 0.009015
Self time: 0.009015
count total (s) self (s)
13 0.000044 let line = getline('.')
13 0.000057 let [_, l, c, _] = getpos('.')
13 0.000111 if (a:forward && c == len(line)) || (!a:forward && c == 1)
" there is no matching characters
1 0.000001 return []
12 0.000011 endif
12 0.000020 if g:clever_f_ignore_case
3 0.000010 let line = tolower(line)
12 0.000009 endif
12 0.000024 let char_count = {}
12 0.000021 let matches = []
12 0.000094 let indices = a:forward ? range(c, len(line) - 1, 1) : range(c - 2, 0, -1)
235 0.000251 for i in indices
223 0.000467 let ch = line[i]
" only matches to ASCII
434 0.001533 if ch !~# '^[\x00-\x7F]$' | continue | endif
197 0.000507 let ch_lower = tolower(ch)
197 0.000757 let char_count[ch] = get(char_count, ch, 0) + 1
197 0.000538 if g:clever_f_smart_case && ch =~# '\u'
" uppercase characters are doubly counted
9 0.000038 let char_count[ch_lower] = get(char_count, ch_lower, 0) + 1
197 0.000276 endif
197 0.000776 if char_count[ch] == a:count || (g:clever_f_smart_case && char_count[ch_lower] == a:count)
" NOTE: should not use `matchaddpos(group, [...position])`,
" because the maximum number of position is 8
105 0.000739 let m = matchaddpos('CleverFDirect', [[l, i + 1]])
105 0.000252 call add(matches, m)
197 0.000150 endif
209 0.000189 endfor
12 0.000019 return matches
FUNCTION 24_is_timedout()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:112
Called 4 times
Total time: 0.000113
Self time: 0.000113
count total (s) self (s)
4 0.000013 let cur = reltime()
4 0.000041 let rel = reltimestr(reltime(s:timestamp, cur))
4 0.000035 let elapsed_ms = float2nr(str2float(rel) * 1000.0)
4 0.000009 let s:timestamp = cur
4 0.000010 return elapsed_ms > g:clever_f_timeout_ms
FUNCTION clever_f#find()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:333
Called 230 times
Total time: 0.115304
Self time: 0.013948
count total (s) self (s)
230 0.001587 let before_pos = getpos('.')[1 : 2]
230 0.092780 0.001894 let next_pos = s:next_pos(a:map, a:char_num, v:count1)
230 0.000530 if next_pos == [0, 0]
14 0.000013 return
216 0.000180 endif
216 0.003954 0.001175 let moves_forward = s:moves_forward(before_pos, next_pos)
" update highlight when cursor moves across lines
216 0.003558 0.000735 let mode = s:mode()
216 0.000380 if g:clever_f_mark_char
216 0.002368 0.002101 if next_pos[0] != before_pos[0] || (a:map ==? 't' && !s:first_move[mode] && clever_f#compat#xor(s:moved_forward, moves_forward))
19 0.000696 0.000246 call s:remove_highlight()
19 0.004258 0.000108 call s:mark_char_in_current_line(a:map, a:char_num)
216 0.000187 endif
216 0.000167 endif
216 0.000696 let s:moved_forward = moves_forward
216 0.000711 let s:previous_pos[mode] = next_pos
216 0.000512 let s:first_move[mode] = 0
FUNCTION 24_getchar()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:173
Called 95 times
Total time: 0.001365
Self time: 0.001365
count total (s) self (s)
95 0.000135 while 1
95 0.000483 let cn = getchar()
95 0.000463 if type(cn) != type('') || cn !=# "\x80\xfd`"
95 0.000134 return cn
endif
endwhile
FUNCTION clever_f#_reset_all()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:96
Called 1 time
Total time: 0.000058
Self time: 0.000023
count total (s) self (s)
1 0.000038 0.000003 call clever_f#reset()
1 0.000002 let s:last_mode = ''
1 0.000003 let s:previous_char_num = {}
1 0.000010 autocmd! plugin-clever-f-finalizer
1 0.000002 unlet! s:moved_forward
1 0.000001 return ''
FUNCTION 24_next_pos()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:450
Called 256 times
Total time: 0.095452
Self time: 0.015284
count total (s) self (s)
256 0.004091 0.000836 let mode = s:mode()
256 0.001785 let search_flag = a:map =~# '\l' ? 'W' : 'bW'
256 0.000484 let cnt = a:count
256 0.020963 0.001433 let pattern = s:generate_pattern(a:map, a:char_num)
256 0.000881 if a:map ==? 't' && get(s:first_move, mode, 1)
27 0.005556 0.000137 if !s:search(pattern, search_flag . 'c')
return [0, 0]
27 0.000023 endif
27 0.000059 let cnt -= 1
256 0.000214 endif
471 0.001011 while 0 < cnt
229 0.053299 0.001336 if !s:search(pattern, search_flag)
14 0.000024 return [0, 0]
215 0.000197 endif
215 0.000478 let cnt -= 1
457 0.000628 endwhile
242 0.001059 return getpos('.')[1 : 2]
FUNCTION 24_mode()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:478
Called 1044 times
Total time: 0.013565
Self time: 0.013565
count total (s) self (s)
1044 0.002773 let mode = mode(1)
1044 0.005787 if mode =~# '^no'
4 0.000012 let mode = mode[0 : 1]
1044 0.000813 endif
1044 0.001464 return mode
FUNCTION 24_moves_forward()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:321
Called 216 times
Total time: 0.002779
Self time: 0.002779
count total (s) self (s)
216 0.000902 if a:p[0] != a:n[0]
9 0.000023 return a:p[0] < a:n[0]
207 0.000208 endif
207 0.000494 if a:p[1] != a:n[1]
201 0.000482 return a:p[1] < a:n[1]
6 0.000004 endif
6 0.000006 return 0
FUNCTION 24_generate_pattern()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:418
Called 361 times
Total time: 0.052804
Self time: 0.025713
count total (s) self (s)
361 0.002377 let char = type(a:char_num) == type(0) ? nr2char(a:char_num) : a:char_num
361 0.000608 let regex = char
361 0.004143 0.001894 let should_use_migemo = s:should_use_migemo(char)
361 0.000526 if should_use_migemo
26 0.000102 if !has_key(s:migemo_dicts, &l:encoding)
3 0.024683 0.000031 let s:migemo_dicts[&l:encoding] = s:load_migemo_dict()
26 0.000028 endif
26 0.000723 let regex = s:migemo_dicts[&l:encoding][regex] . '\&\%(' . char . '\|\A\)'
335 0.001419 elseif stridx(g:clever_f_chars_match_any_signs, char) != -1
68 0.000155 let regex = '\[!"#$%&''()=~|\-^\\@`[\]{};:+*<>,.?_/]'
267 0.000418 elseif char ==# '\'
8 0.000014 let regex = '\\'
361 0.000279 endif
361 0.002164 0.001975 let is_exclusive_visual = &selection ==# 'exclusive' && s:mode()[0] ==? 'v'
361 0.000796 if a:map ==# 't' && !is_exclusive_visual
55 0.000216 let regex = '\_.\ze\%(' . regex . '\)'
306 0.000587 elseif is_exclusive_visual && a:map ==# 'f'
3 0.000008 let regex = '\%(' . regex . '\)\zs\_.'
303 0.000512 elseif a:map ==# 'T'
42 0.000214 let regex = '\%(' . regex . '\)\@<=\_.'
361 0.000272 endif
361 0.000525 if !should_use_migemo
335 0.000741 let regex = '\V'.regex
361 0.000283 endif
361 0.002199 return ((g:clever_f_smart_case && char =~# '\l') || g:clever_f_ignore_case ? '\c' : '\C') . regex
FUNCTION clever_f#reset()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:80
Called 63 times
Total time: 0.002493
Self time: 0.001877
count total (s) self (s)
63 0.000211 let s:previous_map = {}
63 0.000212 let s:previous_pos = {}
63 0.000169 let s:first_move = {}
63 0.000495 let s:migemo_dicts = {}
" Note:
" [0, 0] may be invalid because the representation of return value of reltime() depends on implementation.
63 0.000164 let s:timestamp = [0, 0]
63 0.000869 0.000253 call s:remove_highlight()
63 0.000087 return ''
FUNCTION 24_remove_highlight()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:106
Called 407 times
Total time: 0.005702
Self time: 0.005702
count total (s) self (s)
512 0.003361 for h in filter(getmatches(), 'v:val.group ==# "CleverFChar"')
105 0.000427 call matchdelete(h.id)
512 0.000555 endfor
FUNCTION 24_maybe_finalize()
Defined: D:\a\clever-f.vim\clever-f.vim\autoload\clever_f.vim:363
Called 1 time
Total time: 0.000051
Self time: 0.000015
count total (s) self (s)
1 0.000005 let pp = get(s:previous_pos, s:last_mode, [0, 0])
1 0.000005 if getpos('.')[1 : 2] != pp
1 0.000040 0.000003 call s:finalize()
1 0.000001 endif
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
270 0.135118 0.066131 clever_f#find_with()
230 0.115304 0.013948 clever_f#find()
256 0.095452 0.015284 24_next_pos()
256 0.057383 24_search()
361 0.052804 0.025713 24_generate_pattern()
105 0.039145 0.005871 24_mark_char_in_current_line()
3 0.024653 0.000577 24_load_migemo_dict()
259 0.024171 0.014626 clever_f#repeat()
1044 0.013565 24_mode()
13 0.009015 24_mark_direct()
10 0.007595 0.000078 clever_f#_mark_direct()
407 0.005702 24_remove_highlight()
26 0.005676 0.000807 24_move_cmd_for_visualmode()
216 0.002779 24_moves_forward()
63 0.002493 0.001877 clever_f#reset()
361 0.002249 0.002019 24_should_use_migemo()
95 0.001365 24_getchar()
52 0.000447 24_swapcase()
20 0.000230 0.000158 24_include_multibyte_char()
4 0.000113 24_is_timedout()
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
270 0.135118 0.066131 clever_f#find_with()
256 0.057383 24_search()
361 0.052804 0.025713 24_generate_pattern()
256 0.095452 0.015284 24_next_pos()
259 0.024171 0.014626 clever_f#repeat()
230 0.115304 0.013948 clever_f#find()
1044 0.013565 24_mode()
13 0.009015 24_mark_direct()
105 0.039145 0.005871 24_mark_char_in_current_line()
407 0.005702 24_remove_highlight()
216 0.002779 24_moves_forward()
361 0.002249 0.002019 24_should_use_migemo()
63 0.002493 0.001877 clever_f#reset()
95 0.001365 24_getchar()
26 0.005676 0.000807 24_move_cmd_for_visualmode()
3 0.024653 0.000577 24_load_migemo_dict()
52 0.000447 24_swapcase()
20 0.000230 0.000158 24_include_multibyte_char()
4 0.000113 24_is_timedout()
10 0.007595 0.000078 clever_f#_mark_direct()
Thanks already. More debug logging would be good.
Can you try type .coverage_covimerage
after the command, which should display the output file, if any?
I could retrieve profile output as follows:
https://gist.github.com/rhysd/d550409c4eb22a66cac97cc1a1cb6748
covimerage write_coverage profile.txt
works with that locally for me (on Linux), exiting with 0.
I don't know why this line was not output:
This only happens with "covimerage run", but you are using "covimerage write_coverage", aren't you?
Can you try type .coverage_covimerage after the command, which should display the output file, if any?
Sure. Let me try.
covimerage write_coverage profile.txt works with that locally for me (on Linux), exiting with 0.
Yeah, actually covimerage works fine on macOS and Linux on GitHub Actions workflow
This only happens with "covimerage run", but you are using "covimerage write_coverage", aren't you?
I apologize that it was wrong line. Please forget.
After adding $ErrorActionPreference = 'SilentlyContinue'
(it means 'ignore errors' on Windows), I confirmed that the coverage report was correctly generated. type .covimerage_coverage
said as follows:
https://github.com/rhysd/clever-f.vim/runs/408731885?check_suite_focus=true#step:8:34
!coverage.py: This is a private format, don't read it directly!{"lines":{"D:\\a\\clever-f.vim\\clever-f.vim\\plugin\\clever-f.vim":[1,3,5,6,7,8,9,10,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28],"D:\\a\\clever-f.vim\\clever-f.vim\\autoload\\clever_f.vim":[1,2,5,8,9,10,11,12,13,14,15,16,17,18,19,20,23,26,27,28,29,30,38,39,41,42,43,44,45,46,48,49,50,51,52,58,60,61,62,63,64,65,66,67,68,71,72,73,74,75,76,77,80,81,82,83,84,88,90,92,96,97,98,99,100,101,103,106,107,108,109,112,113,114,115,116,117,121,122,123,125,127,128,130,131,132,134,135,136,137,138,140,141,143,144,146,147,149,150,153,154,155,156,157,161,162,165,166,167,173,174,175,176,177,182,183,186,187,188,189,191,192,193,194,195,197,199,200,201,202,203,204,205,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,237,238,239,241,242,243,244,245,246,247,248,249,250,251,253,254,255,256,257,258,259,260,261,265,267,269,270,271,272,273,275,276,277,278,281,282,283,284,285,287,290,291,292,293,295,297,300,301,302,304,305,306,308,309,310,311,312,313,314,315,317,321,322,323,324,326,327,328,330,333,334,335,336,337,338,340,343,344,345,346,347,348,349,350,352,353,354,357,358,359,360,363,364,365,366,367,370,371,372,374,376,377,378,379,381,384,385,386,387,388,392,393,394,395,397,398,399,401,404,405,406,407,418,419,420,422,423,424,425,426,427,428,429,430,431,432,434,435,436,437,438,439,440,441,443,444,445,447,450,451,452,453,454,456,457,459,460,461,463,464,465,466,467,468,470,473,474,478,479,480,481,482,483,486,487]},"file_tracers":{"D:\\a\\clever-f.vim\\clever-f.vim\\plugin\\clever-f.vim":"covimerage.CoveragePlugin","D:\\a\\clever-f.vim\\clever-f.vim\\autoload\\clever_f.vim":"covimerage.CoveragePlugin"}}
It looked that covimerage
could generate file correctly but did not exit successfully.
I am still not sure/convinced that it is covimerage exiting non-zero here.
Was the type
not called without $ErrorActionPreference = 'SilentlyContinue'
?
I thought the point too. So I also added echo commands as follows:
- name: Report coverage
if: matrix.os == 'windows-latest'
run: |
pip install covimerage
covimerage --version
cd ./test
echo 'start covimerage'
covimerage --loglevel debug --verbose write_coverage profile.txt
echo 'done covimerage'
type .coverage_covimerage
echo 'coverage report'
coverage report
echo 'coverage xml'
coverage xml
echo 'done all'
And I confirmed start covimerage
was output but done covimerage
was not output.
https://github.com/rhysd/clever-f.vim/runs/408735732?check_suite_focus=true#step:8:33
Thanks for confirmation. Might be an issue with the interaction of click then. Maybe there is an error even, but just does not get displayed for some reason.
Since covimerage --version
works it's at least not something generic.
Maybe try strace -f covimerage …
to get more insight (assuming that strace
is available in the Windows env).
In general though we have to investigate where it is failing, and why there is no error - more debug logging might be useful in that regard.
I think strace
is not available on Windows. there would be an alternative, but I don't know any such a command line tool though I know some GUI tool.
I'm not so familiar with python. Is trace module available to trace which line was executed? We might be able to find out which line is failing.
Good idea. Try python -m trace -t --module covimerage write_coverage …
.
But otherwise I would hope for this issue showing up with its tests, so it might be good to setup GitHub Actions fist anyway / in parallel.
I agree. Let me try it on tomorrow night or day after tomorrow since I need to make a deck for tomorrow's meetup..
I'm sorry for asking a question on issues page, but I could not find a proper place to do.
Does covimerage support Windows? Today I added Windows environment to CI for clever-f.vim. And I got a crash on
covimerage write_coverage
. It did output nothing to stderr and just exited with non-zero status.https://github.com/rhysd/clever-f.vim/runs/408651778?check_suite_focus=true#step:7:28
My steps to run covimerage are as follows (assume
:profile
output is put in./test
directory):I'm using
actions/setup-python@v1
with no argument so Python version would be the latest stable.