preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.1k stars 485 forks source link

vim9 exported functions not displayed by tagbar #828

Closed niva-xx closed 1 year ago

niva-xx commented 1 year ago

Since vim9script, some export def functions are allowed and not displayed by tagbar. Ctags or universal ctags seem to detect only legacy vimscript function.

Is there a possible work around ? Thank you Nicolas

raven42 commented 1 year ago

If universal ctags does not recognize vim9script yet, then the only option would be to create a regex parser for universal ctags and then define a custom file type for vim9script.

niva-xx commented 1 year ago

5 sur 14072

vim9 exported functions not recognized by ctags

18 vues

S'abonner 

N V

10 août

Hi, Exported functions in New vim9 are not found by exubérant ctags, universal ctags and not

Lifepillar

10 août

On 2022-08-10, NV nivaemail@gmail.com wrote: > Hi, > > Exported functions in New

Lifepillar

11 août

On 2022-08-10, Lifepillar lifepillar@lifepillar.me wrote: > On 2022-08-10, NV <

Lifepillar

11 août

Aah, the line for global vars got cut off the Ctags config: --kinddef-vim=e,export,Vim 9 exported

N V

11 août

Thank you a lot Amazing Man LifePillar , Migh take account on the possibility of extended that ctags

Lifepillar

11 août

à vim_use

On 2022-08-11, N V niva...@gmail.com wrote:

So I put it in somewhereOvertherainbow\Vim\vim90.ctags.d

If you put Ctags configuration there, does ctags --list-kinds=vim still use it?

But it seems to not runnning well : does not displays vim9 exported functions

I'm afraid I can't help you with Windows-specific configuration, as I'm not using Windows.

Life.

Le message a été supprimé

Le message a été supprimé

Le message a été supprimé

N V

12 août

à vim_use

And YES It Is !!  :)

Windows configuration of vim9script  ctags extension

1/ In your $MYVIMRC ~_vimrc (here vim9script) just put these lines :

g:tagbar_type_vim = {        kinds: [

          \ 'a:autocommand groups:1',           \ 'c:commands:0:0',

          \ 'e:exported defs',           \ 'f:functions',           \ 'g:global variables',           \ 'K:constants',

          \ 'm:maps:1:0',

          \ 'n:vimball filenames',           \ 'v:variables:1:0',

      \ ], }

2/ In your $vimruntime ~ vim90 folder where there is ctags.exe v5.9 just add  file in folder .ctags.d/vim.ctags

--kinddef-vim=e,export,Vim 9 exported defs --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/

--regex-vim=/^\s*(g:\w+)\b/\1/g,global/

--regex-vim=/^(\sexport\s+)?const\s+(\w+)/\2/K,const/ --regex-vim=/^(\sexport\s+)?final\s+(\w+)/\2/K,const/

and see the light : all exported defs vim9script functions are now displayed !   :) :)

raven42 commented 1 year ago

Thanks for listing the steps. This will help others when trying to upgrade.