Friday, December 29, 2023

Re: vim9 exported functions not recognized by ctags

With exported vim9 function distinction :)

g:tagbar_type_vim in a json.
  "g:tagbar_type_vim": "{ 'kinds': [ 'L:classes', 'e:exported functions', 'f:functions and methods', 'v:variables:1:0', 'g:global variables', 'K:constants', 'c:commands:0:0', 'a:autocommand groups:1', 'm:maps:1:0', ], }",

vim.ctags
--kinddef-vim=e,vim9exportedfunc,Vim 9 global variables
--kinddef-vim=g,vim9global,Vim 9 global variables
--kinddef-vim=K,vim9const,Vim 9 constants
--kinddef-vim=L,vim9class,Vim 9 class
--kinddef-vim=I,vim9interface,Vim 9 interface
--regex-vim=/^export\s+def\s+([^(]+)/\1/e/
--regex-vim=/^def\s+([^(]+)/\1/f/
--regex-vim=/^\s*(g:\w+)\b/\1/g,vim9global/
--regex-vim=/^(export\s+)?(const|final)\s+(\w+)/\3/K,vim9const/
--regex-vim=/^\s*(export\s+)?(abstract\s+)?class\s+(\w+)/\3/L,vim9class/
--regex-vim=/^\s*(export\s+)?interface\s+(\w+)/\2/I,vim9interface/



On Friday 29 December 2023 at 10:09:22 am UTC+1 Nicolas wrote:
It works perfectly Life even if there is no disctinction between exported vim9 func and the other func. 
;)
Thank you I keep your
I wish you a happy holiday season
Nicolas

On Tuesday 19 December 2023 at 12:08:58 am UTC+1 Lifepillar wrote:
On 2023-12-16, Nicolas <niva...@gmail.com> wrote:
> 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

That should work, shouldn't it? Or what is your issue with it?

My current vim.ctags looks like this:

--kinddef-vim=g,vim9global,Vim 9 global variables
--kinddef-vim=K,vim9const,Vim 9 constants
--kinddef-vim=L,vim9class,Vim 9 class
--kinddef-vim=I,vim9interface,Vim 9 interface
--regex-vim=/^export\s+def\s+([^(]+)/\1/f/
--regex-vim=/^\s*(g:\w+)\b/\1/g,vim9global/
--regex-vim=/^(export\s+)?(const|final)\s+(\w+)/\3/K,vim9const/
--regex-vim=/^\s*(export\s+)?(abstract\s+)?class\s+(\w+)/\3/L,vim9class/
--regex-vim=/^\s*(export\s+)?interface\s+(\w+)/\2/I,vim9interface/

That works with Universal Ctags 6.0.0, as confirmed by:

uctags --list-kinds=Vim

which outputs:

a autocommand groups
c user-defined commands
f function definitions
m maps
v variable definitions
n vimball filename
C constant definitions
g Vim 9 global variables
K Vim 9 constants
L Vim 9 class
I Vim 9 interface

In my `vimrc` I set the path to the executable:

g:tagbar_ctags_bin = '/opt/local/bin/uctags'

and for Vim tags:

g:tagbar_type_vim = {
'kinds': [
'L:classes',
'f:functions and methods',
'v:variables:1:0',
'g:global variables',
'K:constants',
'c:commands:0:0',
'a:autocommand groups:1',
'm:maps:1:0',
],
}

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 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/19319839-9fd9-4310-8bac-5efa01a8c504n%40googlegroups.com.

No comments: