sourcegraph / sourcegraph-public-snapshot

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

Cannot jump to symbol anymore with new smart search field #10023

Open felixfbecker opened 4 years ago

felixfbecker commented 4 years ago

With the old search field, often I would go (or scope) to a repo, then type the name of a symbol. I'd then get symbol suggestions, select one, and jump to it.

The new smart search field shows suggestions for the symbol, but selecting it just completes it, and hitting enter just submits a text search for the symbol.

This breaks this flow of using the search box to quickly find and jump to a symbol.

The problem is also there for files, but at least those will by default show up in the result list.

I can see different possible solutions:

camdencheek commented 9 months ago

@fkling any reason we can't add a command+enter shortcut to symbols like we do for repos?

fkling commented 5 months ago

@camdencheek The main reason for not doing that is that we dedupe symbol suggestions. I.e. if a symbol is references ten times we only show it once. If we want to make command+enter possible then we should not dedupe and add additional information (file, line) to make it possible to distinguish the locations.

However, I wonder how useful that really is. What I think would be more useful is if we could only suggest the definition of the symbol and make that "jumpable", but I don't think we can do that.

camdencheek commented 5 months ago

if we could only suggest the definition of the symbol

I'm not super familiar with symbol search, but it looks like it only returns definitions? e.g., this search does not return any of the places SearchInts is used

fkling commented 5 months ago

I'll have to take a look again then. I remember that we showed lots of duplicate useState suggestions in the past.

camdencheek commented 5 months ago

Ah, interesting. I can reproduce with useState in imports. It looks like maybe this is because, in Javascript, imports are treated as destructures, so we're declaring a file-local variable with the same name as the imported object in the remote file.

camdencheek commented 5 months ago

cc Graph (@varun.gandhi and @anton.sviridov since Linear doesn't support team pings) in case you two have any ideas about yielding only symbols that make sense as jump targets.