Skip to content

JetBrains: Use symbol indexes instead of names and calculate offsets from URL

Administrator requested to merge ps/jetbrains-symbol-offsets into main

Created by: philipp-spiess

Fixes #36797 (closed) Part-of #36222 (closed)

This PR attempts to do two things:

  1. We currently use the symbol name to identify a symbol within a SymbolMatch. The problem with this is that a file can define multiple symbols with the same name. This currently breaks navigation since we won't be able to find the next sibling if multiple elements have the same names resulting in a loop. To fix this, we apply the same fix that we also use for line matches. Instead of using the symbol name, we use the offset inside the symbol array.
  2. For symbols we did not have offsets for search highlight displays before. The data we have comes with a URL though that has the offset encoded (e.g. '/github.com/gitlabhq/gitlabhq/-/blob/app/controllers/concerns/sourcegraph_decorator.rb?L29:7-29:27). I've added code to parse this offset information and properly forward it to the JS->Java bridge. Works like a charm 🙂

Test plan

Manual testing:

https://user-images.githubusercontent.com/458591/173071065-ad8a13a6-944b-44fd-83e9-3893fa53c292.mov

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading