github.com/jd-ly/tools@v0.5.7/internal/lsp/testdata/fuzzymatch/fuzzymatch.go (about)

     1  // Copyright 2019 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fuzzy
     6  
     7  func _() {
     8  	var a struct {
     9  		fabar  int
    10  		fooBar string
    11  	}
    12  
    13  	a.fabar  //@item(fuzzFabarField, "a.fabar", "int", "field")
    14  	a.fooBar //@item(fuzzFooBarField, "a.fooBar", "string", "field")
    15  
    16  	afa //@fuzzy(" //", fuzzFabarField, fuzzFooBarField)
    17  	afb //@fuzzy(" //", fuzzFooBarField, fuzzFabarField)
    18  
    19  	fab //@fuzzy(" //", fuzzFabarField)
    20  
    21  	var myString string
    22  	myString = af //@fuzzy(" //", fuzzFooBarField, fuzzFabarField)
    23  
    24  	var b struct {
    25  		c struct {
    26  			d struct {
    27  				e struct {
    28  					abc string
    29  				}
    30  				abc float32
    31  			}
    32  			abc bool
    33  		}
    34  		abc int
    35  	}
    36  
    37  	b.abc       //@item(fuzzABCInt, "b.abc", "int", "field")
    38  	b.c.abc     //@item(fuzzABCbool, "b.c.abc", "bool", "field")
    39  	b.c.d.abc   //@item(fuzzABCfloat, "b.c.d.abc", "float32", "field")
    40  	b.c.d.e.abc //@item(fuzzABCstring, "b.c.d.e.abc", "string", "field")
    41  
    42  	// in depth order by default
    43  	abc //@fuzzy(" //", fuzzABCInt, fuzzABCbool, fuzzABCfloat)
    44  
    45  	// deep candidate that matches expected type should still ranked first
    46  	var s string
    47  	s = abc //@fuzzy(" //", fuzzABCstring, fuzzABCInt, fuzzABCbool)
    48  }