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

tagbar doesn't recognize fast-tags output

Open osa1 opened this issue 6 years ago • 2 comments

I'm trying to add tagbar support for fast-tags. So far what I got is:

let g:tagbar_type_haskell = {
    \ 'ctagsbin'  : 'fast-tags',
    \ 'ctagsargs' : '-o-',
    \ 'kinds'     : [
        \  'm:modules:0:0',
        \  'c:classes:0:1',
        \  't:types:0:1',
        \  'C:constructors:0:1',
        \  'p:patterns:0:1',
        \  'o:operators:0:1',
        \  'f:functions:0:1'
    \ ],
    \ 'sro'        : '.',
    \ 'kind2scope' : {
        \ 'm' : 'module',
        \ 'c' : 'class',
        \ 'd' : 'data',
        \ 't' : 'type'
    \ },
    \ 'scope2kind' : {
        \ 'module' : 'm',
        \ 'class'  : 'c',
        \ 'data'   : 'd',
        \ 'type'   : 't'
    \ }
\ }

With this I can get a list of tags in a Haskell file. However, it seems like tagbar can't parse location information from the fast-tags output so I can't jump to a tag's location from the tag bar or can't show current tag in the status line.

It works with hasktags so I compared outputs. for the same tag this is what fast-tags generates:

writeetagsfile	src/Tags.hs	175;"	f

This is what hasktags generates

writeetagsfile	src/Tags.hs	/^writeetagsfile :: Handle -> [FileData] -> IO ()$/;"	ft	signature:(Handle -> [FileData] -> IO ())	line:175	language:Haskell

It seems to me that we need to add the line number after f, like

writeetagsfile	src/Tags.hs	175;" line:175 language:Haskell

but I'm not sure as this stuff is not documented anywhere.

Any ideas? Possibly related: #19.

osa1 avatar Jun 29 '18 07:06 osa1

It looks like just the f is an older syntax for kind:f. Probably vim makes x:y stuff available to plugins. This should be easy to add, but to avoid trial and error, can you test that tagbar like a line like the below:

writeetagsfile	src/Tags.hs	175;" kind:f line:175 language:Haskell

elaforge avatar Jul 08 '18 16:07 elaforge

BTW, fast-tags suppresses adjacent tags with the same name, so e.g. data T = T emits just one tag, not two. But that may not be appropriate for a type-oriented browsing thing, which tagbar looks like. If you get tagbar working and the suppression is getting in the way I can add a flag to turn that off.

elaforge avatar Jul 09 '18 00:07 elaforge