LeaderF icon indicating copy to clipboard operation
LeaderF copied to clipboard

Does gtags sub-command follow Lf_WorkingDirectoryMode?

Open xaljer opened this issue 4 years ago • 9 comments

  • vim or neovim?
    • [ ] vim
    • [x] neovim
  • Output of vim --version or nvim --version:
  • Output of :echo has("python"):
  • Output of :echo has("python3"):
  • Output of :echo &pythondll(only vim, not neovim):
  • Output of :echo &pythonthreedll(only vim, not neovim):
  • Output of :py print(sys.version):
  • Output of :py3 print(sys.version):
  • Output of :echo g:Lf_Debug_Cmd:
  • Output of :echo g:Lf_FilesFromCache:
  • Operating system:
    • [x] Linux
    • [ ] Mac OS X
    • [ ] Windows
    • [ ] Etc.
  • Configurations related to LeaderF in vimrc: let g:Lf_RootMarkers = ['.root'] let g:Lf_WorkingDirectoryMode = 'c'

Describe your question, feature request, or bug.

I found that Leaderf gtags seems to learn the directory of gtags db files by root markers at vim startup. If I set a root marker which does not indicate the right db files location, Leaderf gtags can not work any more even i give the right root marker again.

For my uncommon usages, I wish to change root markers at run time to make Leaderf rg searching in different directories. And the default root marker may not be the one in directory which gtags indexed.

In the others words, it's better if leaderf file, rg, gtags working in different scope in some huge code base like AOSP. In my example, leaderf file and gtags (without pygments) can work fine in the whole project scope. But it's better to make rg work my real working directory, only searching in whole project in some cases. So, there is an option: g:Lf_WorkingDirectoryMode to specify the leader file behaviors, but i don't know if leaderf gtags follow it too?

In short, does the behaviors i described as designed? and can leaderf gtags always works on 'pwd' if g:Lf_WorkingDirectoryMode == 'c'?

Steps to reproduce

Actual behaviour

leaderf gtags learn working directory by root marks at startup even if let g:Lf_WorkingDirectoryMode = 'c'.

Expected behaviour

leaderf gtags works on 'pwd' when let g:Lf_WorkingDirectoryMode = 'c' no matter what root markers are.

xaljer avatar May 23 '20 15:05 xaljer

Leaderf gtags does not respect g:Lf_WorkingDirectoryMode, no matter what value g:Lf_WorkingDirectoryMode is, it always works like g:Lf_WorkingDirectoryMode == 'c' . But the value of g:Lf_RootMarkers will affect it.

Yggdroot avatar May 24 '20 01:05 Yggdroot

@Yggdroot , thanks, but it looks like not very consistent, right? If g:Lf_RootMarkers will affect gtags, it's not conform to the definition of c mode. It's better to have a separate mode option for gtags? Are there some other sub-commands need working directory mode?

xaljer avatar May 24 '20 02:05 xaljer

For my uncommon usages, I wish to change root markers at run time to make Leaderf rg searching in different directories.

Why do you change root markers at run time? Maybe you are not using Leaderf rg correctly.

Yggdroot avatar May 25 '20 11:05 Yggdroot

  1. there are 3 cases: a. search in whole project like: Leaderf rg "something". b. search in some sub directory like: Leaderf rg "something" a/sub/directory c. search in the git repository of current file. I don't know the git root directory to tell rg.
  2. Leaderf bar can give me a hint on I'm searching which directory.

xaljer avatar May 26 '20 02:05 xaljer

I will fix the issue with the solution that Leaderf gtags uses the value of g:Lf_RootMarkers when Leaderf gtags is first time launched, and the change of g:Lf_RootMarkers later won't affect Leaderf gtags, do you agree?

Yggdroot avatar May 30 '20 02:05 Yggdroot

@Yggdroot , I think this solution won't solve my problem. My expected behaviour is that Leaderf gtags always follow pwd. For more clearly behaviour, I think that Leaderf gtags use pwd or g:Lf_ RootMarkers should depends on Lf_WorkingDirectoryMode or a new one special for gtags.

xaljer avatar May 30 '20 03:05 xaljer

Leaderf file/gtags/rg learn the pwd or root markers every time they lunch is the most flexible design, i think.

xaljer avatar May 30 '20 04:05 xaljer

In my case let g:Lf_WorkingDirectoryMode and let g:Lf_RootMarkers does not work at all. | I have many related projects and want to use root at parent folder with .projectRoot file there, whereas each folder inside has .git .

I set up let g:Lf_RootMarkers = ['.projectRoot'] and let g:Lf_WorkingDirectoryMode = 'ac' and it does't work - always start from current dir. Event let g:Lf_WorkingDirectory = expand('%:p:h') from .lvimrc doesn't work

as79-alex avatar Jun 11 '21 07:06 as79-alex

In my case let g:Lf_WorkingDirectoryMode and let g:Lf_RootMarkers does not work at all. | I have many related projects and want to use root at parent folder with .projectRoot file there, whereas each folder inside has .git .

I set up let g:Lf_RootMarkers = ['.projectRoot'] and let g:Lf_WorkingDirectoryMode = 'ac' and it does't work - always start from current dir. Event let g:Lf_WorkingDirectory = expand('%:p:h') from .lvimrc doesn't work

It should work, there must be something wrong with your configuration.

Yggdroot avatar Jun 11 '21 08:06 Yggdroot