ctags tag address as a line number

567 views Asked by At

I am creating an IDE and I wish to implement jump to definition.

I found the perfect tool for it: ctags (https://github.com/universal-ctags/ctags)

Now the only problem is that the tags file that ctags create looks something like this:

QLineNumberArea 2point56mb.py /^class QLineNumberArea(QWidget):$/;" c

I understand the format: {tagname}Tab{tagfile}Tab{tagaddress}

So from what I understand: tagname: QLineNumberArea, tagfile: 2point56mb.py and tagaddress: /^class QLineNumberArea(QWidget):$/;" c`

The tagaddress looks like gibberish but it's a vim/ex editor command that takes you to the definition.

Now from what I read on this website: https://github.com/cztchoice/ctags/wiki/Tag-Format

Under Security it states:

Specifically, these two Ex commands are allowed:

A decimal line number:

89 A search command. It is a regular expression pattern, as used by Vi, enclosed in // or ??:

/^int c;$/ ?main()?

Now here comes the problem:

I need my tags file to have a line number, instead of the search command. I tried looking the documentation for ctags (http://docs.ctags.io/en/latest/) but I couldn't find anything that would help me.

Does anyone know how make ctags give tag addresses as a line number, rather than a search command?

1

There are 1 answers

0
Vitor On BEST ANSWER

That documentation is only for the changes introduced by universal ctags. What you're looking for is the documentation for exuberant ctags:

−−excmd=type

Determines the type of EX command used to locate tags in the source file. [Ignored in etags mode]

Which can also be achieved with -n.