xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

EasyTags doesn't write to dynamic tag file #89

Closed Lyude closed 9 years ago

Lyude commented 9 years ago

So I've been dealing with a rather tough to debug issue with Easytags. Right now I have easytags set to use any file named "tags" in the same directory that I'm working in. The issue is however, that easytags seems to refuse to write to the file no matter what I do. Even worse, is it doesn't give any sort of errors or messages whatsoever. Even if I set vbs to 1, it shows that easytags only seems to be working with my global tag file for C in ~/.vim/tags/c. No mention is made at all of the dynamic tags file. Here's the settings I have in my .vimrc for Easytags:

set tags=./tags " Project tag files
let g:easytags_dynamic_files = 1
let g:easytags_by_filetype = "~/.vim/tags"

Here's a sample log of me trying to run :UpdateTags, to no avail:

easytags.vim 3.6.4: Executing /usr/bin/exuberant-ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- '--language-force=c' '/home/lyudess/Projects/wayland_wacom/weston/src/input.c'.
vim-misc 1.15: Generated shell expression: (/usr/bin/exuberant-ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- '--language-force=c' '/home/lyudess/Projects/wayland_wacom/weston/src/input.c') 1>'/tmp/v0lzELf/11' 2>'/tmp/v0lzEL
f/12'
vim-misc 1.15: Executing external command using system() function: sh -c '(/usr/bin/exuberant-ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- '\''--language-force=c'\'' '\''/home/lyudess/Projects/wayland_wacom/weston/src/inpu
t.c'\'') 1>'\''/tmp/v0lzELf/11'\'' 2>'\''/tmp/v0lzELf/12'\'''
easytags.vim 3.6.4: Skipping tag without 'language:' field: ['default_pointer_grab_interface', '/home/lyudess/Projects/wayland_wacom/weston/src/input.c', '/^', '', '', '', 'default_pointer_grab_interface = {$/;"', 'v', 'language:C', 'typ
eref:struct:weston_pointer_grab_interface', 'file:']
easytags.vim 3.6.4: Skipping tag without 'language:' field: ['default_keyboard_grab_interface', '/home/lyudess/Projects/wayland_wacom/weston/src/input.c', '/^', '', '', '', 'default_keyboard_grab_interface = {$/;"', 'v', 'language:C', 't
yperef:struct:weston_keyboard_grab_interface', 'file:']
easytags.vim 3.6.4: Skipped 2 lines without 'language:' tag!
easytags.vim 3.6.4: Writing 130 tags to existing tags file /home/lyudess/.vim/tags/c.
vim-misc 1.15: Writing new contents of /home/lyudess/.vim/tags/c to temporary file /home/lyudess/.vim/tags/c.tmp ..
vim-misc 1.15: Generated shell expression: (stat --format %U:%G:%a '/home/lyudess/.vim/tags/c') 1>'/tmp/v0lzELf/14' 2>'/tmp/v0lzELf/15'
vim-misc 1.15: Executing external command using system() function: sh -c '(stat --format %U:%G:%a '\''/home/lyudess/.vim/tags/c'\'') 1>'\''/tmp/v0lzELf/14'\'' 2>'\''/tmp/v0lzELf/15'\'''
vim-misc 1.15: File /home/lyudess/.vim/tags/c has owner lyudess, group lyudess, mode 0644.
vim-misc 1.15: Generated shell expression: (chown 'lyudess':'lyudess' '/home/lyudess/.vim/tags/c.tmp') 1>'/tmp/v0lzELf/17' 2>'/tmp/v0lzELf/18'
vim-misc 1.15: Executing external command using system() function: sh -c '(chown '\''lyudess'\'':'\''lyudess'\'' '\''/home/lyudess/.vim/tags/c.tmp'\'') 1>'\''/tmp/v0lzELf/17'\'' 2>'\''/tmp/v0lzELf/18'\'''
vim-misc 1.15: Generated shell expression: (chmod '0644' '/home/lyudess/.vim/tags/c.tmp') 1>'/tmp/v0lzELf/20' 2>'/tmp/v0lzELf/21'
vim-misc 1.15: Executing external command using system() function: sh -c '(chmod '\''0644'\'' '\''/home/lyudess/.vim/tags/c.tmp'\'') 1>'\''/tmp/v0lzELf/20'\'' 2>'\''/tmp/v0lzELf/21'\'''
vim-misc 1.15: Successfully set /home/lyudess/.vim/tags/c.tmp owner to lyudess, group to lyudess and permissions to 0644.
vim-misc 1.15: Replacing /home/lyudess/.vim/tags/c with /home/lyudess/.vim/tags/c.tmp ..
vim-misc 1.15: Successfully updated /home/lyudess/.vim/tags/c using atomic rename in 0.13 seconds.
easytags.vim 3.6.4: Updated 132 tags in 1.034 seconds (synchronously).
easytags.vim 3.6.4: Highlighted tags in ~/Projects/wayland_wacom/weston/src/input.c in 0.049 seconds (using Python).
xolox commented 9 years ago

