File: comment_completion.go.in

package info (click to toggle)
golang-golang-x-tools 1%3A0.1.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,588 kB
  • sloc: javascript: 2,011; asm: 1,458; sh: 174; yacc: 155; makefile: 21; ansic: 17
file content (70 lines) | stat: -rw-r--r-- 2,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package comment_completion

var p bool

//@complete(re"$")

func _() {
	var a int

	switch a {
	case 1:
		//@complete(re"$")
		_ = a
	}

	var b chan int
	select {
	case <-b:
		//@complete(re"$")
		_ = b
	}

	var (
		//@complete(re"$")
		_ = a
	)
}

// //@complete(" ", variableC)
var C string //@item(variableC, "C", "string", "var") //@complete(" ", variableC)

// //@complete(" ", constant)
const Constant = "example" //@item(constant, "Constant", "string", "const") //@complete(" ", constant)

// //@complete(" ", structType, fieldB, fieldA)
type StructType struct { //@item(structType, "StructType", "struct{...}", "struct") //@complete(" ", structType, fieldA, fieldB)
	// //@complete(" ", fieldA, structType, fieldB)
	A string //@item(fieldA, "A", "string", "field") //@complete(" ", fieldA, structType, fieldB)
	b int    //@item(fieldB, "b", "int", "field") //@complete(" ", fieldB, structType, fieldA)
}

// //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA)
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")
	// //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA)
	return
}

// //@complete(" ", newType)
type NewType string //@item(newType, "NewType", "string", "type") //@complete(" ", newType)

// //@complete(" ", testInterface, testA, testB)
type TestInterface interface { //@item(testInterface, "TestInterface", "interface{...}", "interface")
	// //@complete(" ", testA, testInterface, testB)
	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)
	TestB(N int) bool       //@item(testB, "TestB", "func(N int) bool", "method"),item(paramN, "N", "var", "int") //@complete(" ", testB, testInterface, testA)
}

// //@complete(" ", function)
func Function() int { //@item(function, "Function", "func() int", "func") //@complete(" ", function)
	// //@complete(" ", function)
	return 0
}

// This tests multiline block comments and completion with prefix
// Lorem Ipsum Multili//@complete("Multi", multiline)
// Lorem ipsum dolor sit ametom
func Multiline() int { //@item(multiline, "Multiline", "func() int", "func")
	// //@complete(" ", multiline)
	return 0
}