Does Phabricator support searching by class/function name in code hosted in Diffusion


#1

There is a really nice feature on the secure.phabricator.com site which is when I type the name of a function name in arcanist,phabricator or phputil it comes up with the PHP method

image

clicking the method takes me to the code

https://secure.phabricator.com/source/phabricator/browse/master/src/applications/repository/engine/PhabricatorRepositoryMirrorEngine.php$75

This is excellent for browsing the code

image

This path is almost identical to the Diffusion path (but its not identical), so I assume somewhere there is a mapping of search terms to php code destination? (unless your using reflection in php)

is there or has anyone ever proposed a generalized mechanism to allow integration of Diffusion hosted source code (not just php,but c++, etc) into this search mechanism?

Whilst no one would expect phabricator to be able to look for functions in an arbitrary languages which typically get hosted in Git repos, I wondered if there was a way to add source file,location and search terms into the search engine (which could be generated by other external tools) to give similar functionality?


#2

This is supported[1] for self-hosted installs, but not for Phacility.

See https://secure.phabricator.com/book/phabricator/article/diffusion_symbols/ for instructions on how to set this up.

https://secure.phabricator.com/T13047 for how this is going to be modernized.

[1] sort-of


#3

Thats fantastic!!

Download ctags from

git clone https://github.com/arduino/ctags  (its moved from sourceforge)

cd ctags
configure
make
make install

Now make the symbol_data

git clone <localrepo>

find . -type f -name '*.cxx' -o -name '*.h' -o -name '*.cpp' | /opt/phabricator/scripts/symbols/generate_ctags_symbols.php > symbol_data

And import into the repo

 /opt/phabricator/scripts/symbols/import_repository_symbols.php  [repocallsign] < symbol_data

Committing 100,000 symbols...
Looking up path IDs...
Preparing queries...
Purging old symbols...
Loading 100,000 symbols...
Committing 100,000 symbols...
Looking up path IDs...
Preparing queries...
Loading 100,000 symbols...
Looking up path IDs...
Preparing queries...
Loading 2,404 symbols...
Done.

Full search for classes and functions!