diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php --- a/src/applications/diviner/storage/DivinerLiveSymbol.php +++ b/src/applications/diviner/storage/DivinerLiveSymbol.php @@ -124,20 +124,35 @@ $parts = array( 'book', $this->getBook()->getName(), - $this->getType(), ); - if ($this->getContext()) { - $parts[] = $this->getContext(); - } - - $parts[] = $this->getName(); - - if ($this->getAtomIndex()) { - $parts[] = $this->getAtomIndex(); + // Method URIs need to be the class and the corresponding anchor + if ($this->getType() == 'method') { + $parts[] = phutil_escape_uri_path_component(DivinerAtom::TYPE_CLASS); + + $atom_data = id(new DivinerLiveAtom())->loadAllWhere( + 'symbolPHID IN (%Ls)', + mpull(array($this), 'getPHID')); + foreach ($atom_data as $atom) { + $atom = DivinerAtom::newFromDictionary($atom->getAtomData()); + $method_class_name = basename($atom->getFile(), '.php'); + $parts[] = phutil_escape_uri_path_component($method_class_name); + } + $parts[] = '#method'; + $parts[] = phutil_escape_uri_path_component($this->getName()); + return '/'.implode('/', $parts); + } else { + $parts[] = $this->getType(); + if ($this->getContext()) { + $parts[] = $this->getContext(); + } + + $parts[] = $this->getName(); + if ($this->getAtomIndex()) { + $parts[] = $this->getAtomIndex(); + } + return '/'.implode('/', $parts).'/'; } - - return '/'.implode('/', $parts).'/'; } public function getSortKey() {