diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go index 62716cd0..8099328c 100644 --- a/internal/lsp/lsp_test.go +++ b/internal/lsp/lsp_test.go @@ -79,6 +79,14 @@ func testLSP(t *testing.T, exporter packagestest.Exporter) { dirs[filepath.Dir(filename)] = true } } + // Do a first pass to collect special markers + if err := exported.Expect(map[string]interface{}{ + "item": func(name string, r packagestest.Range, _, _ string) { + exported.Mark(name, r) + }, + }); err != nil { + t.Fatal(err) + } // Collect any data that needs to be used by subsequent tests. if err := exported.Expect(map[string]interface{}{ "diag": func(pos token.Position, msg string) { diff --git a/internal/lsp/testdata/foo/foo.go b/internal/lsp/testdata/foo/foo.go index bb92eb1a..27c1b42c 100644 --- a/internal/lsp/testdata/foo/foo.go +++ b/internal/lsp/testdata/foo/foo.go @@ -1,13 +1,13 @@ package foo -type StructFoo struct { //@mark(StructFoo, "StructFoo"),item(StructFoo, "StructFoo", "struct{...}", "struct") - Value int //@mark(Value, "Value"),item(Value, "Value", "int", "field") +type StructFoo struct { //@item(StructFoo, "StructFoo", "struct{...}", "struct") + Value int //@item(Value, "Value", "int", "field") } // TODO(rstambler): Create pre-set builtins? -//@mark(Error, ""),item(Error, "Error()", "string", "method") +/* Error() */ //@item(Error, "Error()", "string", "method") -func Foo() { //@mark(Foo, "Foo"),item(Foo, "Foo()", "", "func") +func Foo() { //@item(Foo, "Foo()", "", "func") var err error err.Error() //@complete("E", Error) } @@ -20,4 +20,4 @@ func _() { } //@complete("", Foo, IntFoo, StructFoo) -type IntFoo int //@mark(IntFoo, "IntFoo"),item(IntFoo, "IntFoo", "int", "type") +type IntFoo int //@item(IntFoo, "IntFoo", "int", "type")