Open AaronM04 opened 5 years ago
I believe this is not a Tagbar bug because the command line arguments Tagbar calls ctags
with lists a file inside rust.vim:
ctags -f - --format=2 --excmd=pattern --fields=nksSaf --extra= --file-scope=yes --sort=no --append=no --options=/home/x/.vim/bundle/rust.vim/ctags/rust.ctags --language-force=rust --rust-kinds=Tfgsmcti /tmp/vxydnhY/8.rs
Suppose /tmp/vxydnhY/8.rs
contains this:
#[derive(Debug)]
struct A {
x: i64,
y: f32,
}
impl A {
fn get_x(&self) -> i64 {
x
}
fn get_y(&self) -> f32 {
y
}
}
fn main() {
let a = A { x: 3, y: 5 };
println!("a is {:?}", a);
}
The output of the ctags
command above would be this:
A /tmp/vxydnhY/8.rs /^struct A {$/;" s line:2
A /tmp/vxydnhY/8.rs /^struct A {$/;" s line:2
A /tmp/vxydnhY/8.rs /^impl A {$/;" i line:7
A /tmp/vxydnhY/8.rs /^impl A {$/;" i line:7
get_x /tmp/vxydnhY/8.rs /^ fn get_x(&self) -> i64 {$/;" f line:8
get_x /tmp/vxydnhY/8.rs /^ fn get_x(&self) -> i64 {$/;" f line:8
get_y /tmp/vxydnhY/8.rs /^ fn get_y(&self) -> f32 {$/;" f line:12
get_y /tmp/vxydnhY/8.rs /^ fn get_y(&self) -> f32 {$/;" f line:12
main /tmp/vxydnhY/8.rs /^fn main() {$/;" f line:17
main /tmp/vxydnhY/8.rs /^fn main() {$/;" f line:17
For comparison, Tagbar's Go support looks good. Tagbar runs a command like this to get the tags:
gotags -sort -silent test.go
Contents of the above file:
package main
import "fmt"
type A struct {
x int64
y float32
}
func (a *A) getX() int64 {
return a.x
}
func (a *A) getY() float32 {
return a.y
}
func main() {
a := A{x: 3, y: 5}
fmt.Printf("a.x is %d\n", a.getX())
fmt.Printf("a.y is %f\n", a.getY())
}
The output of the gotags
command above would be this:
!_TAG_FILE_FORMAT 2
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted/
!_TAG_PROGRAM_AUTHOR Joel Stemmer /stemmertech@gmail.com/
!_TAG_PROGRAM_NAME gotags
!_TAG_PROGRAM_URL https://github.com/jstemmer/gotags
!_TAG_PROGRAM_VERSION 1.4.1 /go1.11.4/
A test.go 5;" t access:public line:5 type:struct
fmt test.go 3;" i line:3
getX test.go 10;" m access:private ctype:A line:10 signature:() type:int64
getY test.go 14;" m access:private ctype:A line:14 signature:() type:float32
main test.go 18;" f access:private line:18 signature:()
main test.go 1;" p line:1
x test.go 6;" w access:private ctype:A line:6 type:int64
y test.go 7;" w access:private ctype:A line:7 type:float32
Steps to reproduce:
:Tagbar
Expected vs. actual behavior:
Expected: methods grouped by struct/trait, with no duplicates. Also I expected fields to be listed with public/private indicators.
Actual: methods and top-level functions are mixed together, and each appears twice. No fields are visible for the structs.
Paste debugging info from the Rust Vim plugin via one of the following commands:
:RustInfo
,:RustInfoToClipboard
, or:RustInfoToFile <filename>
.