56637Re: New script: SmartTag (resolves ambiguous C++ tags etc)
- May 1 3:51 AMOn 28-Apr-2010 Robert Webb <stella4d@...> wrote:
>What I meant is: if the user's function used in 'tagfunc' returns a list
> > - left a FIXME in the code stating that duplicate tags should be removed
> > from the list returned by the user-defined function. Not quite sure,
> > though, whether it wouldn't be better to leave it to the user.
> I don't think there's any point keeping them. They can never be of use if
> details match (name, file, search command). Currently I have a function
> UniqList() which does it. It's very inefficient (N^2). Would be more
> efficiently handled in C. Maybe a uniq() function would be handy in
> to remove multiple copies in a list.
> Maybe a flag to taglist() requesting that duplicate entries be removed?
of tags, should I verify that there are no duplicates in the list? I'd
say: no - leave it to the user to take care of what is returned.
Another issue is whether taglist() should remove duplicates. It might be
good to handle this but for now I'd rather stick to 'tagfunc' to get it
> > - maybe it would make some sense to let taglist() return a resultOK, I'll think about this later.
> > returned by the 'tagfunc' function? taglist() could take an optional
> > argument which would state whether recursion is allowed and an upper
> > limit on the recursion level could be set. I can at least imagine
> > a use case for such a feature (admittedly, awkward a bit).
> I don't know that an extra option is required. I think taglist() should
> make use of 'tagfunc', unless called recursively from within the tag
> itself. I guess an extra optional arg might be useful to allow the user to
> avoid calling tagfunc if they wish.
> Hmm, I suppose taglist() won't know whether the 'c' flag should be used when
> calling 'tagfunc'. Maybe we need to be able to pass this flag to taglist()
> too so it can pass it through?
> Hmm, another small difference. My script presumes the tag name is complete,I have no problem with that.
> whereas taglist() just searches, eg taglist("blah") will find tags for
> "blabbyblahblab". Is this an issue?
> Some other thoughts:[...]
> - Another thing I need is a way to do more than one search in the tag command.
> - Gets a little trickier than above too, because I want to have access to[...]
> of vim's search capabilities in that tag command. The format of a search
> - Vim doesn't load all tags when it does a tag search. It looks at one file[...]
It would be great to have all of them, but I consider them improvements
to the basic functionality offered by 'tagfunc'. Once 'tagfunc' is
implemented properly these can be considered.
> - By the way, in TagFunc2() you should use "taglist('^' . pattern . '$')"OK, I changed the example totally so this is a non-issue.
> rather than "taglist('\<' . pattern . '\>')". The latter may miss some
> non-alphabetic tags like operators. Not that it matters for a proof of
> concept like this, but thought I'd mention it. Oh, I see this example is
> the docs too, so all the more reason to do it the "proper" way. Not sure
> it's the best example though, since not many tags will use line numbers
> me none of them do although not sure why).
> The script shouldn't be hard to convert for use with 'tagfunc'. SomethingAfter my small adjustments works for me almost perfectly:
function! SmartTagFunc(pattern, flags)
if a:flags =~? 'c'
let tags = 
let id = GetNiceTagList(tags, 'nk')
I am having some problems with the code that I am working on.
Unfortunately, I cannot share it so I will try to tackle the thing
Some news about 'tagfunc':
I discovered that the 'tagfunc' implementation prevented omni completion
for C from working when 'tagfunc' was set to the SmartTagFunc() function
defined a few lines above. This was due to the fact that - as mentioned
by the documentation - in each of the dictionaries returned by
SmartTagFunc() only the entries 'name', 'filename' and 'cmd' are
considered relevant. Without thinking too much I simply discarded all
the other entries effectively filtering out the data essential to omni
completion. The latest patch fixes the problem. Find it attached.
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>