rusty-tags icon indicating copy to clipboard operation
rusty-tags copied to clipboard

Vim can't find recursive tag files

Open thenorili opened this issue 2 years ago • 6 comments

setup:

  • cloned bevy
  • installed universal ctags on Fedora 35
  • ran rusty-tags vi
  • added env var and vimrc lines
  • open neovim in the root directory
  • open ./examples/games/breakout.rs
  • C-] lots of places

I can follow the tag "bevy::sprite" which leads to crates/bevy_internal/src/lib.rs. I can follow tags to other prototypes inside of crates/bevy_internal/src/lib.rs. I can find things inside the standard library with no problem. My autocmds are exactly like the "if you have a $RUST_SRC_PATH".

My uneducated guess is that Vim's not finding the recursively-created tag files and adding them to the tags variable. My tags variable is below.

tags=./rusty-tags.vi;/,~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rusty-tags.vi

thenorili avatar May 15 '22 18:05 thenorili

You're telling what works, but not what doesn't work.

I never tested it with neovim. The whole "magic" of recursive tags files is the tags setting './rusty-tags.vi;/', which searches for a opened file for a tags file, starting at the directory of the file going upwards the directory tree. I don't know if neovim supports this setting.

dan-t avatar May 16 '22 08:05 dan-t

ah, I'm sorry! That pattern definitely works with neovim, no change. What doesn't work is "every other tag". Nothing actually goes to its definition.

Like, consider:

$ROOT/examples/games/breakout.rs is going up, but not down. When I build the tags each individual crate at $ROOT/crates/* gets its own tags file, but there's no reference from the root file to those dependencies even when they're formally declared, all that it finds is the prototypes in $ROOT/src/lib.rs and the standard library stuff.

thenorili avatar May 20 '22 00:05 thenorili

I think I know what your problem is.

All these separate crates in the bevy engine are independent of each other, they aren‘t dependencies of each other. Therefore the tag files of each crate don‘t contain/know anything about the other crates and you can‘t jump to them.

It‘s like having several rust cargo projects. If they don‘t depend on each other you can‘t jump between them.

But if you e.g. create your own game, which depends on several bevy crates, you‘ll get tags for them and can jump to them.

dan-t avatar May 24 '22 14:05 dan-t

The example program does have dependencies on several bevy crates which it declares explicitly. However, the tags can't find those dependencies. They can find the lib.rs with prototypes for some stuff, but they can't find the actual source.

thenorili avatar May 26 '22 18:05 thenorili

The problem is how bevy defines the sprite module:

pub mod sprite {
    //! Items for sprites, rects, texture atlases, etc.
    pub use bevy_sprite::*;
}

The ctags program doesn't understand this definition, which includes all the definitions from bevy_sprite and therefore also can't create tags for them.

dan-t avatar May 27 '22 12:05 dan-t