mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2634: 'tagfunc' does not indicate using a pattern
Problem: 'tagfunc' does not indicate using a pattern.
Solution: Add the "r" flag. (Andy Massimino, closes vim/vim#7982)
f90c855c71
This commit is contained in:
parent
749a8b6be7
commit
c620ca4cc2
@ -847,19 +847,25 @@ like |CTRL-]|.
|
|||||||
|
|
||||||
The function used for generating the taglist is specified by setting the
|
The function used for generating the taglist is specified by setting the
|
||||||
'tagfunc' option. The function will be called with three arguments:
|
'tagfunc' option. The function will be called with three arguments:
|
||||||
a:pattern The tag identifier used during the tag search.
|
a:pattern The tag identifier or pattern used during the tag search.
|
||||||
a:flags List of flags to control the function behavior.
|
a:flags String containing flags to control the function behavior.
|
||||||
a:info Dict containing the following entries:
|
a:info Dict containing the following entries:
|
||||||
buf_ffname Full filename which can be used for priority.
|
buf_ffname Full filename which can be used for priority.
|
||||||
user_data Custom data String, if stored in the tag
|
user_data Custom data String, if stored in the tag
|
||||||
stack previously by tagfunc.
|
stack previously by tagfunc.
|
||||||
|
|
||||||
Currently two flags may be passed to the tag function:
|
Currently up to three flags may be passed to the tag function:
|
||||||
'c' The function was invoked by a normal command being processed
|
'c' The function was invoked by a normal command being processed
|
||||||
(mnemonic: the tag function may use the context around the
|
(mnemonic: the tag function may use the context around the
|
||||||
cursor to perform a better job of generating the tag list.)
|
cursor to perform a better job of generating the tag list.)
|
||||||
'i' In Insert mode, the user was completing a tag (with
|
'i' In Insert mode, the user was completing a tag (with
|
||||||
|i_CTRL-X_CTRL-]|).
|
|i_CTRL-X_CTRL-]| or 'completeopt' contains `t`).
|
||||||
|
'r' The first argument to tagfunc should be interpreted as a
|
||||||
|
|pattern| (see |tag-regexp|), such as when using: >
|
||||||
|
:tag /pat
|
||||||
|
< It is also given when completing in insert mode.
|
||||||
|
If this flag is not present, the argument is usually taken
|
||||||
|
literally as the full tag name.
|
||||||
|
|
||||||
Note that when 'tagfunc' is set, the priority of the tags described in
|
Note that when 'tagfunc' is set, the priority of the tags described in
|
||||||
|tag-priority| does not apply. Instead, the priority is exactly as the
|
|tag-priority| does not apply. Instead, the priority is exactly as the
|
||||||
|
@ -1141,7 +1141,7 @@ static int find_tagfunc_tags(
|
|||||||
int result = FAIL;
|
int result = FAIL;
|
||||||
typval_T args[4];
|
typval_T args[4];
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
char_u flagString[3];
|
char_u flagString[4];
|
||||||
dict_T *d;
|
dict_T *d;
|
||||||
taggy_T *tag = &curwin->w_tagstack[curwin->w_tagstackidx];
|
taggy_T *tag = &curwin->w_tagstack[curwin->w_tagstackidx];
|
||||||
|
|
||||||
@ -1170,9 +1170,10 @@ static int find_tagfunc_tags(
|
|||||||
args[3].v_type = VAR_UNKNOWN;
|
args[3].v_type = VAR_UNKNOWN;
|
||||||
|
|
||||||
vim_snprintf((char *)flagString, sizeof(flagString),
|
vim_snprintf((char *)flagString, sizeof(flagString),
|
||||||
"%s%s",
|
"%s%s%s",
|
||||||
g_tag_at_cursor ? "c": "",
|
g_tag_at_cursor ? "c": "",
|
||||||
flags & TAG_INS_COMP ? "i": "");
|
flags & TAG_INS_COMP ? "i": "",
|
||||||
|
flags & TAG_REGEXP ? "r": "");
|
||||||
|
|
||||||
save_pos = curwin->w_cursor;
|
save_pos = curwin->w_cursor;
|
||||||
result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv);
|
result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv);
|
||||||
|
@ -43,12 +43,24 @@ func Test_tagfunc()
|
|||||||
call assert_equal('one', g:tagfunc_args[0])
|
call assert_equal('one', g:tagfunc_args[0])
|
||||||
call assert_equal('c', g:tagfunc_args[1])
|
call assert_equal('c', g:tagfunc_args[1])
|
||||||
|
|
||||||
|
let g:tagfunc_args=[]
|
||||||
|
execute "tag /foo$"
|
||||||
|
call assert_equal('foo$', g:tagfunc_args[0])
|
||||||
|
call assert_equal('r', g:tagfunc_args[1])
|
||||||
|
|
||||||
set cpt=t
|
set cpt=t
|
||||||
let g:tagfunc_args=[]
|
let g:tagfunc_args=[]
|
||||||
execute "normal! i\<c-n>\<c-y>"
|
execute "normal! i\<c-n>\<c-y>"
|
||||||
call assert_equal('ci', g:tagfunc_args[1])
|
call assert_equal('\<\k\k', g:tagfunc_args[0])
|
||||||
|
call assert_equal('cir', g:tagfunc_args[1])
|
||||||
call assert_equal('nothing1', getline('.')[0:7])
|
call assert_equal('nothing1', getline('.')[0:7])
|
||||||
|
|
||||||
|
let g:tagfunc_args=[]
|
||||||
|
execute "normal! ono\<c-n>\<c-n>\<c-y>"
|
||||||
|
call assert_equal('\<no', g:tagfunc_args[0])
|
||||||
|
call assert_equal('cir', g:tagfunc_args[1])
|
||||||
|
call assert_equal('nothing2', getline('.')[0:7])
|
||||||
|
|
||||||
func BadTagFunc1(...)
|
func BadTagFunc1(...)
|
||||||
return 0
|
return 0
|
||||||
endfunc
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user