Infrastructure changes to support scoped symbols
Summary: - import_project_symbols supports an optional extra field, which is the context of the symbol. - Symbol query can take a symbol argument, either as a parameter or a URL component (so you can now jump nav to `s Zerg/rush`, for example). - Conduit method not yet updated. Will do that later. NOTE: Not providing a context is distinct from providing an empty context, because an empty context stands for top-level context, i.e. functions and classes for PHP. It will not find class methods, etc. It is possible that we should use some weird token that could not normally be a context name to stand in for empty context. Test Plan: Do a bunch of symbol searches. Reviewers: epriestley Reviewed By: epriestley CC: nh, aran, Korvin Maniphest Tasks: T1602 Differential Revision: https://secure.phabricator.com/D3148
This commit is contained in:
@@ -31,6 +31,10 @@ final class DiffusionSymbolController extends DiffusionController {
|
||||
$query = new DiffusionSymbolQuery();
|
||||
$query->setName($this->name);
|
||||
|
||||
if ($request->getStr('context') !== null) {
|
||||
$query->setContext($request->getStr('context'));
|
||||
}
|
||||
|
||||
if ($request->getStr('type')) {
|
||||
$query->setType($request->getStr('type'));
|
||||
}
|
||||
@@ -122,6 +126,7 @@ final class DiffusionSymbolController extends DiffusionController {
|
||||
|
||||
$rows[] = array(
|
||||
phutil_escape_html($symbol->getSymbolType()),
|
||||
phutil_escape_html($symbol->getSymbolContext()),
|
||||
phutil_escape_html($symbol->getSymbolName()),
|
||||
phutil_escape_html($symbol->getSymbolLanguage()),
|
||||
phutil_escape_html($project_name),
|
||||
@@ -133,6 +138,7 @@ final class DiffusionSymbolController extends DiffusionController {
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'Type',
|
||||
'Context',
|
||||
'Name',
|
||||
'Language',
|
||||
'Project',
|
||||
@@ -140,6 +146,7 @@ final class DiffusionSymbolController extends DiffusionController {
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
'',
|
||||
'',
|
||||
'pri',
|
||||
'',
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery {
|
||||
|
||||
private $context;
|
||||
private $namePrefix;
|
||||
private $name;
|
||||
|
||||
@@ -44,6 +45,15 @@ final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery {
|
||||
/* -( Configuring the Query )---------------------------------------------- */
|
||||
|
||||
|
||||
/**
|
||||
* @task config
|
||||
*/
|
||||
public function setContext($context) {
|
||||
$this->context = $context;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @task config
|
||||
*/
|
||||
@@ -180,6 +190,13 @@ final class DiffusionSymbolQuery extends PhabricatorOffsetPagedQuery {
|
||||
private function buildWhereClause($conn_r) {
|
||||
$where = array();
|
||||
|
||||
if (isset($this->context)) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'symbolContext = %s',
|
||||
$this->context);
|
||||
}
|
||||
|
||||
if ($this->name) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
|
||||
Reference in New Issue
Block a user