github.com/v2fly/tools@v0.100.0/internal/lsp/testdata/typdef/typdef.go (about)

     1  package typdef
     2  
     3  type Struct struct { //@item(Struct, "Struct", "struct{...}", "struct")
     4  	Field string
     5  }
     6  
     7  type Int int //@item(Int, "Int", "int", "type")
     8  
     9  func _() {
    10  	var (
    11  		value Struct
    12  		point *Struct
    13  	)
    14  	_ = value //@typdef("value", Struct)
    15  	_ = point //@typdef("point", Struct)
    16  
    17  	var (
    18  		array   [3]Struct
    19  		slice   []Struct
    20  		ch      chan Struct
    21  		complex [3]chan *[5][]Int
    22  	)
    23  	_ = array   //@typdef("array", Struct)
    24  	_ = slice   //@typdef("slice", Struct)
    25  	_ = ch      //@typdef("ch", Struct)
    26  	_ = complex //@typdef("complex", Int)
    27  
    28  	var s struct {
    29  		x struct {
    30  			xx struct {
    31  				field1 []Struct
    32  				field2 []Int
    33  			}
    34  		}
    35  	}
    36  	s.x.xx.field1 //@typdef("field1", Struct)
    37  	s.x.xx.field2 //@typdef("field2", Int)
    38  }