| 1 |
This file contains tests for symbol matches using the casesensitive matcher. |
| 2 |
|
| 3 |
For historical reasons, it also verifies general behavior of the symbol search. |
| 4 |
|
| 5 |
-- settings.json -- |
| 6 |
{ |
| 7 |
"symbolMatcher": "casesensitive", |
| 8 |
"analyses": {"unusedfunc": false} |
| 9 |
} |
| 10 |
|
| 11 |
-- go.mod -- |
| 12 |
module mod.test/casesensitive |
| 13 |
|
| 14 |
go 1.18 |
| 15 |
|
| 16 |
-- main.go -- |
| 17 |
package main |
| 18 |
|
| 19 |
//@workspacesymbol("main.main", main) |
| 20 |
//@workspacesymbol("p.Message", Message) |
| 21 |
//@workspacesymbol("main.myvar", myvar) |
| 22 |
//@workspacesymbol("main.myType", myType) |
| 23 |
//@workspacesymbol("main.myType.Blahblah", blahblah) |
| 24 |
//@workspacesymbol("main.myStruct", myStruct) |
| 25 |
//@workspacesymbol("main.myStruct.myStructField", myStructField) |
| 26 |
//@workspacesymbol("main.myInterface", myInterface) |
| 27 |
//@workspacesymbol("main.myInterface.DoSomeCoolStuff", DoSomeCoolStuff) |
| 28 |
//@workspacesymbol("main.embed.myStruct", embeddedStruct) |
| 29 |
//@workspacesymbol("main.embed.nestedStruct.nestedStruct2.int", int) |
| 30 |
//@workspacesymbol("main.embed.nestedInterface.myInterface", nestedInterface) |
| 31 |
//@workspacesymbol("main.embed.nestedInterface.nestedMethod", nestedMethod) |
| 32 |
//@workspacesymbol("dunk", dunk) |
| 33 |
//@workspacesymbol("Dunk", Dunk) |
| 34 |
|
| 35 |
import ( |
| 36 |
"encoding/json" |
| 37 |
"fmt" |
| 38 |
) |
| 39 |
|
| 40 |
func main() { // function |
| 41 |
fmt.Println("Hello") |
| 42 |
} |
| 43 |
|
| 44 |
var myvar int // variable |
| 45 |
|
| 46 |
type myType string // basic type |
| 47 |
|
| 48 |
type myDecoder json.Decoder // to use the encoding/json import |
| 49 |
|
| 50 |
func (m *myType) Blahblah() {} // method |
| 51 |
|
| 52 |
type myStruct struct { // struct type |
| 53 |
myStructField int // struct field |
| 54 |
} |
| 55 |
|
| 56 |
type myInterface interface { // interface |
| 57 |
DoSomeCoolStuff() string // interface method |
| 58 |
} |
| 59 |
|
| 60 |
type embed struct { |
| 61 |
myStruct |
| 62 |
|
| 63 |
nestedStruct struct { |
| 64 |
nestedField int |
| 65 |
|
| 66 |
nestedStruct2 struct { |
| 67 |
int |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
nestedInterface interface { |
| 72 |
myInterface |
| 73 |
nestedMethod() |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
func Dunk() int { return 0 } |
| 78 |
|
| 79 |
func dunk() {} |
| 80 |
|
| 81 |
var _ = dunk |
| 82 |
|
| 83 |
-- p/p.go -- |
| 84 |
package p |
| 85 |
|
| 86 |
const Message = "Hello World." // constant |
| 87 |
-- @DoSomeCoolStuff -- |
| 88 |
main.go:41:2-17 main.myInterface.DoSomeCoolStuff Method |
| 89 |
-- @Dunk -- |
| 90 |
main.go:61:6-10 Dunk Function |
| 91 |
-- @Message -- |
| 92 |
p/p.go:3:7-14 p.Message Constant |
| 93 |
-- @blahblah -- |
| 94 |
main.go:34:18-26 main.myType.Blahblah Method |
| 95 |
-- @dunk -- |
| 96 |
main.go:63:6-10 dunk Function |
| 97 |
-- @int -- |
| 98 |
main.go:51:4-7 main.embed.nestedStruct.nestedStruct2.int Field |
| 99 |
-- @main -- |
| 100 |
main.go:24:6-10 main.main Function |
| 101 |
-- @myInterface -- |
| 102 |
main.go:40:6-17 main.myInterface Interface |
| 103 |
main.go:41:2-17 main.myInterface.DoSomeCoolStuff Method |
| 104 |
-- @myStruct -- |
| 105 |
main.go:36:6-14 main.myStruct Struct |
| 106 |
main.go:37:2-15 main.myStruct.myStructField Field |
| 107 |
-- @myStructField -- |
| 108 |
main.go:37:2-15 main.myStruct.myStructField Field |
| 109 |
-- @myType -- |
| 110 |
main.go:30:6-12 main.myType Class |
| 111 |
main.go:34:18-26 main.myType.Blahblah Method |
| 112 |
-- @myvar -- |
| 113 |
main.go:28:5-10 main.myvar Variable |
| 114 |
-- @nestedInterface -- |
| 115 |
main.go:56:3-14 main.embed.nestedInterface.myInterface Interface |
| 116 |
-- @nestedMethod -- |
| 117 |
main.go:57:3-15 main.embed.nestedInterface.nestedMethod Method |
| 118 |
-- @embeddedStruct -- |
| 119 |
main.go:45:2-10 main.embed.myStruct Field |