From d17660dafd1dcab2a5ad5d5d24f72b6249375c89 Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Wed, 31 Jul 2024 14:53:45 +0800 Subject: [PATCH] docs: Specify matching behavior for usagesForSymbol(range:) (#64151) Noticed a TODO in the GraphQL schema docs, so figured I'd fill that out. --- .../graphqlbackend/codeintel.codenav.graphql | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/frontend/graphqlbackend/codeintel.codenav.graphql b/cmd/frontend/graphqlbackend/codeintel.codenav.graphql index bf12ed0f70c2..b7107e830cdf 100644 --- a/cmd/frontend/graphqlbackend/codeintel.codenav.graphql +++ b/cmd/frontend/graphqlbackend/codeintel.codenav.graphql @@ -471,8 +471,19 @@ extend type Query { """ Information about an existing source range for a usage of the symbol. - TODO: Specify behavior for various cases of overlap between LookupRange - and actual occurrence range. + + The range must match the underlying occurrence exactly. For example, + if there is code like: + + callMyFunction() + # ^^ (1) + # ^^ (2) + # ^^^^^^^^^^^^^^ (3) + # ^^^^^^^^^^^^^^^^^^^^ (4) + + Only using the range (3) will return correct results. If the range was + obtained from an 'occurrence' in the CodeGraphData.occurrences API, + then the same range should be used here. """ range: RangeInput!