Rebecca Stambler 806e1cfd89 internal/lsp: add a preliminary test for completion
Use the packagestest framework to test completion. Add support for a
slice of token.Position to packagestest to support this.

Change-Id: Ie5ddece4446a3c74419727461a77faa3788cb040
Reviewed-on: https://go-review.googlesource.com/c/148197
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2018-11-12 19:56:38 +00:00

24 lines
683 B
Go

package foo
type StructFoo struct { //@mark(StructFoo, "StructFoo"),item(StructFoo, "StructFoo", "struct{...}", "struct")
Value int //@mark(Value, "Value"),item(Value, "Value", "int", "field")
}
// TODO(rstambler): Create pre-set builtins?
//@mark(Error, ""),item(Error, "Error()", "string", "method")
func Foo() { //@mark(Foo, "Foo"),item(Foo, "Foo()", "", "func")
var err error
err.Error() //@complete("E", Error)
}
func _() {
var sFoo StructFoo //@complete("t", StructFoo)
if x := sFoo; x.Value == 1 { //@complete("V", Value)
return
}
}
//@complete("", Foo, IntFoo, StructFoo)
type IntFoo int //@mark(IntFoo, "IntFoo"),item(IntFoo, "IntFoo", "int", "type")