Page MenuHomePhabricator

Extract scope line selection logic from the diff rendering engine so it can reasonably be iterated on
ClosedPublic

Authored by epriestley on Feb 14 2019, 6:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 9:56 AM
Unknown Object (File)
Thu, Mar 28, 4:16 PM
Unknown Object (File)
Mar 16 2024, 12:02 AM
Unknown Object (File)
Feb 20 2024, 5:54 PM
Unknown Object (File)
Feb 3 2024, 9:21 PM
Unknown Object (File)
Jan 25 2024, 1:47 AM
Unknown Object (File)
Dec 22 2023, 1:38 AM
Unknown Object (File)
Dec 18 2023, 10:00 PM
Subscribers
None

Details

Summary

Ref T13249. Ref T11738. See PHI985. Currently, we have a crude heuristic for guessing what line in a source file provides the best context.

We get it wrong in a lot of cases, sometimes selecting very silly lines like "{". Although we can't always pick the same line a human would pick, we can pile on heuristics until this is less frequently completely wrong and perhaps eventually get it to work fairly well most of the time.

Pull the logic for this into a separate standalone class and make it testable to prepare for adding heuristics.

Test Plan

Ran unit tests, browsed various files in the web UI and saw as-good-or-better context selection.

Diff Detail

Repository
rP Phabricator
Branch
scope1
Lint
Lint Passed
SeverityLocationCodeMessage
Advicesrc/infrastructure/diff/PhabricatorDiffScopeEngine.php:115XHP16TODO Comment
Unit
Tests Passed
Build Status
Buildable 22000
Build 30052: Run Core Tests
Build 30051: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Feb 19 2019, 6:19 PM

This and two other followups also all have some flavor of "convert tabs to spaces" or vice versa. I suspect we can have fewer copies of this code eventually, but since it's like 10 lines of code I'm not worrying about it too much for now.

This revision was automatically updated to reflect the committed changes.