diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go index 1f12bca98b..bda2092cb1 100644 --- a/internal/lsp/lsp_test.go +++ b/internal/lsp/lsp_test.go @@ -129,17 +129,23 @@ func (r *runner) CallHierarchy(t *testing.T, spn span.Span, expectedCalls *tests Range: items[0].Range, } if callLocation != loc { - t.Errorf("expected server.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation) + t.Fatalf("expected server.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation) } // TODO: add span comparison tests for expectedCalls once call hierarchy is implemented incomingCalls, err := r.server.IncomingCalls(r.ctx, &protocol.CallHierarchyIncomingCallsParams{Item: items[0]}) + if err != nil { + t.Fatal(err) + } if len(incomingCalls) != 0 { - t.Errorf("expected no incoming calls but got %d", len(incomingCalls)) + t.Fatalf("expected no incoming calls but got %d", len(incomingCalls)) } outgoingCalls, err := r.server.OutgoingCalls(r.ctx, &protocol.CallHierarchyOutgoingCallsParams{Item: items[0]}) + if err != nil { + t.Fatal(err) + } if len(outgoingCalls) != 0 { - t.Errorf("expected no outgoing calls but got %d", len(outgoingCalls)) + t.Fatalf("expected no outgoing calls but got %d", len(outgoingCalls)) } } diff --git a/internal/lsp/source/call_hierarchy.go b/internal/lsp/source/call_hierarchy.go index 6ec7a714a7..23425b9225 100644 --- a/internal/lsp/source/call_hierarchy.go +++ b/internal/lsp/source/call_hierarchy.go @@ -56,6 +56,9 @@ func IncomingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pos pr ctx, done := event.Start(ctx, "source.incomingCalls") defer done() + // TODO: Remove this once the context is used. + _ = ctx // avoid staticcheck SA4006 warning + return []protocol.CallHierarchyIncomingCall{}, nil } @@ -64,5 +67,8 @@ func OutgoingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pos pr ctx, done := event.Start(ctx, "source.outgoingCalls") defer done() + // TODO: Remove this once the context is used. + _ = ctx // avoid staticcheck SA4006 warning + return []protocol.CallHierarchyOutgoingCall{}, nil } diff --git a/internal/lsp/source/source_test.go b/internal/lsp/source/source_test.go index 8bc69f3ace..5906ccfd5f 100644 --- a/internal/lsp/source/source_test.go +++ b/internal/lsp/source/source_test.go @@ -123,17 +123,23 @@ func (r *runner) CallHierarchy(t *testing.T, spn span.Span, expectedCalls *tests Range: items[0].Range, } if callLocation != loc { - t.Errorf("expected source.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation) + t.Fatalf("expected source.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation) } // TODO: add span comparison tests for expectedCalls once call hierarchy is implemented incomingCalls, err := source.IncomingCalls(r.ctx, r.snapshot, fh, loc.Range.Start) + if err != nil { + t.Fatal(err) + } if len(incomingCalls) != 0 { - t.Errorf("expected no incoming calls but got %d", len(incomingCalls)) + t.Fatalf("expected no incoming calls but got %d", len(incomingCalls)) } outgoingCalls, err := source.OutgoingCalls(r.ctx, r.snapshot, fh, loc.Range.Start) + if err != nil { + t.Fatal(err) + } if len(outgoingCalls) != 0 { - t.Errorf("expected no outgoing calls but got %d", len(outgoingCalls)) + t.Fatalf("expected no outgoing calls but got %d", len(outgoingCalls)) } }