ctags - ctags 将地址标记为行号
问题描述
我正在创建一个 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`
tagaddress 看起来像乱码,但它是一个 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/),但找不到任何可以帮助我的东西。
有谁知道如何让 ctags 将标签地址作为行号而不是搜索命令提供?
解决方案
该文档仅适用于通用 ctags 引入的更改。您正在寻找的是exuberant ctags的文档:
−−excmd=type
Determines the type of EX command used to locate tags in the source file. [Ignored in etags mode]
这也可以通过-n
.
推荐阅读
- php - 如何在 Laravel 8 中设置 AWS SES 身份
- excel - 我需要帮助突出显示谷歌表格中两列之间重复文本的单元格
- networking - 不同端口的不同名称
- python - 类能做什么而函数不能?(Python)
- c++ - 在cpp中如何处理guillemets,即«和»?
- c# - 无法将类型“Microsoft.Extensions.Hosting.IHost”隐式转换为“Microsoft.Extensions.Hosting.IHostBuilder”
- latex - 在latex tikz中的矩形内的文本中引入换行符
- rust - 我应该如何为 Rust 中的 Struct 中的每个字段干燥重复的统计计算?
- python - QGroupBox 内的 QPaint
- c# - 基于 Serilog WPF 的应用程序可以工作,但作为 EXE 安装时不能