| 1 |
This test exercises the "go_symbol_references" MCP tool. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-mcp |
| 5 |
-ignore_extra_diags |
| 6 |
|
| 7 |
-- go.mod -- |
| 8 |
module example.com |
| 9 |
|
| 10 |
// TODO(rfindley): add error assertions here. |
| 11 |
|
| 12 |
//@mcptool("go_symbol_references", `{"file":"$WORKDIR/a/a.go","symbol":"Foo"}`, output=aFoo) |
| 13 |
//@mcptool("go_symbol_references", `{"file":"$WORKDIR/b/b.go","symbol":"a.Foo"}`, output=aFoo) |
| 14 |
//@mcptool("go_symbol_references", `{"file":"$WORKDIR/a/a.go","symbol":"T.Bar"}`, output=aBar) |
| 15 |
//@mcptool("go_symbol_references", `{"file":"$WORKDIR/b/b.go","symbol":"a.T.Bar"}`, output=aBar) |
| 16 |
|
| 17 |
-- a/a.go -- |
| 18 |
package a |
| 19 |
|
| 20 |
func Foo() {} |
| 21 |
|
| 22 |
func callFoo() { |
| 23 |
Foo() |
| 24 |
} |
| 25 |
|
| 26 |
type T int |
| 27 |
|
| 28 |
func (T) Bar() {} |
| 29 |
|
| 30 |
-- b/b.go -- |
| 31 |
package b |
| 32 |
|
| 33 |
import "example.com/a" |
| 34 |
|
| 35 |
func callFoo() { |
| 36 |
a.Foo() |
| 37 |
} |
| 38 |
|
| 39 |
-- @aFoo -- |
| 40 |
The object has 3 references. Their locations are listed below |
| 41 |
Reference 1 |
| 42 |
Located in the file: $WORKDIR/a/a.go |
| 43 |
The reference is located on line 2, which has content `func Foo() {}` |
| 44 |
|
| 45 |
Reference 2 |
| 46 |
Located in the file: $WORKDIR/a/a.go |
| 47 |
The reference is located on line 5, which has content `Foo()` |
| 48 |
|
| 49 |
Reference 3 |
| 50 |
Located in the file: $WORKDIR/b/b.go |
| 51 |
The reference is located on line 5, which has content `a.Foo()` |
| 52 |
|
| 53 |
-- @aBar -- |
| 54 |
The object has 1 references. Their locations are listed below |
| 55 |
Reference 1 |
| 56 |
Located in the file: $WORKDIR/a/a.go |
| 57 |
The reference is located on line 10, which has content `func (T) Bar() {}` |
| 58 |
|