-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ctags if ctags_cmd exists for filetype #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g:vista_ctags_cmd
is used for setting options for running ctags or using another executable for some filetype, e.g., hasktags -o - -c
for haskell. I believe this is what you are trying to do:
vista.vim/autoload/vista/executive/ctags.vim
Lines 67 to 83 in a9c6bed
function! s:GetCustomCmd(ft) abort | |
if exists('g:vista_ctags_cmd') && has_key(g:vista_ctags_cmd, a:ft) | |
return g:vista_ctags_cmd[a:ft] | |
endif | |
return v:null | |
endfunction | |
" FIXME support all languages that ctags does | |
function! s:Cmd(file) abort | |
let ft = &filetype | |
let custom_cmd = s:GetCustomCmd(ft) | |
if custom_cmd isnot v:null | |
let cmd = printf('%s %s', custom_cmd, a:file) | |
return cmd | |
endif |
See all the avaliable executives via :echo g:vista#executives
if you want to change the defeault executive.
Closing as this logic already exists. Thanks any way. |
I think you misunderstood the change. In my settings I have: let g:vista_default_executive = 'vim_lsp' i.e I want to use vim-lsp as the executive by default. However, for 'xyz' files, there is no LSP available, so I use ctags with a custom command instead. My change is about being able to open the vista side-bar with the correct executive for each file type (i.e just type :Vista without args). An alternative solution is to have a filetype to executive map. However I figure if you have a custom ctags command for a particular filetype, you probably want to use the ctags executive. |
Thanks for the explanation. That makes sense, I love your idea. Could you please add some comment for this case? |
Merged, thanks! |
Ok, I've added some comments. It is somewhat of a workaround. From the docs apparently Vista shoudl cycle through each of the executives until it finds one that returns data. However when I use vim-lsp for an unsupported filetype I just get the error: Either way - in addition to this change it might be worth a 'filetype to executive' map so that you don't need to configure ctags arguments, or might want ctags to be the default and vim-lsp to be the exception. |
That warning message is from: vista.vim/autoload/vista/executive/vim_lsp.vim Lines 89 to 92 in a9c6bed
And it is indeed needless in this situation. I think we can modify the execute function to run without any check. |
@smhc Can you see if this branch works as you expected? |
With that branch the error doesn't display any more. However it doesn't automatically cycle through the executives when just using ":Vista" to open the sidebar. It does cycle through when using ":Vista finder", however it does that with the master branch as well. I can raise a separate issue to track it properly. |
No description provided.