Not to ask a (maybe) obvious question, but does the file ~/Projects/wayland_wacom/weston/src/tags already exist when you run that command? If not, did you consider setting g:easytags_dynamic_files to 2 as the documentation suggests?

Lyude commented 9 years ago

~/Projects/wayland_wacom/weston/src/tags doesn't exist, but ~/Projects/wayland_wacom/weston/tags does, and I'm always running gvim with the working directory set to ~/Projects/wayland_wacom/weston/, so shouldn't that be the directory it searches for the tags file in?

xolox commented 9 years ago

I think I spotted 'the bug' here. Vim's 'tags' option is quite subtle, it encodes a lot of information in just a few characters. For example a leading ./ means "local to the current buffer" (not the working directory) and a trailing ; means "search upwards recursively". As the vim-easytags documentation states you should be using exactly this line:

set tags=./tags;

So basically you're missing the trailing ;. I think adding that should resolve your issue.

Lyude commented 9 years ago

Still no go, if I add the ;, and start with a completely blank (but existent) tags file in the working directory, all it does is refuse to highlight or update the tags silently. Doing a du -h of the tags file shows there's nothing written to the file.

Lyude commented 9 years ago

Actually, it looks like if I put a tags file I've made myself with exuberant-ctags, having the ; in the tags option completely breaks it, it doesn't seem to load the tags file at all now, even if it already has tag data written in it.

xolox commented 9 years ago

Two days ago I committed bfe2fed9189be40e729c27aba29544015882b83e which adds verbose logging of tag file selection. Can you update to the latest version, run verbose UpdateTags and post the updated output here?

I'm at a complete loss as to whether the root cause of this issue you're having is a bug (and of so, in vim-easytags, Vim or Exuberant Ctags?) or an issue with documentation (either on your side or mine ;-) so hopefully the verbose logging will help.

Lyude commented 9 years ago

Wow, I'm really sorry it's taken me so long to get back to you on this. I got really busy with school starting up again and forgot all about this. So I've updated easytags to the latest version and the problem's definitely still present. I've ran the command you asked me to run, and here's the output of it:

easytags.vim 3.8.2: Highlighted tags in ~/Projects/wayland_wacom/libinput/src/evdev-tablet.c in 0.018 seconds (using
Python).
Messages maintainer: Bram Moolenaar <Bram@vim.org>
"src/evdev-tablet.c" 702L, 19196C
easytags.vim 3.8.2: Selected global tags file /home/lyudess/.vimtags.
easytags.vim 3.8.2: Executing /usr/bin/exuberant-ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=no -f- '--langu
age-force=c++' '/home/lyudess/Projects/wayland_wacom/libinput/src/evdev-tablet.c'.
vim-misc 1.16.1: Generated shell expression: (/usr/bin/exuberant-ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort
=no -f- '--language-force=c++' '/home/lyudess/Projects/wayland_wacom/libinput/src/evdev-tablet.c') 1>'/tmp/vi6JCVH/8'
 2>'/tmp/vi6JCVH/9'
vim-misc 1.16.1: Executing external command using system() function: sh -c '(/usr/bin/exuberant-ctags --fields=+l --c
-kinds=+p --c++-kinds=+p --sort=no -f- '\''--language-force=c++'\'' '\''/home/lyudess/Projects/wayland_wacom/libinput
/src/evdev-tablet.c'\'') 1>'\''/tmp/vi6JCVH/8'\'' 2>'\''/tmp/vi6JCVH/9'\'''
vim-misc 1.16.1: Writing new contents of /home/lyudess/.vimtags to temporary file /home/lyudess/.vimtags.tmp ..
vim-misc 1.16.1: Replacing /home/lyudess/.vimtags with /home/lyudess/.vimtags.tmp ..
vim-misc 1.16.1: Successfully updated /home/lyudess/.vimtags using atomic rename in 0.0053 seconds.
easytags.vim 3.8.2: Updated 28 tags in 0.065 seconds (synchronously).
easytags.vim 3.8.2: Highlighted tags in ~/Projects/wayland_wacom/libinput/src/evdev-tablet.c in 0.018 seconds (using
Python).

This is after putting the following settings in my .vimrc:

set tags=./.easytags_tags;
let g:easytags_dynamic_files = 1

I literally don't have any other settings related to easytags anywhere in my vimrc. It looks like that easytags just completely ignores the dynamic files setting now.

Lyude commented 9 years ago

Ah, oops, I realized as I came back to this that I was supposed to have g:easytags_dynamic_files set to 2, so I've tried again with:

set tags=./.easytags_tags;
let g:easytags_dynamic_files = 2

And amazingly, it seems to work perfectly on the latest version, finally! :). Not sure what fixed it, but everything definitely works now. I think we can mark this as closed.

xolox commented 9 years ago

Thanks for the follow up and glad to hear it works now. Happy Vimming!