vim-plugins icon indicating copy to clipboard operation
vim-plugins copied to clipboard

Bash-Support: function calls references

Open bam80 opened this issue 6 years ago • 5 comments

Hi, getting a list of function calls, with possibility to jump to any, would be extremely useful. I didn't find any software capable of doing this. Is it even exists, and can we implement it if not? I tried GLOBAL, but it's Pygments parser fetches variable references but not calls.

Thanks for Bash-Support!

@WolfgangMehner @FritzMehner

bam80 avatar Jan 15 '19 20:01 bam80

So you mean a taglist? One which would have the position of function definitions, and then also the lines where these functions are called.

WolfgangMehner avatar Jan 16 '19 15:01 WolfgangMehner

Sorry I don't know exactly what is taglist. ctags "resolves" a tag from it's occurrence to the place where it defined, but not otherwise. So how could we get all the function calls given it's definition? I don't know any method, except :vimgrep (kinda of "brute-force search"). But it's not quite that.

bam80 avatar Jan 16 '19 15:01 bam80

cscope and Global allow it, but not for shell scripts (see OP)

bam80 avatar Jan 16 '19 16:01 bam80

Here is BashLexer used by GLOBAL's Pygments parser: https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/lexers/shell.py Only if we could force it to pick up all simple commands..

bam80 avatar Jan 16 '19 16:01 bam80

Here is my workaround for now: :exe "vimgrep /[^#]*".expand("<cword>")."[^(']/ ##"

use it while standing on function definition. ## arglist should be populated beforehand with needed file names, for example - all open buffers, with command :bufdo :args ## %, or replaced with wildcarded path: **/*.sh

As you can see, it's pretty ugly, so proper solution still needed.

bam80 avatar Jan 16 '19 23:01 bam80