Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "west gtags" extension #85984

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mbolivar
Copy link
Contributor

I might be a dinosaur, but I just love indexing and searching large C code bases with GNU Global.

I've been doing it for years and have provided references on how to integrate it with west to users who ask how I search for code for years now.

I think it might be useful to have this as an out of the box feature, so add a "west gtags" command that indexes the workspace for source files and creates a global tags file that you can use to find function definitions with it. Hopefully the associated documentation commit makes the use cases clear.

@mbolivar
Copy link
Contributor Author

mbolivar commented Feb 19, 2025

Note that this is similar in spirit to the Linux build system's "make gtags" command, except this searches the entire workspace. This is very useful to me as a maintainer because it can be used to index all the symbol definitions everywhere, not just for a single application build or something like that the way an LSP server might offer.

@mbolivar mbolivar force-pushed the west-gtags branch 3 times, most recently from 419d930 to 2f18757 Compare February 19, 2025 08:51
This is an extension for indexing the source code in the workspace
with GNU Global. See the command line help for more information about
Global.

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
Document this command's existence, provide basic usage, and describe
the locations of resources where additional help etc. should be found.

Signed-off-by: Martí Bolívar <marti.bolivar@oss.qualcomm.com>
Copy link
Collaborator

@pdgendt pdgendt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks cool, I need to take a closer look at a GNU globals compatible setup for my neovim configuration 😅. Using fzf all the time is time consuming.

@carlescufi
Copy link
Member

This looks cool, I need to take a closer look at a GNU globals compatible setup for my neovim configuration 😅. Using fzf all the time is time consuming.

Same here! I use fzf for everything but I think I will give globals a chance now that @mbolivar has integrated the tag generation into west.

@pdgendt
Copy link
Collaborator

pdgendt commented Feb 19, 2025

Ouch

~/zephyrproject $ du -hs G*
42M     GPATH
1.2G    GRTAGS
2.7G    GTAGS

@nashif
Copy link
Member

nashif commented Feb 19, 2025

Ouch

~/zephyrproject $ du -hs G*
42M     GPATH
1.2G    GRTAGS
2.7G    GTAGS

is this tagging the complete workspace?

@pdgendt
Copy link
Collaborator

pdgendt commented Feb 19, 2025

is this tagging the complete workspace?

Yes, zephyr main with optional modules active.

@nashif
Copy link
Member

nashif commented Feb 19, 2025

Yes, zephyr main with optional modules active.

no wonder then, I use ctags per git repo usually, and that is manageable, but I guess it makes sense to work on the workspace, if the workspace is "managed" and not everything.

btw, wondering if the large data set impacts performance of vim for example, or any editor...

@mbolivar
Copy link
Contributor Author

mbolivar commented Feb 19, 2025

Yep, as documented in the global page, the tags files are quite large. But the search is nearly instant, and I don't notice any perf degredations either at the command line or within emacs (which is where I normally use global -- via helm-gtags.el)

@kartben kartben added this to the v4.2.0 milestone Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants