ctags and Fortran's interfaces

2020-07-18 02:58发布

问题:

I'm wondering how to get ctags working with interfaces in Fortran, eg:

INTERFACE SOME_ROUTINE
  MODULE SOME_ROUTINE_A
  MODULE SOME_ROUTINE_B
END SOME_ROUTINE

So that either SOME_ROUTINE_A or SOME_ROUTINE_B is called depending on the parameters passed to the subroutine.

If I've got my cursor over a call to SOME_ROUTINE in Vim, and hit C-], I get a "tag not found: SOME_ROUTINE" error, and if I check my ctags file they're not in there.

The weird thing is that I'm also using the Vim taglist plugin, and the interfaces in a source file will show up in the taglist window. The only clue I could find to how this is working is this line in the taglist plugin code:

let s:tlist_def_fortran_settings = 'fortran;p:program;b:block data;' .
                \ 'c:common;e:entry;i:interface;k:type;l:label;m:module;' .
                \ 'n:namelist;t:derived;v:variable;f:function;s:subroutine'

I've checked the manual for ctags and can't find any clue to how this is working, anyone know what's going on?

回答1:

Ok so of course I find the answer right after asking this question. I just needed to add "--fortran-kinds=+i" to my ctags command.

Running "ctags --list-kinds" lists the kinds of information that can be output for different languages.