sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.1k stars 1.27k forks source link

Tracking search and navigation history while drilling down #2065

Open saurabh-hirani opened 5 years ago

saurabh-hirani commented 5 years ago

Feature request description

Sourcegraph is really useful to navigate through large codebases. However, one loses track of retracing steps if they go in too deep. It would be great to have a breadcrumb like search history tracker which can help user get to where they started from.

Is your feature request related to a problem? If so, please describe.

No.

Describe alternatives you've considered.

None.

Additional context

None.

Edit by @attfarhan: Additional requests:

sqs commented 5 years ago

Thanks for posting this! @attfarhan and @beyang have hacked on this (as you know). We will use this issue to monitor interest and share future plans.

sqs commented 5 years ago

Also requested by Twitter user Linda_pp at https://twitter.com/Linda_pp/status/1092369981684105216:

The feature request would be what I want actually. Current browser navigation (forward/back) is poor in terms of code reading (especially speed and scroll position).

attfarhan commented 5 years ago

Adding more details from a previous request (https://github.com/sourcegraph/sourcegraph/issues/425):

We've had a few attempts at adding a history/bookmark-like feature to Sourcegraph to assist with explorations that span multiple files where the user wants to be able to jump quickly between recent interest points in the code.

Latest request is from a user:

I've used Sourcegraph for several months now and I've had a great experience exploring golang/go with it. It's a great tool to dive deep into unfamiliar codebases. A feature I would love to see is to have a dashboard of relevant semantic structures.

As you jump around the codebase from references to invocations, it's easy to lose track of where you started. It would be awesome if there was a sidebar where you could pin these semantic structures that you are actually interested in. For example: we could pin gin-gonic/gin's engine struct and then pin net/http's ListenAndServe method so we can easily hop back and forth. It's kinda like placing markers so we don't get lost exploring the codebase.

Another occasion that this would be helpful is when you are curious about the implementation of a specific function. However, this function calls other functions and those functions call other functions and so on. It gets messy jumping from function definition to function definition. This is the case with many of Go's standard library packages as several of them can be traced back to the syscall package after many layers of function calls.

attfarhan commented 5 years ago

@amarsiingh requested this in https://github.com/sourcegraph/sourcegraph/issues/3025:

Feature request description When a user is going through source code and navigating definitions or references, it would be nice to have a trail or hierarchy at the top, so that user can go back to the original point where he/she started code search from. Is your feature request related to a problem? If so, please describe. currently, once a user starts search through the code, particularly if they're unfamiliar with or new to the repo, they will find it difficult to get back to the original point in navigation history. Describe alternatives you've considered. remembering the original file I was into to go back to.

attfarhan commented 4 years ago

Also requested by @veeral-patel in https://github.com/sourcegraph/sourcegraph/issues/6730.

veeral-patel commented 4 years ago

The problem is that navigating through multiple functions that call each other is difficult in Sourcegraph -- because you need to click the Back button to find previous functions that you look at.

Reading this thread, I think people have suggested a couple solutions:

A stack created by Sourcegraph would mean I the user wouldn't need to add every function I drill to the sidebar.

So I could navigate code faster which is the entire purpose of Sourcegraph. However, as a user I don't always just drill down one function -- I might start exploring a related function in the same file when I'm drilling. This means pinning functions would be useful too.

Of course there's probably a more elegant solution out there, but hopefully this helped you understand the problem a little better.

@attfarhan Thank you for Sourcegraph and I hope this helps!

dpritchett commented 4 years ago

Huge plus-one here. Been trying to mentally model a concurrency issue in a monorepo and IntelliJ’s names bookmarks sidebar isn’t quite enough for me to keep it all straight.

Some sort of bookmarking primitive with a visual map-building playground built on top would be killer.

dpritchett commented 4 years ago

I’d be willing to experiment with building this feature out myself if someone could spare a few minutes to help me understand the relevant APIs required to add a new persistent data model and some browser-side UX. Worst case I try to build a supplemental chrome extension...

christinaforney commented 4 years ago

Hey @dpritchett - I'd love to learn more about your use case! Can you email me at christina@sourcegraph.com and we can set up some time to chat?

github-actions[bot] commented 3 years ago

Heads up @alicjasuska @felixfbecker @umpox @valerybugakov @5h1ru @pdubroy - the "team/frontend-platform" label was applied to this issue.

mrnugget commented 3 years ago

Huge +1 on this. Only yesterday did I realise that this is what I've been missing for a while now. Here's what I wrote on Slack:

I had somewhat of an epiphany yesterday in regards to using Sourcegraph for browsing code while we were talking to Mitchell Hashimoto for Dev Tool Time yesterday (video recording here).

@beyang asked Mitchell what he used for code browsing and Mitchell said that he also tried Sourcegraph but what he was missing from Sourcegraph (and all other products) was the ability to keep track of go-to-definition jumps while exploring code, i.e. keeping track of the call stack.

What he means and what I now realise I've also been missing is the ability to, say, use go-to-definition 4 times in a row, to climb down a call stack and then having some visual representation of that stack of references you just jumped along. And then, ideally, you could go up and down that stack, or save the stack and come back to it later.

When he said this I realised that this is often a reason why I switch from Sourcegraph/GitHub to my editor: I can use Vim's jump list to go back and forth in the code and I then often open a notes file and copy links to the positions in the file.

In Sourcegraph we could also show the list of definitions we jumped along and provide some navigation between them. And since these are just links we could also save such a stack or share it and others can walk it up or down.

I made a really bad mockup (I pasted the first debugger-callstack-screenshot I could find onto our UI) so you get the idea.

If we had this it could replace a lot of local-editor-usecases for me because then I wouldn't have to take these notes (see second screenshot). image (1) image (2)

github-actions[bot] commented 3 years ago

Heads up @macraig - the "team/code-intelligence" label was applied to this issue.

justdueck commented 3 years ago

Adding another +1 to this, FWIW.

I've heard from a couple of our larger customers that this functionality would be extremely useful to them.

hitzhangjie commented 3 years ago

Need this feature, too.