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

     1  This test exercises fuzzy completion matching.
     2  
     3  -- flags --
     4  -ignore_extra_diags
     5  
     6  -- go.mod --
     7  module golang.org/lsptests
     8  
     9  go 1.18
    10  
    11  -- fuzzy/fuzzy.go --
    12  package fuzzy
    13  
    14  func _() {
    15  	var a struct {
    16  		fabar  int
    17  		fooBar string
    18  	}
    19  
    20  	a.fabar  //@item(fuzzFabarField, "a.fabar", "int", "field")
    21  	a.fooBar //@item(fuzzFooBarField, "a.fooBar", "string", "field")
    22  
    23  	afa //@complete(" //", fuzzFabarField, fuzzFooBarField)
    24  	afb //@complete(" //", fuzzFooBarField, fuzzFabarField)
    25  
    26  	fab //@complete(" //", fuzzFabarField)
    27  
    28  	var myString string
    29  	myString = af //@complete(" //", fuzzFooBarField, fuzzFabarField)
    30  
    31  	var b struct {
    32  		c struct {
    33  			d struct {
    34  				e struct {
    35  					abc string
    36  				}
    37  				abc float32
    38  			}
    39  			abc bool
    40  		}
    41  		abc int
    42  	}
    43  
    44  	b.abc       //@item(fuzzABCInt, "b.abc", "int", "field")
    45  	b.c.abc     //@item(fuzzABCbool, "b.c.abc", "bool", "field")
    46  	b.c.d.abc   //@item(fuzzABCfloat, "b.c.d.abc", "float32", "field")
    47  	b.c.d.e.abc //@item(fuzzABCstring, "b.c.d.e.abc", "string", "field")
    48  
    49  	// in depth order by default
    50  	abc //@complete(" //", fuzzABCInt, fuzzABCbool, fuzzABCfloat)
    51  
    52  	// deep candidate that matches expected type should still ranked first
    53  	var s string
    54  	s = abc //@complete(" //", fuzzABCstring, fuzzABCInt, fuzzABCbool)
    55  }