feat(lsp): add workspace symbol search
Assisted-by: MiMo V2.5 Pro
This commit is contained in:
@@ -450,6 +450,31 @@ func TestDocumentHighlights(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestWorkspaceSymbols(t *testing.T) {
|
||||
in := session("file:///f_amd64.s", cleanDoc) +
|
||||
frame(13, "workspace/symbol", map[string]any{
|
||||
"query": "foo",
|
||||
}) + frame(nil, "exit", nil)
|
||||
msgs := run(t, in)
|
||||
resp := findByID(msgs, 13)
|
||||
if resp == nil {
|
||||
t.Fatal("no workspace/symbol response")
|
||||
}
|
||||
var syms []WorkspaceSymbol
|
||||
if err := json.Unmarshal(mustResult(t, resp), &syms); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
found := false
|
||||
for _, s := range syms {
|
||||
if s.Name == "foo" {
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("want symbol foo in results, got %+v", syms)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMethodNotFound(t *testing.T) {
|
||||
in := frame(9, "bogus/method", map[string]any{}) + frame(nil, "exit", nil)
|
||||
msgs := run(t, in)
|
||||
|
||||
Reference in New Issue
Block a user