Open rgrinberg opened 6 years ago
What do you want to accomplish?
The only way to find a project root is global -pr
and the rest are guesses.
I think the goal would be for projectile
to tell ggtags
the location of the project root after having identified it (for example using the .projectile
file).
@arichiardi has the right idea. But basically, the main use case is for ggtags-create-tags
to stop prompting me for the project root when it's available via projectile.
ggtags-create-tag
always prompts even when it knows for sure a global
root is in place. This is to create subprojects. For example, if you have a large source tree but only need to work within a subdirectory for some bug or feature.
Often one doesn't want to index from the repo root but some subdirectory of it, most notably src/
. Starting from default-directory
gives the user vital context clue where they are.
ggtags-create-tag
is not a frequent command so it can survive being a little verbose.
These were the few considerations that made ggtags-create-tag
what it is today. But that doesn't mean it can't be changed.
Any news on this /new consideration on this?
I actually see why ggtags-create-tags
is like this now, my GTAGS
is 400 MB :smile: because it basically indexing the whole node_modules
folder. Which is maybe good, maybe not?
Not convinced the root mechanics should change now because otherwise in my specific case it would mean to re-index (incremental yes, but still) the whole node_modules
every time, while if root is in src
then I am good.
Maybe use something like the following (replace PROJECTILE-ROOT
):
(define-advice ggtags-ensure-project (:around (_orig) projectile)
(or (ggtags-find-project)
(progn (ggtags-create-tags PROJECTILE-ROOT)
(ggtags-check-project))))
I am not fully understanding the use case though. I rarely get prompted once a project is initiated. I left the GTAGS files in some projects for as long as 5 years.
BTW, 400M is a lot. For comparison the linux kernel is about 125M if I remember correctly.
I also don't get propmted once the project is initiated but it's a bit annoying if I'm cloning a new project and would like to immediately explore it.
Another option would be to have ggtags use the projectile project root as the prompt default when it's available.
@leoliu unfortunately the node_modules
mechanics allow for a lot of duplication, I am not a js dev (ClojureScript!) and I will be trying to find a way to exclude those files for sure.
@rgrinberg I suggest using the define-advice
solution to glue ggtags
and projectfile
together for now. The reason I am a bit hesitant is because current ggtags-create-tags
is not (very) inconvenient and accommodates more use cases. But i'll see if we need to introduce a function to guess project root.
@arichiardi you can copy gtags.conf to your project root and modify it to skip node_modules
.
Many users of ggtags user projectile as well. It would be nice if ggtags could rely on projectile's detection capability when it's available. I can try and implement this if it's deemed desirable.