Skip to content

Commit 66566f8

Browse files
author
epriestley
committedMay 21, 2020
Make "Open in Editor" use the simple line number of the current selected block
Summary: Ref PHI1749. Instead of opening files to the last unchanged line on either side of the change, open files to the "simple" line number of the selected block. For inlines, this is the inline line number. For blocks, this is the first new-file line number, or the first old-file line number if no new-file line number exists in the block. This may not always be what the user is hoping for (we can't know what the state of their working copy is) but should produce more obvious behavior. Test Plan: - In Diffusion, used "Open in Editor" with and without line selections. Saw same behavior as before. - Used "n" and "r" to leave an inline with the keyboard, saw same behavior as before. - Used "\" and "Open in Editor" menu item to open a file with: - Nothing selected or changeset selected (line: 1). - An inline selected (line: inline line). - A block selected (line: first line in block, per above). Differential Revision: https://secure.phabricator.com/D21282
1 parent d3d4132 commit 66566f8

File tree

7 files changed

+214
-109
lines changed

7 files changed

+214
-109
lines changed
 

‎resources/celerity/map.php

+39-31
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
'core.pkg.js' => '845355f4',
1414
'dark-console.pkg.js' => '187792c2',
1515
'differential.pkg.css' => '5c459f92',
16-
'differential.pkg.js' => '24616785',
16+
'differential.pkg.js' => 'a7171fb6',
1717
'diffusion.pkg.css' => '42c75c37',
1818
'diffusion.pkg.js' => 'a98c0bf7',
1919
'maniphest.pkg.css' => '35995d6d',
@@ -379,14 +379,15 @@
379379
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'a2ab19be',
380380
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
381381
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
382-
'rsrc/js/application/diff/DiffChangeset.js' => '6e5e03d2',
383-
'rsrc/js/application/diff/DiffChangesetList.js' => 'b51ba93a',
382+
'rsrc/js/application/diff/DiffChangeset.js' => '3a1ca35b',
383+
'rsrc/js/application/diff/DiffChangesetList.js' => 'cc2c5de5',
384384
'rsrc/js/application/diff/DiffInline.js' => '008b6a15',
385385
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
386386
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
387387
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
388388
'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2',
389389
'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => '94243d89',
390+
'rsrc/js/application/diffusion/ExternalEditorLinkEngine.js' => '48a8641f',
390391
'rsrc/js/application/diffusion/behavior-audit-preview.js' => 'b7b73831',
391392
'rsrc/js/application/diffusion/behavior-commit-branches.js' => '4b671572',
392393
'rsrc/js/application/diffusion/behavior-commit-graph.js' => 'ef836bf2',
@@ -484,7 +485,7 @@
484485
'rsrc/js/core/behavior-keyboard-pager.js' => '1325b731',
485486
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '42c44e8b',
486487
'rsrc/js/core/behavior-lightbox-attachments.js' => 'c7e748bf',
487-
'rsrc/js/core/behavior-line-linker.js' => '590e6527',
488+
'rsrc/js/core/behavior-line-linker.js' => '0d915ff5',
488489
'rsrc/js/core/behavior-linked-container.js' => '74446546',
489490
'rsrc/js/core/behavior-more.js' => '506aa3f4',
490491
'rsrc/js/core/behavior-object-selector.js' => '98ef467f',
@@ -645,7 +646,7 @@
645646
'javelin-behavior-phabricator-gesture-example' => '242dedd0',
646647
'javelin-behavior-phabricator-keyboard-pager' => '1325b731',
647648
'javelin-behavior-phabricator-keyboard-shortcuts' => '42c44e8b',
648-
'javelin-behavior-phabricator-line-linker' => '590e6527',
649+
'javelin-behavior-phabricator-line-linker' => '0d915ff5',
649650
'javelin-behavior-phabricator-notification-example' => '29819b75',
650651
'javelin-behavior-phabricator-object-selector' => '98ef467f',
651652
'javelin-behavior-phabricator-oncopy' => 'da8f5259',
@@ -709,6 +710,7 @@
709710
'javelin-dom' => '94681e22',
710711
'javelin-dynval' => '202a2e85',
711712
'javelin-event' => 'c03f2fb4',
713+
'javelin-external-editor-link-engine' => '48a8641f',
712714
'javelin-fx' => '34450586',
713715
'javelin-history' => '030b4f7a',
714716
'javelin-install' => '5902260c',
@@ -774,8 +776,8 @@
774776
'phabricator-darklog' => '3b869402',
775777
'phabricator-darkmessage' => '26cd4b73',
776778
'phabricator-dashboard-css' => '5a205b9d',
777-
'phabricator-diff-changeset' => '6e5e03d2',
778-
'phabricator-diff-changeset-list' => 'b51ba93a',
779+
'phabricator-diff-changeset' => '3a1ca35b',
780+
'phabricator-diff-changeset-list' => 'cc2c5de5',
779781
'phabricator-diff-inline' => '008b6a15',
780782
'phabricator-diff-path-view' => '8207abf9',
781783
'phabricator-diff-tree-view' => '5d83623b',
@@ -1013,6 +1015,13 @@
10131015
'0d2490ce' => array(
10141016
'javelin-install',
10151017
),
1018+
'0d915ff5' => array(
1019+
'javelin-behavior',
1020+
'javelin-stratcom',
1021+
'javelin-dom',
1022+
'javelin-history',
1023+
'javelin-external-editor-link-engine',
1024+
),
10161025
'0eaa33a9' => array(
10171026
'javelin-behavior',
10181027
'javelin-dom',
@@ -1222,6 +1231,20 @@
12221231
'trigger-rule',
12231232
'trigger-rule-type',
12241233
),
1234+
'3a1ca35b' => array(
1235+
'javelin-dom',
1236+
'javelin-util',
1237+
'javelin-stratcom',
1238+
'javelin-install',
1239+
'javelin-workflow',
1240+
'javelin-router',
1241+
'javelin-behavior-device',
1242+
'javelin-vector',
1243+
'phabricator-diff-inline',
1244+
'phabricator-diff-path-view',
1245+
'phuix-button-view',
1246+
'javelin-external-editor-link-engine',
1247+
),
12251248
'3ae89b20' => array(
12261249
'phui-workcard-view-css',
12271250
),
@@ -1306,6 +1329,9 @@
13061329
'javelin-dom',
13071330
'phabricator-draggable-list',
13081331
),
1332+
'48a8641f' => array(
1333+
'javelin-install',
1334+
),
13091335
'48fe33d0' => array(
13101336
'javelin-behavior',
13111337
'javelin-dom',
@@ -1442,12 +1468,6 @@
14421468
'javelin-util',
14431469
'javelin-magical-init',
14441470
),
1445-
'590e6527' => array(
1446-
'javelin-behavior',
1447-
'javelin-stratcom',
1448-
'javelin-dom',
1449-
'javelin-history',
1450-
),
14511471
'5a6f6a06' => array(
14521472
'javelin-behavior',
14531473
'javelin-quicksand',
@@ -1551,19 +1571,6 @@
15511571
'javelin-install',
15521572
'javelin-util',
15531573
),
1554-
'6e5e03d2' => array(
1555-
'javelin-dom',
1556-
'javelin-util',
1557-
'javelin-stratcom',
1558-
'javelin-install',
1559-
'javelin-workflow',
1560-
'javelin-router',
1561-
'javelin-behavior-device',
1562-
'javelin-vector',
1563-
'phabricator-diff-inline',
1564-
'phabricator-diff-path-view',
1565-
'phuix-button-view',
1566-
),
15671574
70245195 => array(
15681575
'javelin-behavior',
15691576
'javelin-stratcom',
@@ -1970,11 +1977,6 @@
19701977
'b517bfa0' => array(
19711978
'phui-oi-list-view-css',
19721979
),
1973-
'b51ba93a' => array(
1974-
'javelin-install',
1975-
'phuix-button-view',
1976-
'phabricator-diff-tree-view',
1977-
),
19781980
'b557770a' => array(
19791981
'javelin-install',
19801982
'javelin-util',
@@ -2082,6 +2084,11 @@
20822084
'phuix-icon-view',
20832085
'phabricator-busy',
20842086
),
2087+
'cc2c5de5' => array(
2088+
'javelin-install',
2089+
'phuix-button-view',
2090+
'phabricator-diff-tree-view',
2091+
),
20852092
'cef53b3e' => array(
20862093
'javelin-install',
20872094
'javelin-dom',
@@ -2422,6 +2429,7 @@
24222429
'phuix-formation-view',
24232430
'phuix-formation-column-view',
24242431
'phuix-formation-flank-view',
2432+
'javelin-external-editor-link-engine',
24252433
),
24262434
'diffusion.pkg.css' => array(
24272435
'diffusion-icons-css',

‎resources/celerity/packages.php

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@
220220
'phuix-formation-view',
221221
'phuix-formation-column-view',
222222
'phuix-formation-flank-view',
223+
224+
'javelin-external-editor-link-engine',
223225
),
224226
'diffusion.pkg.css' => array(
225227
'diffusion-icons-css',

‎src/applications/differential/view/DifferentialChangesetDetailView.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function render() {
252252
'isLowImportance' => $changeset->getIsLowImportanceChangeset(),
253253
'isOwned' => $changeset->getIsOwnedChangeset(),
254254

255-
'editorURI' => $this->getEditorURI(),
255+
'editorURITemplate' => $this->getEditorURITemplate(),
256256
'editorConfigureURI' => $this->getEditorConfigureURI(),
257257

258258
'loaded' => $is_loaded,
@@ -321,7 +321,7 @@ public function getDiff() {
321321
return $this->diff;
322322
}
323323

324-
private function getEditorURI() {
324+
private function getEditorURITemplate() {
325325
$repository = $this->getRepository();
326326
if (!$repository) {
327327
return null;
@@ -342,9 +342,7 @@ private function getEditorURI() {
342342
$path = $changeset->getAbsoluteRepositoryPath($repository, $diff);
343343
$path = ltrim($path, '/');
344344

345-
$line = idx($changeset->getMetadata(), 'line:first', 1);
346-
347-
return $link_engine->getURIForPath($path, $line);
345+
return $link_engine->getURITokensForPath($path);
348346
}
349347

350348
private function getEditorConfigureURI() {

‎webroot/rsrc/js/application/diff/DiffChangeset.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* phabricator-diff-inline
1212
* phabricator-diff-path-view
1313
* phuix-button-view
14+
* javelin-external-editor-link-engine
1415
* @javelin
1516
*/
1617

@@ -33,7 +34,7 @@ JX.install('DiffChangeset', {
3334
this._pathParts = data.pathParts;
3435
this._icon = data.icon;
3536

36-
this._editorURI = data.editorURI;
37+
this._editorURITemplate = data.editorURITemplate;
3738
this._editorConfigureURI = data.editorConfigureURI;
3839
this._showPathURI = data.showPathURI;
3940
this._showDirectoryURI = data.showDirectoryURI;
@@ -87,7 +88,7 @@ JX.install('DiffChangeset', {
8788
_changesetList: null,
8889
_icon: null,
8990

90-
_editorURI: null,
91+
_editorURITemplate: null,
9192
_editorConfigureURI: null,
9293
_showPathURI: null,
9394
_showDirectoryURI: null,
@@ -102,8 +103,8 @@ JX.install('DiffChangeset', {
102103
_isSelected: false,
103104
_viewMenu: null,
104105

105-
getEditorURI: function() {
106-
return this._editorURI;
106+
getEditorURITemplate: function() {
107+
return this._editorURITemplate;
107108
},
108109

109110
getEditorConfigureURI: function() {

0 commit comments

Comments
 (0)
Failed to load comments.