Page MenuHomePhabricator

Support scoped symbols
Closed, ResolvedPublic

Description

In PHP, this includes methods, constants, and fields inside classes. In particular, I should be able to click on Zerg::rush() and be linked to the definition of the method rush() inside the class Zerg, as opposed to either nothing or a list of all functions anywhere named rush(). (And if I click on $mystery->meat(), it should find all methods called meat(), since it doesn't know what class to look in.) This obviously can be extended to languages other than PHP.

(Aside: It would also be nice to do symbol search on the fly, to avoid having to run a cron job, but I don't think that's feasible. We could at least scan the changed files whenever a new commit comes in, and regenerate symbols for those files immediately.)

Revisions and Commits

Event Timeline

alanh triaged this task as Normal priority.
alanh added projects: Diffusion, Differential.
alanh added subscribers: alanh, nh.

Do you plan to support these?

PonderQuestionQuery::loadHottest(); // static method in known class
PhabricatorEdgeConfig::TYPE_VOTING_USER_HAS_ANSWER; // constant in known class
$this->feedOffset; // property in unknown class
self::PROFILE_QUESTION_PAGE_SIZE; // constant in unknown class
self::$pages; // static variable in unknown class

(Examples from D3136.)

All of those should be supported already. If you're asking about this install, at a guess, libphutil hasn't been upgraded.

Ah, cool. It was just stale cache. D3136?whitespace=show-all works except self::$pages - will you support that?

Maybe it's worth bumping DifferentialChangesetParser::CACHE_VERSION once you finish with this.

Doesn't seem like it should be that hard. I'll look at it tomorrow.

Oh huh, I didn't know that existed. Yeah, probably.

Do you plan to support this feature also in comments like this?

$revision = new DifferentialRevision();

There will false positives in code like new C() but I think that it will be useful overall.

alanh edited this Maniphest Task.

It would also be cool to allow specifying relations between symbols, e.g. X extends Y or x() calls y(). But that wants a new database table, and since symbols don't have stable ids it'd have to index by (context+)name...

Not sure which revision this relates to, but clicking this sends me to a completely wrong locations :S

Oh, looks like I was looking at that completely wrong.

Any plans to expose this to conduit's symbol method?

chad changed the visibility from "All Users" to "Public (No Login Required)".Jul 3 2015, 4:37 AM
eadler added a project: Restricted Project.Aug 5 2016, 5:24 PM
epriestley added a subscriber: epriestley.

I believe this is supported now (and for some time) in the general case in terms of Phabricator infrastructure. Actually getting it to work requires a very smart highlighter, and the upstream XHPAST highlighter is the only one in existence. But other tasks, like T3130, are better homes for parser/AST improvements to particular languages.