github.com/v2fly/tools@v0.100.0/internal/lsp/testdata/comment_completion/comment_completion.go.in (about) 1 package comment_completion 2 3 var p bool 4 5 //@complete(re"$") 6 7 func _() { 8 var a int 9 10 switch a { 11 case 1: 12 //@complete(re"$") 13 _ = a 14 } 15 16 var b chan int 17 select { 18 case <-b: 19 //@complete(re"$") 20 _ = b 21 } 22 23 var ( 24 //@complete(re"$") 25 _ = a 26 ) 27 } 28 29 // //@complete(" ", variableC) 30 var C string //@item(variableC, "C", "string", "var") //@complete(" ", variableC) 31 32 // //@complete(" ", constant) 33 const Constant = "example" //@item(constant, "Constant", "string", "const") //@complete(" ", constant) 34 35 // //@complete(" ", structType, fieldB, fieldA) 36 type StructType struct { //@item(structType, "StructType", "struct{...}", "struct") //@complete(" ", structType, fieldA, fieldB) 37 // //@complete(" ", fieldA, structType, fieldB) 38 A string //@item(fieldA, "A", "string", "field") //@complete(" ", fieldA, structType, fieldB) 39 b int //@item(fieldB, "b", "int", "field") //@complete(" ", fieldB, structType, fieldA) 40 } 41 42 // //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA) 43 func (structType *StructType) Method(X int) (Y int) { //@item(structRecv, "structType", "*StructType", "var"),item(method, "Method", "func(X int) (Y int)", "method"),item(paramX, "X", "int", "var"),item(resultY, "Y", "int", "var") 44 // //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA) 45 return 46 } 47 48 // //@complete(" ", newType) 49 type NewType string //@item(newType, "NewType", "string", "type") //@complete(" ", newType) 50 51 // //@complete(" ", testInterface, testA, testB) 52 type TestInterface interface { //@item(testInterface, "TestInterface", "interface{...}", "interface") 53 // //@complete(" ", testA, testInterface, testB) 54 TestA(L string) (M int) //@item(testA, "TestA", "func(L string) (M int)", "method"),item(paramL, "L", "var", "string"),item(resM, "M", "var", "int") //@complete(" ", testA, testInterface, testB) 55 TestB(N int) bool //@item(testB, "TestB", "func(N int) bool", "method"),item(paramN, "N", "var", "int") //@complete(" ", testB, testInterface, testA) 56 } 57 58 // //@complete(" ", function) 59 func Function() int { //@item(function, "Function", "func() int", "func") //@complete(" ", function) 60 // //@complete(" ", function) 61 return 0 62 } 63 64 // This tests multiline block comments and completion with prefix 65 // Lorem Ipsum Multili//@complete("Multi", multiline) 66 // Lorem ipsum dolor sit ametom 67 func Multiline() int { //@item(multiline, "Multiline", "func() int", "func") 68 // //@complete(" ", multiline) 69 return 0 70 }