1
0
mirror of https://github.com/golang/go synced 2024-10-02 02:18:33 -06:00
go/internal/lsp/testdata/godef/a/d.go
Ian Cottrell 923d258130 internal/lsp: make the guru emulation tests slightly looser with a different matching system
We now match only the things we realy need to, to allow the description to vary more.

Change-Id: Ib3591c41ed5a5c725f2a3efb180ba17f808de51a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170341
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-04-04 13:25:00 +00:00

71 lines
1.9 KiB
Go

package a
import "fmt"
type Thing struct { //@Thing
Member string //@Member
}
var Other Thing //@Other
func Things(val []string) []Thing { //@Things
return nil
}
func (t Thing) Method(i int) string { //@Method
return t.Member
}
func useThings() {
t := Thing{} //@mark(aStructType, "ing")
fmt.Print(t.Member) //@mark(aMember, "ember")
fmt.Print(Other) //@mark(aVar, "ther")
Things() //@mark(aFunc, "ings")
t.Method() //@mark(aMethod, "eth")
}
/*@
definition(aStructType, "", Thing, "$file:$line:$col-$ecol: defined here as type Thing struct{Member string}")
definition(aStructType, "-emulate=guru", Thing, "$file:$line:$col: defined here as type Thing")
definition(aMember, "", Member, "$file:$line:$col-$ecol: defined here as field Member string")
definition(aMember, "-emulate=guru", Member, "$file:$line:$col: defined here as field Member string")
definition(aVar, "", Other, "$file:$line:$col-$ecol: defined here as var Other Thing")
definition(aVar, "-emulate=guru", Other, "$file:$line:$col: defined here as var Other")
definition(aFunc, "", Things, "$file:$line:$col-$ecol: defined here as func Things(val []string) []Thing")
definition(aFunc, "-emulate=guru", Things, "$file:$line:$col: defined here as func Things")
definition(aMethod, "", Method, "$file:$line:$col-$ecol: defined here as func (Thing).Method(i int) string")
definition(aMethod, "-emulate=guru", Method, "$file:$line:$col: defined here as func (Thing).Method(i int) string")
//param
//package name
//const
//anon field
// JSON tests
definition(aStructType, "-json", Thing, `{
"span": {
"uri": "$euri",
"start": {
"line": $line,
"column": $col,
"offset": $offset
},
"end": {
"line": $eline,
"column": $ecol,
"offset": $eoffset
}
},
"description": "type Thing struct{Member string}"
}`)
definition(aStructType, "-json -emulate=guru", Thing, `{
"objpos": "$efile:$line:$col",
"desc": "type Thing$$"
}`)
*/