yuki-yano/fzf-preview.vim

[Feat] Custom buffer tags command

AdrienLemaire opened this issue · 6 comments

The current tags command doesn't seem to be customizable, and will fail to load tags for some filetypes like typescripreact

I could get my tags loaded by modifying the ~/.config/coc/extensions/node_modules/coc-fzf-preview/lib/index.js file as follow:

- exports.BUFFER_TAGS_COMMAND = "ctags -f - --sort=yes --excmd=number";
+ exports.BUFFER_TAGS_COMMAND = "ctags -f - --languages=typescript --langmap=typescript:.ts.tsx --sort=yes --excmd=number";

It would be great if we could define this in our vimrc

augroup typescriptreact "{{{
    autocmd!
    " autocmd FileType typescript.tsx,typescriptreact let g:buffer_tags_command = 'tstags -f-'
    autocmd FileType typescript.tsx,typescriptreact let g:buffer_tags_command = 'ctags -f - --languages=typescript --langmap=typescript:.ts.tsx --sort=yes --excmd=number'
augroup end "}}}

Thank you.
I'll try to make it configurable when I have time.

Sorry for the delay.

I just checked, and I think the latest ctags support TypeScript by default.
Could you try that first?

Hi @yuki-ycino and thanks for the reply.
It looks like the arch linux package is quite outdated, so I asked about that in their forum. Wait and see.

Or can't you work around it by writing the configuration in ~/.ctags.d/config.ctags?

@yuki-ycino I tried building the latest ctags version, and it doesn't support typescriptreact out of the box.

Adding --map-TypeScript=+.tsx in ~/.ctags.d/config.ctags seems to have done the trick.

Thank you.
I'm going to close this since it seems to have been resolved.