1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:38:34 -06:00
go/internal/lsp/testdata/bar/bar.go.in
Rebecca Stambler f07d81a593 internal/lsp: fix documentation for completion items
This change fixes documentation for completion items by using cached
package and AST information to derive the documentation. We also add
testing for documentation in completion items.

Change-Id: I911fb80f5cef88640fc06a9fe474e5da403657e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/189237
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-08-12 17:13:29 +00:00

48 lines
1.2 KiB
Go

// +build go1.11
package bar
import (
"golang.org/x/tools/internal/lsp/foo" //@item(foo, "foo", "\"golang.org/x/tools/internal/lsp/foo\"", "package")
)
func helper(i foo.IntFoo) {} //@item(helper, "helper", "func(i foo.IntFoo)", "func")
func _() {
help //@complete("l", helper)
_ = foo.StructFoo{} //@complete("S", Foo, IntFoo, StructFoo)
}
// Bar is a function.
func Bar() { //@item(Bar, "Bar", "func()", "func", "Bar is a function.")
foo.Foo() //@complete("F", Foo, IntFoo, StructFoo)
var _ foo.IntFoo //@complete("I", Foo, IntFoo, StructFoo)
foo.() //@complete("(", Foo, IntFoo, StructFoo)
}
func _() {
var Valentine int //@item(Valentine, "Valentine", "int", "var")
_ = foo.StructFoo{
Valu //@complete(" //", Value)
}
_ = foo.StructFoo{
Va //@complete("a", Value, Valentine)
}
_ = foo.StructFoo{
Value: 5, //@complete("a", Value)
}
_ = foo.StructFoo{
//@complete("", Value, Valentine, foo, Bar, helper)
}
_ = foo.StructFoo{
Value: Valen //@complete("le", Valentine)
}
_ = foo.StructFoo{
Value: //@complete(" //", Valentine, foo, Bar, helper)
}
_ = foo.StructFoo{
Value: //@complete(" ", Valentine, foo, Bar, helper)
}
}