forked from golang/tools
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/goxls/testdata: update testdata
- Loading branch information
Showing
11 changed files
with
138 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// +build go1.11 | ||
|
||
package bar | ||
|
||
import ( | ||
"golang.org/lsptests/foo" //@item(foo, "foo", "\"golang.org/lsptests/foo\"", "package") | ||
) | ||
|
||
func helper(i foo.IntFoo) {} //@item(helper, "helper", "func(i foo.IntFoo)", "func") | ||
|
||
func _() { | ||
help //@complete("l", helper) | ||
_ = foo.StructFoo{} //@complete("S", 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", 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, helper, Bar) | ||
} | ||
_ = foo.StructFoo{ | ||
Value: Valen //@complete("le", Valentine) | ||
} | ||
_ = foo.StructFoo{ | ||
Value: //@complete(" //", Valentine, foo, helper, Bar) | ||
} | ||
_ = foo.StructFoo{ | ||
Value: //@complete(" ", Valentine, foo, helper, Bar) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// +build go1.11 | ||
|
||
package baz | ||
|
||
import ( | ||
"golang.org/lsptests/bar" | ||
|
||
f "golang.org/lsptests/foo" | ||
) | ||
|
||
var FooStruct f.StructFoo | ||
|
||
func Baz() { | ||
defer bar.Bar() //@complete("B", Bar) | ||
// TODO(rstambler): Test completion here. | ||
defer bar.B | ||
var x f.IntFoo //@complete("n", IntFoo),typdef("x", IntFoo) | ||
bar.Bar() //@complete("B", Bar) | ||
} | ||
|
||
func _() { | ||
bob := f.StructFoo{Value: 5} | ||
if x := bob. //@complete(" //", Value) | ||
switch true == false { | ||
case true: | ||
if x := bob. //@complete(" //", Value) | ||
case false: | ||
} | ||
if x := bob.Va //@complete("a", Value) | ||
switch true == true { | ||
default: | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package unimported | ||
|
||
var TestExport int //@item(testexport, "TestExport", "var (from \"golang.org/lsptests/unimported\")", "var") |
23 changes: 23 additions & 0 deletions
23
gopls/internal/goxls/testdata/unimported/unimported.gop.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package unimported | ||
|
||
func _() { | ||
http //@unimported("p", nethttp) | ||
// container/ring is extremely unlikely to be imported by anything, so shouldn't have type information. | ||
ring.Ring //@unimported("Ring", ringring) | ||
signature.Foo //@unimported("Foo", signaturefoo) | ||
|
||
context.Bac //@unimported(" //", contextBackground) | ||
} | ||
|
||
// Create markers for unimported std lib packages. Only for use by this test. | ||
/* http */ //@item(nethttp, "http", "\"net/http\"", "package") | ||
|
||
/* ring.Ring */ //@item(ringring, "Ring", "(from \"container/ring\")", "var") | ||
|
||
/* signature.Foo */ //@item(signaturefoo, "Foo", "func (from \"golang.org/lsptests/signature\")", "func") | ||
|
||
/* context.Background */ //@item(contextBackground, "Background", "func (from \"context\")", "func") | ||
|
||
// Now that we no longer type-check imported completions, | ||
// we don't expect the context.Background().Err method (see golang/go#58663). | ||
/* context.Background().Err */ //@item(contextBackgroundErr, "Background().Err", "func (from \"context\")", "method") |
16 changes: 16 additions & 0 deletions
16
gopls/internal/goxls/testdata/unimported/unimported_cand_type.gop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package unimported | ||
|
||
import ( | ||
_ "context" | ||
|
||
"golang.org/lsptests/baz" | ||
_ "golang.org/lsptests/signature" // provide type information for unimported completions in the other file | ||
) | ||
|
||
func _() { | ||
foo.StructFoo{} //@item(litFooStructFoo, "foo.StructFoo{}", "struct{...}", "struct") | ||
|
||
// We get the literal completion for "foo.StructFoo{}" even though we haven't | ||
// imported "foo" yet. | ||
baz.FooStruct = f //@snippet(" //", litFooStructFoo, "foo.StructFoo{$0\\}", "foo.StructFoo{$0\\}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package unimported_test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestSomething(t *testing.T) { | ||
_ = unimported.TestExport //@unimported("TestExport", testexport) | ||
} |