Closed niva-xx closed 1 year ago
Just so I understand, is this a case where vim9 is not setting the filetype correctly? Or is the filetype correct in vim9 due to a difference in an older Powershell format vs the new one?
With vim90 patch 0217 on windows 10, vim recognize powershell scripts as this in vim90\filetype.vim|1447| au BufNewFile,BufRead .ps1,.psd1,.psm1,.pssc setf ps1 and it seems that tagbar does not displayed well the functions, globals, etc.. of powershell scripts.
So, a workaround to recognize powershellscript functions, globals
1/ In your $MYVIMRC just put these lines: g:tagbar_type_ps1 = { ctagstype: 'PowerShell', kinds: [ \ 'f:functions', \ 'g:global variables', \ 's:called scripts', \ ], }
2/ In a .ctags.d folder known of your PATH or at the Universal-ctags (ctags.exe) root, add this filetype
.ctags.d/ps1.ctags containing these lines : --kinddef-powershell=f,functions,PowerShell functions --kinddef-powershell=g,global,PowerShell global variables --kinddef-powershell=s,scripts,PowerShell Called Script --regex-powershell=/^function\s+([^(]+)/\1/f,functions/ --regex-powershell=/\$global:(\w+)\s/\1/g,global/ --regex-powershell=/\$script:(\w+)\s/\1/s,scripts/
Ok thanks. Once universal ctags can support this filetype officially, we can add support for it in tagbar.
Thanks for providing a solution.
Hi,
How to deal with the fact that Universal-ctags recognize Powershell but vim9 set filetype of ps1 or psm1 as ft=ps1. The result is that universal-ctags used with tagbar seems to not recognized Powershell type of file.