golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/completion/deep2.txt (about)

     1  This test exercises deep completion.
     2  
     3  It was originally bundled with deep.go, but is split into a separate test as
     4  the new marker tests do not permit mutating server options for individual
     5  marks.
     6  
     7  -- flags --
     8  -ignore_extra_diags
     9  
    10  -- go.mod --
    11  module golang.org/lsptests
    12  
    13  go 1.18
    14  
    15  -- deep/deep2.go --
    16  package deep
    17  
    18  type foo struct {
    19  	b bar
    20  }
    21  
    22  func (f foo) bar() bar {
    23  	return f.b
    24  }
    25  
    26  func (f foo) barPtr() *bar {
    27  	return &f.b
    28  }
    29  
    30  type bar struct{}
    31  
    32  func (b bar) valueReceiver() int {
    33  	return 0
    34  }
    35  
    36  func (b *bar) ptrReceiver() int {
    37  	return 0
    38  }
    39  
    40  func _() {
    41  	var (
    42  		i int
    43  		f foo
    44  	)
    45  
    46  	f.bar().valueReceiver    //@item(deepBarValue, "f.bar().valueReceiver", "func() int", "method")
    47  	f.barPtr().ptrReceiver   //@item(deepBarPtrPtr, "f.barPtr().ptrReceiver", "func() int", "method")
    48  	f.barPtr().valueReceiver //@item(deepBarPtrValue, "f.barPtr().valueReceiver", "func() int", "method")
    49  
    50  	i = fbar //@complete(" //", deepBarValue, deepBarPtrPtr, deepBarPtrValue)
    51  }
    52  
    53  func (b baz) Thing() struct{ val int } {
    54  	return b.thing
    55  }
    56  
    57  type baz struct {
    58  	thing struct{ val int }
    59  }
    60  
    61  func (b baz) _() {
    62  	b.Thing().val    //@item(deepBazMethVal, "b.Thing().val", "int", "field")
    63  	b.thing.val      //@item(deepBazFieldVal, "b.thing.val", "int", "field")
    64  	var _ int = bval //@rank(" //", deepBazFieldVal, deepBazMethVal)
    65  }