如何让 emacs Semantic 使用 GTAGS 生成的 TAG 文件
我的emacs版本是23.2.1 虽然我使用以下命令将后端更改为使用 GTAGS。 (需要“语义/数据库全局”) (semanticdb-enable-gnu-global-databases'c-模式) (semanticdb-enable-gnu-global-databases'c++-模式) 我尝试生成一个 GTAGS 文件用作语义后端。 但是,每次我打开 C 文件时,Semantic 仍在解析文件而不使用 GTAGS 文件。
是否可以使用GTAGS文件代替内置的语义解析器?我发现内置的解析器不太准确。
是否可以在不指定项目范围的情况下使用 GTAGS 文件?就我而言,我尝试将 GTAGS 文件放在 /usr/include 中,这应该是 emacs 的标准包含路径。但是 Semantics 没有使用它。
My emacs version is 23.2.1
Although I used the following to change the backend to use GTAGS.
(require 'semantic/db-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)
I tried to generate a GTAGS file to be used as a backend of semantic.
However, everytime when I open a C file, Semantic is still parsing files without using the GTAGS file.
Is it possible to use the GTAGS file instead of the built-in parser of semantic? I found that the built-in parser is not very accurate.
Is it possible to use the GTAGS file without specifying the project scope? In my case, I tried to put GTAGS file in /usr/include which should be the standard include path of emacs. But Semantics is not using it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Semantic 不使用 GTAGS 文件来生成标签,它将直接用于跳跃或智能完成等功能。 GNU Global 语义数据库后端将使用 GTAGS 作为一个巨大的名称表。因此,如果您需要按名称查找符号,GTAGS 将告诉语义它在哪里,然后语义将更直接地解析这些文件本身以获取详细信息。
GTAGS 不直接用作替换解析器的原因是 GTAGS 中的信息不足以满足语义所需的操作类型,因为它不包括数据类型信息、参数解析和本地上下文解析。
在 /usr/include 中使用 gtag 是一个有趣的想法,但可能不会被太多使用。 Semantic 将仅搜索代码中实际使用的头文件,而不是搜索所有包含文件。 GNU Global 后端专门用于扫描整个项目中的符号或符号引用。如果您想搜索所有包含的符号,那么它会很有用,但目前 Semantic 中没有这样的功能。
可以使用 ebrowse 来做你想做的事情,但我发现对于 C++,解析器在一些微妙的方面是不够的,并导致了一些问题。
如果您认为语义解析器不准确,那么您应该将其作为错误发布在 cedet-devel 邮件列表上。
Semantic doesn't use the GTAGS file for generating tags that it will use directly for features such as jumping or smart completion. The GNU Global backend to semantic db will use GTAGS instead as a giant name table. Thus if you need to find a symbol by name, GTAGS will tell semantic where it is, and Semantic will then parse those files itself more directly to get the details.
The reason GTAGS is not used directly as a replacement parser is because the information in GTAGS is insufficient for the kinds of operations Semantic needs, as it excludes datatype info, argument parsing, and local context parsing.
Using gtags in /usr/include is an interesting idea, but would probably not get used much. Semantic will only search header files actually used in your code instead of searching all include files. The GNU Global backend is specifically for scanning an entire project for a symbol, or symbol references. If you wanted to search all your includes for a symbol, then it would be useful, but there is no such feature in Semantic at this time.
It is possible to use ebrowse to do what you want, but I found that for C++, the parser was insufficient in subtle ways, and caused some problems.
If you think the Semantic parser is inaccurate, then you should post that as a bug on the cedet-devel mailing list.