我正在创建一个IDE,并且希望实现跳转到定义。
我找到了一个完美的工具:ctags(https://github.com/universal-ctags/ctags)
现在唯一的问题是ctags创建的标签文件看起来像这样:
QLineNumberArea 2point56mb.py /^class QLineNumberArea(QWidget):$/;" c
我了解以下格式:{tagname} Tab {tagfile} Tab {tagaddress}
因此,据我了解:tagname
:QLineNumberArea,tagfile
:2point56mb.py和tagaddress
:/ ^ class QLineNumberArea(QWidget):$ /;“ c`
标记地址看起来像胡言乱语,但这是一个vim / ex编辑器命令,可带您进入定义。
现在,根据我在该网站上看到的内容:https://github.com/cztchoice/ctags/wiki/Tag-Format
在Security
下显示:
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()?
现在问题来了:
我需要我的标签文件具有行号,而不是搜索命令。 我尝试查找有关ctags(http://docs.ctags.io/en/latest/)的文档,但找不到任何对我有帮助的东西。
有人知道make ctags如何将标签地址作为行号而不是搜索命令吗?
答案 0 :(得分:0)
该文档仅适用于通用ctag引入的更改。您正在寻找的是exuberant ctags的文档:
−−excmd=type
Determines the type of EX command used to locate tags in the source file. [Ignored in etags mode]
-n
也可以实现。