jsfaint / gen_tags.vim

Async plugin for vim and neovim to ease the use of ctags/gtags
https://vim.sourceforge.io/scripts/script.php?script_id=5499
MIT License
312 stars 42 forks source link

gen_tags doesn't seems to work at all #46

Closed huyvohcmc closed 6 years ago

huyvohcmc commented 6 years ago

I have installed gen_tags and try it with a medium size project (500 MB). Here's my settings:

let g:loaded_gentags#gtags = 1
let g:gen_tags#ctags_auto_gen = 1
let g:gen_tags#use_cache_dir = 0
let g:gen_tags#blacklist = ['*.min.js', '*.min.css', 'build', 'vendor', '.git', 'node_modules', '*.vim/bundle/*']

When I open the project, there is nothing happen, I try to use Ctrl + ] and neovim results with "no tags file". I thought ctags_auto_gen will automatically generate tags file, no? :GenCtags doesn't do anything, and neither <project folder>/.git/tags_dir or $HOME/.cache/tags_dir/<project name> exists, even tho my project use git.

Here is my init.vim if that help: https://github.com/huyvohcmc/dotfiles/blob/master/init.vim

jsfaint commented 6 years ago
  1. g:gen_tags#ctags_auto_gen it only works for git/svn/hg repository. If you don't have it, you will need to run :GenCtags manually.
  2. gen_tags#blacklist only for ignore some folder like $HOME, it is still very limited.
  3. Because your codebase is large, it will takes some time to generate tags in background. So please don't exit vim before it finished.
  4. You can enable verbose mode to see the output of ctags by let g:gen_tags#verbose = 1
huyvohcmc commented 6 years ago

My project is a git repository, it's weird that ctags_auto_gen doesn't work. Is there any way I can use the status line to see the tag generation process?

jsfaint commented 6 years ago

Which OS do you use? You can check the process manager, if there is a process called ctags. And also, if you run :!ctags, what do you get?

huyvohcmc commented 6 years ago

I'm using mac os, and by using verbose I can see that the tag generating process does actually work (it just took longer than I thought).

However, it is still a little bit unclear to me, I don't want to open the process manager just to see if gen_tags has done its job. In vim-gutentags you can set up the status line to show something like [ctags] when it starts tag generating and disappear when it's done.

If we have that feature it'll be great because I can get rid of the annoying verbose messages every time I enter Vim.

jsfaint commented 6 years ago

Thanks for advice, I think maybe I can add a feature to display the status on statusline. But I don't have time to do this right now.

rslindee commented 6 years ago

FYI - I use lightline instead of airline and it looks like these latest changes generate the following errors when attempting to run GenGTAGS without airline installed:

Error detected while processing function 50_gtags_db_gen[32]..gen_tags#system_async[15]..51_job_start[1]..gen_tags#statusline#set: line 9: E121: Undefined variable: w:airline_active E15: Invalid expression: w:airline_active == 1

It may be advisable to set the default of g:gen_tags#statusline to 0 and mention its dependency on airline in the documentation.

Personally, I'd like to have something more generic (maybe generate an event when tags generation starts and another event when they stop so that users without a statusline plugin can see the status?)

jsfaint commented 6 years ago

@rslindee Oh, sorry for the inconvenience. I'll fix it later. It's not based on airline, it's just need to disable airline.

jsfaint commented 6 years ago

Fixed. @rslindee Can you kindly help to test if it works with lightline now? Thanks!

rslindee commented 6 years ago

@jsfaint - This indeed fixes the error when I attempt to generate GTAGS. With that said, I now get the message:

gen_tags.vim Generate tags in background, please stand by...

This message stays permanantly, even after the gtags file has been correctly generated and the operation is finished (this is a pretty small project I'm testing with). This even occurs when I have my lightline plugin disabled entirely. Refreshing via ctrl-l doesn't help, either. This is using Vim 8.1.

Also, one minor grammatical note, the correct phrasing would be "Generating tags in background, please stand by..."

jsfaint commented 6 years ago

@rslindee Thanks for your testing. I'll correct the phrasing and disable statusline by default. Sorry, I'm not native, may English sucks as always 😆

I tested with neovim, it works. I'll test with vim later. Which OS do you use for?

jsfaint commented 6 years ago

@rslindee It looks statusline feature still have many issue I need to rollback the master branch, and create a branch for it. Please fetch it and reset to origin/master. I'm sorry..

git fetch
git reset --hard origin/master
rslindee commented 6 years ago

No worries at all! Thanks for putting this feature on a branch in the meantime.

I'm running this on Linux (Arch and Fedora, specifically). Both appear to be having similar behavior from what I've seen.

jsfaint commented 6 years ago

@rslindee I just fixed the issue that you mentioned above

This message stays permanantly, even after the gtags file has been correctly generated and the operation is finished (this is a pretty small project I'm testing with).

That's because I forget to handle the exit callback of global -u command, it is for gtags update.

Could you have a try? Thank you 😄

rslindee commented 6 years ago

@jsfaint - I just tested with the statusline branch. My test project is pretty small, so I only see a brief flash of the message, but it looks to be behaving correctly for me!

I think we're good. Great work on the fix.

jsfaint commented 6 years ago

@rslindee Thanks for your great help! I'll merge it later.

Another question: should I enable this feature by default? Does it intrusive to you?