tagbar
tagbar copied to clipboard
Error customizing Go tagbar list
I'm trying to hide packages and imports for Go files. I generate the go type code with :TagbarGetTypeConfig go
which gives me
let g:tagbar_type_go = {
\ 'kinds' : [
\ 'p:package:0:0',
\ 'i:imports:1:0',
\ 'c:constants:0:0',
\ 'v:variables:0:0',
\ 't:types:0:0',
\ 'n:intefaces:0:0',
\ 'w:fields:0:0',
\ 'e:embedded:0:0',
\ 'm:methods:0:0',
\ 'r:constructors:0:0',
\ 'f:functions:0:0',
\ '?:unknown',
\ ],
\ }
However when I delete the package and import line I get this error
Unknown tag kind encountered: "p". Your ctags and Tagbar configurations are out of sync! Please read ':help tagbar-extend'.
I also have https://github.com/jstemmer/gotags installed
Instead of deleting the p:
definition, try changing from package
to unknown
.
Changing to 'p:unknown:0:0',
didn't make it go away in tagbar. I was also wondering, what are the 0:0
numbers for? I looked all over the docs and couldn't find anything.
update: first param looks like it's fold level not sure what 'stl' stands for still
I could just fold them by default, but this is still weird
@nicolas-martin I can't seem to reproduce this. My knowledge of go files is limited, but I created a pretty simple program and use the tagbar_type_go mapping you provided and then removed the packages
and imports
lines and everything went fine for me. I even enabled the tagbar debug logs and did not see any issues.
Can you verify what version of ctags you're using, and maybe include the ctags output for a simple file? I tried with both exhuberant tags, and universal tags.
Here was the go file I used.
package main
import "fmt"
func main() {
fmt.Println("Hello, world.")
}
Here was the VIM config I used.
let g:tagbar_type_go = {
\ 'kinds' : [
\ 'c:constants:0:0',
\ 'v:variables:0:0',
\ 't:types:0:0',
\ 'n:intefaces:0:0',
\ 'w:fields:0:0',
\ 'e:embedded:0:0',
\ 'm:methods:0:0',
\ 'r:constructors:0:0',
\ 'f:functions:0:0',
\ '?:unknown',
\ ],
\ }
I'm running exuberant ctags 5.8 and gotags 1.4.1. Perhaps gotags is what's causing the issue?
Using gotags
should be fully supported. Can you confirm how you setup which one to use? And sent the resulting generated tags file for a sample Go input?