@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide character position information to symbol queries

Summary: Depends on D18937. Ref T13047. When available, provide character positions so external indexers can return more accurate results.

Test Plan: Clicked symbols in Safari, Firefox and Chrome, got sensible-looking character positions.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13047

Differential Revision: https://secure.phabricator.com/D18939

+67 -12
+9 -9
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '4c79d74f', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '45951e9e', 16 - 'differential.pkg.js' => 'c1af2de3', 16 + 'differential.pkg.js' => 'b69ae3ec', 17 17 'diffusion.pkg.css' => 'a2d17c7d', 18 18 'diffusion.pkg.js' => '6134c5a1', 19 19 'favicon.ico' => '30672e08', ··· 443 443 'rsrc/js/application/releeph/releeph-preview-branch.js' => 'b2b4fbaf', 444 444 'rsrc/js/application/releeph/releeph-request-state-change.js' => 'a0b57eb8', 445 445 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'de2e896f', 446 - 'rsrc/js/application/repository/repository-crossreference.js' => 'c5627622', 446 + 'rsrc/js/application/repository/repository-crossreference.js' => 'fc2d8ffd', 447 447 'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e2e0a072', 448 448 'rsrc/js/application/search/behavior-reorder-queries.js' => 'e9581f08', 449 449 'rsrc/js/application/slowvote/behavior-slowvote-embed.js' => '887ad43f', ··· 692 692 'javelin-behavior-reorder-applications' => '76b9fc3e', 693 693 'javelin-behavior-reorder-columns' => 'e1d25dfb', 694 694 'javelin-behavior-reorder-profile-menu-items' => 'e2e0a072', 695 - 'javelin-behavior-repository-crossreference' => 'c5627622', 695 + 'javelin-behavior-repository-crossreference' => 'fc2d8ffd', 696 696 'javelin-behavior-scrollbar' => '834a1173', 697 697 'javelin-behavior-search-reorder-queries' => 'e9581f08', 698 698 'javelin-behavior-select-content' => 'bf5374ef', ··· 1922 1922 'javelin-stratcom', 1923 1923 'phabricator-tooltip', 1924 1924 ), 1925 - 'c5627622' => array( 1926 - 'javelin-behavior', 1927 - 'javelin-dom', 1928 - 'javelin-stratcom', 1929 - 'javelin-uri', 1930 - ), 1931 1925 'c587b80f' => array( 1932 1926 'javelin-install', 1933 1927 ), ··· 2164 2158 'javelin-view', 2165 2159 'javelin-install', 2166 2160 'javelin-dom', 2161 + ), 2162 + 'fc2d8ffd' => array( 2163 + 'javelin-behavior', 2164 + 'javelin-dom', 2165 + 'javelin-stratcom', 2166 + 'javelin-uri', 2167 2167 ), 2168 2168 'fc91ab6c' => array( 2169 2169 'javelin-behavior',
+7
src/applications/diffusion/controller/DiffusionSymbolController.php
··· 69 69 $external_query->withLines(array($request->getInt('line'))); 70 70 } 71 71 72 + if ($request->getInt('char')) { 73 + $external_query->withCharacterPositions( 74 + array( 75 + $request->getInt('char'), 76 + )); 77 + } 78 + 72 79 if ($repos) { 73 80 $external_query->withRepositories($repos); 74 81 }
+10
src/applications/diffusion/symbol/DiffusionExternalSymbolQuery.php
··· 9 9 private $paths = array(); 10 10 private $lines = array(); 11 11 private $repositories = array(); 12 + private $characterPositions = array(); 12 13 13 14 public function withLanguages(array $languages) { 14 15 $this->languages = $languages; ··· 40 41 return $this; 41 42 } 42 43 44 + public function withCharacterPositions(array $positions) { 45 + $this->characterPositions = $positions; 46 + return $this; 47 + } 48 + 43 49 public function withRepositories(array $repositories) { 44 50 assert_instances_of($repositories, 'PhabricatorRepository'); 45 51 $this->repositories = $repositories; ··· 72 78 73 79 public function getRepositories() { 74 80 return $this->repositories; 81 + } 82 + 83 + public function getCharacterPositions() { 84 + return $this->characterPositions; 75 85 } 76 86 77 87 public function matchesAnyLanguage(array $languages) {
+41 -3
webroot/rsrc/js/application/repository/repository-crossreference.js
··· 28 28 nf : 'function', 29 29 na : null, 30 30 nb : 'builtin', 31 - n : null, 32 - }; 31 + n : null 32 + }; 33 33 34 34 function link(element, lang) { 35 35 JX.DOM.alterClass(element, 'repository-crossreference', true); ··· 56 56 } 57 57 } catch (ex) { 58 58 // Continue if we're not inside an inline comment. 59 + } 60 + 61 + // If only part of the symbol was edited, the symbol name itself will 62 + // have another "<span />" inside of it which highlights only the 63 + // edited part. Skip over it. 64 + if (JX.DOM.isNode(target, 'span') && (target.className === 'bright')) { 65 + target = target.parentNode; 59 66 } 60 67 61 68 if (e.getType() === 'mouseover') { 62 - while (target !== document.body) { 69 + while (target && target !== document.body) { 63 70 if (JX.DOM.isNode(target, 'span') && 64 71 (target.className in class_map)) { 65 72 highlighted = target; ··· 105 112 var path = getPath(target); 106 113 if (path !== null) { 107 114 query.path = path; 115 + } 116 + 117 + var char = getChar(target); 118 + if (char !== null) { 119 + query.char = char; 108 120 } 109 121 110 122 var uri = JX.$U('/diffusion/symbol/' + symbol + '/'); ··· 171 183 } 172 184 173 185 return JX.Stratcom.getData(changeset).path; 186 + } 187 + 188 + function getChar(target) { 189 + var cell = JX.DOM.findAbove(target, 'td'); 190 + if (!cell) { 191 + return null; 192 + } 193 + 194 + var char = 1; 195 + for (var ii = 0; ii < cell.childNodes.length; ii++) { 196 + var node = cell.childNodes[ii]; 197 + 198 + if (node === target) { 199 + return char; 200 + } 201 + 202 + var content = '' + node.textContent; 203 + 204 + // Strip off any ZWS characters. These are marker characters used to 205 + // improve copy/paste behavior. 206 + content = content.replace(/\u200B/g, ''); 207 + 208 + char += content.length; 209 + } 210 + 211 + return null; 174 212 } 175 213 176 214 if (config.container) {