Page MenuHomePhabricator

Maybe allow ctrl-click to search for any symbol?
Closed, ResolvedPublic

Description

I got the ground-works for T7984: Symbols: support for External Symbols in other languages ready, and was trying to implement another source, when I hit the fact that for non-php, we do really bad job at detecting what words should be searchable.

For most languages, this is a really hard problem, because figuring out if a name is global (searchable) or local, or a variable or a method, or finding the right context, requires more power than a lexer can get.

So maybe leave it to the user to say "This is a word I want to search", by holding down the ctrl key?

Have we tried this before?

Revisions and Commits

Event Timeline

avivey claimed this task.
avivey raised the priority of this task from to Needs Triage.
avivey updated the task description. (Show Details)
avivey added a project: Symbols.
avivey added a subscriber: avivey.

We haven't tried this before, and it seems reasonable to me to try. A couple of thoughts:

  • Maybe shift-click or alt/option-click, rather than control-click specifically? At least on OSX, control-click already opens a context menu.
  • I think the lexer is still going to have to be good enough to split words up. For example, if class::method parses as a single token, I don't think we can easily tell whether the user clicked the "class" word or the "method" word. Splitting words is an easier problem, but it's possible it isn't much easier and that the existing Pygments lexers aren't very good at it.

Or everyone could switch to PHP, a robust language which is amenable to static analysis.

ctrl is what every IDE I've ever used (Windows/Linux) uses, so I'm trying to keep this convention. It's probably the apple key on a mac?

Discoverability is a problem now, and the best idea so far is add a note somewhere.

@chad - can you help suggest a way to put a note / anything better?

Additional memo: crtl+click doesn't work. One should press control first and move mouse outside/inside.

Note idea: very transparent grey color note to the top right corner of the first diff ' ctrl+click for lookup ' - short so not very annoying.

Maybe this works now?