In Bazel 4.2.2 I could do a "go-to-reference" on a source file to get the path of the corresponding BUILD
file, along with the line and column numbers pointing to where the source file is referenced:
bazel query ./main.cpp --output=location
~/project/package/BUILD:124:8: source file //package:main.cpp
In Bazel 5.1.1 this command returns the path of the very same source file:
bazel query ./main.cpp --output=location
~/project/package/main.cpp:1:1: source file //package:main.cpp
How to get the old behavior back?
P.S. This ticket requests the new behavior.
Solution is to use --noincompatible_display_source_file_location
:
bazel query ./main.cpp --output=location --noincompatible_display_source_file_location
~/project/package/BUILD:124:8: source file //package:main.cpp