Saturday, December 16, 2023

Re: vim9 exported functions not recognized by ctags

this is mine .ctags.d

--kinddef-vim=e,export,function,"Vim 9 exported functions"
--kinddef-vim=f,function,"Vim 9 non-exported functions"
--kinddef-vim=g,global,"Vim 9 global variables"
--kinddef-vim=K,const,Vim 9 constants
--regex-vim=/^\s*export\s+def\s+([^(:]+)/\1/e,export,def/
--regex-vim=/^\s*def\s+([^(]+)/\1/f,function,def/
--regex-vim=/^\s*(g:\w+)\b/\1/g,global/
--regex-vim=/^(\s*export\s+)?const\s+(\w+)/\2/K,const/
--regex-vim=/^(\s*export\s+)?final\s+(\w+)/\2/K,const/

with g:tagbar_type_vim = {'ctagstype': 'vim', 'kinds': ['e:export', 'g:global', 'K:const', 'f:function']}

Hope this helps.
nicolas

Le sam. 16 déc. 2023 à 13:36, Nicolas <nivaemail@gmail.com> a écrit :
Hi Life,

How to get exported and not exported def vim9 functions please according to g:tagbar_type_vim = { 'ctagstype': 'vim', 'kinds': ['e:export'] }?

Thank you
Nicolas
Le mercredi 10 août 2022 à 22:20:52 UTC+2, Lifepillar a écrit :
On 2022-08-10, N V <niva...@gmail.com> wrote:
> Hi,
>
> Exported functions in New vim9 are not found by exubérant ctags, universal
> ctags and not displayed by tagbar plugin
> https://github.com/preservim/tagbar
>
> Is there a work around.

I have the same problem. I think that this will be eventually solved
upstream, but in the meantime the following works for me with Universal
Ctags (I haven't had time to refine this, so what follows is just
a sketch):

1. Create ~/.ctags.d/vim.ctags with the following content:

--kinddef-vim=e,export,exported function
--regex-vim=/^[ \t]*export[ \t]+def[ \t]+([^(]+)/\1/e,export/

2. In your .vimrc, or in your after/ftplugin/vim.vim file, inform Tagbar
about the new entity:

g:tagbar_type_vim = { 'ctagstype': 'vim', 'kinds': ['e:export'] }

Now, Tagbar should display (only) exported functions. Refer to Tagbar
documentation to learn how to *extend* the already recognized entities
by adding exported functions.

Hope this helps,
Life.


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/hp4KeIsDlFU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/260b74f5-7d2e-4446-b87e-a671c493d84an%40googlegroups.com.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4E7ZECZO18xGQ0Yr2GweRnuaJ1aZoObZbpcYKypySKF4w%40mail.gmail.com.

No comments:

Post a Comment