cscope & gvim (was: Re: (1) cscope & gvim; (2) ctags & C++/STL)

From: Hans-Bernhard Broeker (broeker_at_physik.rwth-aachen.de)
Date: 01/30/04


Date: 30 Jan 2004 11:27:50 GMT

Fred Ma <fma@doe.carleton.ca> wrote:

> ===========================================================================
> Question (1): cscope choosese wrong match from list
> ===========================================================================

Please try to avoid posting two rather unrelated questions in a single
article. I'll answer only to the first, and change the Subj
accordingly.

> I'm using gvim 6.2 on solaris 8. I've posted question
> (1) to the vim group comp.editors, as well as the vim
> mailing list vim@vim.org. I haven't gotten much
> response yet. I'm using cscope 15.5 with the cscope
> plugin file attached at the very end of this posting.
> I'm pretty new to cscope, but am very pleased with what
> it can do. Especially for C++/STL, where you have
> things defined all over the place.

A note of caution is needed here: cscope is designed for C, not C++.
It manages to catch some C++ syntax, but please don't expect it to be
reliable. It's not.

> My problem is that when I do a cscope query for symbols
> and get multiple matching results, I get warped to the
> wrong occurance of that symbol. That is, if I choose
> the 7th occurance, I end up at the 5th occurance. The
> offset is usually (but not always) 2 positions up in
> the match list; sometimes, it's 2 positions down,
> depending on the symbol queried.

I rather strongly suspect the problem is with that vim plugin for
cscope, which is maintained by the vim people. But you may want to
check the results generated by cscope itself, too, to see if there's
anything that sticks out. Run cscope on your existing cscope.out
file, like vim does it:

        cscope -ld

from the directory cscope.out is in, and type the line '0foo' to
search for all occurances of symbol 'foo'. Include the output of this
in any report you make to the vim guys, or here. It's extremely hard
to debug such problems without a complete, reproducable example or at
least some hard data to inspect.

> I never tried ":cs reset" because I can't find enough
> documentation what it exactly does (not in the cscope
> man page either).

It can't be in the cscope man page --- the VIM interface is none of
cscope's business.

-- 
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.


Relevant Pages

  • (1) cscope & gvim; (2) ctags & C++/STL
    ... cscope choosese wrong match from list ... to the vim group comp.editors, ... under the cursor. ... posting about how to get it to tag local variables, ...
    (comp.unix.programmer)
  • Re: Linux user interested in *BSD
    ... vim is a very good example. ... On another newsgroup people ignored the mere existence of cscope. ... >> Hence hardwiring a dependence on cscope in vim is not necessary. ... >> support, ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Linux user interested in *BSD
    ... >> This is a typical example of the bloatware that the ports maintainers ... In this case vim is an ... >> editor which is used by programmers and other people, while cscope is a ... > and it won't install cscope by default from port. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: should I use cscope or ctags?
    ... I am using cscope and ctags in Vim. ... You can chase declaration of a function in *.h by [i ...
    (comp.editors)
  • Re: Read the VI source code?
    ... Vim to examine the sources. ... like ctags, ... , or cscope ... I personally prefer the Lucent cscope (it is what we used in the ...
    (comp.editors)