Thread overview
dscanner --ctags: local variables, functions, ... are now shown in vim/neovim Tagbar
Dec 16, 2018
David
Dec 17, 2018
Laurent Tréguier
Dec 17, 2018
David
December 16, 2018
I am wondering how I could display (nested) local variables and functions in vim's tagbar (majutsushi/tagbar) using dscanner? So far I only see gloable variables, functions, ...

=========== script.d ==========
import std.stdio;

enum globalEnum1  { A = 1, B = 2 }
enum globalEnum2  { C, D }
void globalFun(){ writeln("global"); }
double globalDouble = 2.3;
string globalString = "hi";

void main(){
  enum localEnum  { A = 1, B = 2 }
  void localFun(){ writeln("local"); }
  double localDouble = 2.3;
}
===========

=========== Tagbar shows: ===========
◢ functions
    globalFun()
    main()

◢ globalEnum1 : enum
    [enumerators]
    A
    B

◢ globalEnum2 : enum
    [enumerators]
    C
    D

◢ variables
    globalDouble
    globalString
===========

" tagbar:
let g:tagbar_type_d = {
  \ 'ctagstype' : 'd',
  \ 'kinds'     : [
  \ 'c:classes:1:1',
  \ 'f:functions:1:1',
  \ 'T:template:1:1',
  \ 'g:enums:1:1',
  \ 'e:enumerators:0:0',
  \ 'u:unions:1:1',
  \ 's:structs:1:1',
  \ 'v:variables:1:0',
  \ 'i:interfaces:1:1',
  \ 'm:members',
  \ 'a:alias'
  \ ],
  \'sro': '.',
  \ 'kind2scope' : {
  \ 'c' : 'class',
  \ 'g' : 'enum',
  \ 's' : 'struct',
  \ 'u' : 'union',
  \ 'T' : 'template',
  \},
  \ 'scope2kind' : {
  \ 'enum'      : 'g',
  \ 'class'     : 'c',
  \ 'struct'    : 's',
  \ 'union'     : 'u',
  \ 'template'  : 'T',
  \ },
  \ 'ctagsbin' : 'dscanner',
  \ 'ctagsargs' : ['--ctags']
\ }


December 17, 2018
On Sunday, 16 December 2018 at 09:59:12 UTC, David wrote:
> I am wondering how I could display (nested) local variables and functions in vim's tagbar (majutsushi/tagbar) using dscanner? So far I only see gloable variables, functions, ...
>
> =========== script.d ==========
> import std.stdio;
>
> enum globalEnum1  { A = 1, B = 2 }
> enum globalEnum2  { C, D }
> void globalFun(){ writeln("global"); }
> double globalDouble = 2.3;
> string globalString = "hi";
>
> void main(){
>   enum localEnum  { A = 1, B = 2 }
>   void localFun(){ writeln("local"); }
>   double localDouble = 2.3;
> }
> ===========
>
> =========== Tagbar shows: ===========
> ◢ functions
>     globalFun()
>     main()
>
> ◢ globalEnum1 : enum
>     [enumerators]
>     A
>     B
>
> ◢ globalEnum2 : enum
>     [enumerators]
>     C
>     D
>
> ◢ variables
>     globalDouble
>     globalString
> ===========

I think that's not possible right now, D-Scanner skips over body functions and unittest blocks to not clutter the tags with potentially lots of local names.
December 17, 2018
On Monday, 17 December 2018 at 08:56:07 UTC, Laurent Tréguier wrote:
> I think that's not possible right now, D-Scanner skips over body functions and unittest blocks to not clutter the tags with potentially lots of local names.

A pity; nevertheless many thanks for coming back on it!