www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dscanner --ctags: local variables, functions, ... are now shown in

reply David <scherd3113 gmail.com> writes:
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']
\ }
Dec 16 2018
parent reply Laurent =?UTF-8?B?VHLDqWd1aWVy?= <laurent.treguier.sink gmail.com> writes:
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.
Dec 17 2018
parent David <scherd3113 gmail.com> writes:
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!
Dec 17 2018