universal-ctags / ctags

A maintained ctags implementation
https://ctags.io
GNU General Public License v2.0
6.56k stars 625 forks source link

sh: function calls are not detected #1979

Closed bam80 closed 5 years ago

bam80 commented 5 years ago

For now, only definition tags are detected for shell functions

masatake commented 5 years ago

I have no plan to work on this item.

To distigunish command invocations and function invocations, ctags must track other scripts loaed with "." or "source" command in the target script file. In addition, we must rewrite the shell parser in token based technique to recognize invocations.

masatake commented 5 years ago

I don't have any realistic plan for utilizing reference tags especially about shell parser. What I am thinking about reference tags is utilizing it for "semantic recursion" (--recurse=semantic).

foo.sh

source lib.sh

If you run ctags --recurse=semantic foo.sh, ctags parsrs not only foo.sh but also lib.sh that is specified in source built-in.

$ u-ctags --list-kinds-full=Sh
#LETTER NAME     ENABLED REFONLY NROLES MASTER DESCRIPTION
a       alias    yes     no      0      NONE   aliases
f       function yes     no      0      NONE   functions
h       heredoc  yes     no      1      NONE   label for here document
s       script   yes     yes     1      NONE   script files
v       variable yes     no      0      NONE   variables

The shell parser already capturing source'ed files as referenec tags with kind 's'.

About the other area applying reference tags needs much more study. What I use well is C language, so I will do such study in C parser. It will take...3 ~ 5 years. Just estimation.