C++ 类似 cscope 的功能(使用vim)

发布于 2024-08-24 18:48:58 字数 142 浏览 6 评论 0原文

是否有任何实用程序或插件可以为 C++ 提供类似 cscope 的功能。我正在寻找对

  • 函数的所有引用
  • 符号全局定义
  • 调用的
  • 的函数
  • 调用函数文件(包括文件)

Is there any utility or plugin which provides cscope like functionality for C++. I am looking for

  • all references to a symbol
  • global definitions
  • functions called by a function
  • functions calling a function
  • files including a file

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

秋意浓 2024-08-31 18:48:58

线程中列出了一些工具, https://www.reddit.com /r/emacs/comments/1qktcb/cscope_like_functionality_that_ Correctly_handles/

其他一些链接

  • https://ruben2020.github.io/codequery/CodeQuery 是项目试图结合 cscope 和 ctags 的可用功能,提供比 cscope 更快的数据库访问(因为它使用 sqlite),并提供一个不错的 GUI 工具。”,有自己的 gui 和 vim 插件 https://github.com/devjoe/vim-codequery;无法生成cscope数据库,但其自带的“CodeQuery sqlite3 db”是由cscope.out转换而来,由pycscope for python生成;适用于 Ruby、Go 和 Javascript 的 starscope;用于 C 和有限 C++ 的原始 cscope;也可以使用标签。
  • https://github.com/cquery-project/cquery “cquery 是一个高度- 适用于 C/C++/Objective-C 的可扩展、低延迟语言服务器。它针对 Chromium 等大型代码库进行了测试和设计,可在不中断工作流程的情况下提供准确、快速的语义分析。”...查找定义/references,使用 clang、C/C++;工作速度非常快,更新速度很快,并且占用大量内存。有vim支持: https://github.com/cquery-project/cquery/wiki/Vim
  • https://www.gnu.org/software/global/ GNU 全球有时建议作为 cscope 的替代品。它“不仅定位定义,还定位引用”,并支持“通过内置解析器支持 6 种语言。(定义和引用):C、C++、Yacc、Java、PHP4 和汇编。”和 Vim 集成: https://www.gnu.org/software/global /globaldoc_toc.html#Vim-editor

还有一些快速(索引)grep,例如 Russ Cox 的代码搜索工具(它也适用于正则表达式 - https://github.com/google/codesearch;示例为 https: //codesearch.debian.net/about) 或任何其他索引 grep...

并且还有交叉引用工具(GUI 和 Web 服务器),例如 LXR 和其他...https://github.com/oracle/opengrok/wiki/Comparison-with-Similar-Tools

There are some tools listed in the thread, https://www.reddit.com/r/emacs/comments/1qktcb/cscope_like_functionality_that_correctly_handles/:

Some other links

  • https://ruben2020.github.io/codequery/ "CodeQuery is a project that attempts to combine the features available from both cscope and ctags, provide faster database access compared to cscope (because it uses sqlite) and provides a nice GUI tool as well.", has own gui and vim plugin https://github.com/devjoe/vim-codequery; can't generate cscope database, but its own "CodeQuery sqlite3 db" is converted from cscope.out, generated by pycscope for python; starscope for Ruby, Go and Javascript; original cscope for C and limited C++; can also use TAGS.
  • https://github.com/cquery-project/cquery "cquery is a highly-scalable, low-latency language server for C/C++/Objective-C. It is tested and designed for large code bases like Chromium. cquery provides accurate and fast semantic analysis without interrupting workflow." ... finding definition/references, with clang, C/C++; very quick work, fast updates and eats a lot of RAM. Has vim support: https://github.com/cquery-project/cquery/wiki/Vim
  • https://www.gnu.org/software/global/ GNU Global is sometimes recommended as cscope replacement. It has "locate not only definitions but also references" and supports " 6 languages by built-in parser. (definition and reference): C, C++, Yacc, Java, PHP4 and assembly." And Vim integration: https://www.gnu.org/software/global/globaldoc_toc.html#Vim-editor

And there are some fast (indexed) greps like Russ Cox’ codesearch tools (It works with regex too - https://github.com/google/codesearch; example is https://codesearch.debian.net/about) or any other indexed grep...

And there are cross ref tools (GUI and web-servers) like LXR and other... https://github.com/oracle/opengrok/wiki/Comparison-with-Similar-Tools

世态炎凉 2024-08-31 18:48:58

Vim 可以开箱即用地直接与 cscope 连接。键入 :h cscope。这需要在编译 Vim 时启用 cscope 功能并将 cscope 安装到您的计算机上。

cscope 网页上有一个 Vim + cscope 教程

Vim can interface directly with cscope out of the box. Type :h cscope. This requires cscope functionality to be enabled when Vim is compiled and for cscope to be installed on your computer.

There is a Vim + cscope tutorial on the cscope web page.

有深☉意 2024-08-31 18:48:58

尝试 YouCompleteMe

它不仅可以为 C 和 C 语言提供代码补全、转到定义和重构功能。 C++,但适用于 Rust、Go、Java、C# 等。

确保按照所述安装它并支持 clangd 这里

Try YouCompleteMe.

It's got code completion, go-to-definition and refactoring not just for C & C++, but for Rust, Go, Java, C# and more.

Make sure to install it with support for clangd as described here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文