Skip to content

Improve backwards navigation through code intel events

Created by: shrouxm

  • on Sourcegraph.com, we create a new browser history entry on every code intel related click. we should only generate browser history entries when a definition or reference is jumped to, not when a symbol is clicked or when a list of definitions or references is retrieved. we should not generate a new entry when jumping from a symbol to itself.
  • this will disable the currently possible workflow where you can click a line, causing the line number to be appended to your current URL address, and then copy that address to link someone to a file at a specific location. if it's possible to update the address bar without creating a history entry, we should do this for backwards compat. a better long term solution would be to add anchors next to the line numbers (similar to those next to headers in a Markdown document) which when clicked jump to that line and create a history entry. this matches my expectations from how other web documents work, but may get punted to a future issue.
  • when jumping to a symbol (because following a def/ref or moving backwards through browser history), it should be visually clear what is happening:
    • we should open a hover popover on the symbol being jumped to (we currently only do this when navigating backwards, but not when following a def/ref)
    • when jumping within the same file, we should do a smooth scroll rather than an instant jump
  • question for someone who knows web better than i do: is it possible to add this behaviour to code hosts, or do we think it's a big yikes do mess with browser history on other sites?