simrat39 / symbols-outline.nvim

A tree like view for symbols in Neovim using the Language Server Protocol. Supports all your favourite languages.
MIT License
1.85k stars 100 forks source link

[Feature] Add tags support #121

Open pidgeon777 opened 2 years ago

pidgeon777 commented 2 years ago

I think that other than LSP it would be great to integrate results from tag files, such as Tagbar or vista.vim.

pidgeon777 commented 2 years ago

Two main reasons are:

  1. Treesitter/LSP is not available for all languages (even among the most important, such as VHDL), and sometimes it is broken for certain languages, even commons. ctags covers a huge amount of languages.
  2. With ctags it is possible to define custom pattern based tags for all files/languages, standard or not, which is extremely helpful under certain situations, thanks to the customizable ctags engine based on regex.

In vista.vim it is possible to define options such as:

" Executive used when opening vista sidebar without specifying it.
" See all the avaliable executives via `:echo g:vista#executives`.
let g:vista_default_executive = 'ctags'

" Set the executive for some filetypes explicitly. Use the explicit executive
" instead of the default one for these filetypes when using `:Vista` without
" specifying the executive.
let g:vista_executive_for = {
  \ 'cpp': 'vim_lsp',
  \ 'php': 'vim_lsp',
  \ }

" Declare the command including the executable and options used to generate ctags output
" for some certain filetypes.The file path will be appened to your custom command.
" For example:
let g:vista_ctags_cmd = {
      \ 'haskell': 'hasktags -x -o - -c',
      \ }

tagbar, which is purely based on ctags, is highly configurable:

https://github.com/preservim/tagbar/blob/master/doc/tagbar.txt