diff --git a/src/definition/bazel_goto_definition_provider.ts b/src/definition/bazel_goto_definition_provider.ts index e378bcc2..a0090404 100644 --- a/src/definition/bazel_goto_definition_provider.ts +++ b/src/definition/bazel_goto_definition_provider.ts @@ -16,7 +16,6 @@ import { Definition, DefinitionLink, DefinitionProvider, - Location, Position, TextDocument, Uri, @@ -59,12 +58,18 @@ export class BazelGotoDefinitionProvider implements DefinitionProvider { return null; } const result = queryResult.target[0]; + let location; if (result.type === blaze_query.Target.Discriminator.RULE) { - const location = new QueryLocation(result.rule.location); - return new Location(Uri.file(location.path), location.range); + location = new QueryLocation(result.rule.location); } else { - const location = new QueryLocation(result.sourceFile.location); - return new Location(Uri.file(location.path), new Position(0, 0)); + location = new QueryLocation(result.sourceFile.location); } + return [ + { + originSelectionRange: range, + targetUri: Uri.file(location.path), + targetRange: location.range, + }, + ]; } }