Page MenuHomePhabricator

Diff context for Objective-C doesn't show method name if open brace is on newline
Closed, DuplicatePublic

Description

When Phabricator shows a diff of an Objective-C method where the brace is on a newline after the method name, e.g.

- (void)method5
{

the context for the diff shows a brace, instead of the method name:

Diff with brace instead of method name for Objective-C context.png (427×1 px, 109 KB)

If the brace is on the same line as the name, however, the diff context shows the method name and the brace:

Diff with method name due to brace on same line.png (430×1 px, 105 KB)

It'd be more helpful if the context showed the method name as the context even if the opening brace was on the newline.

In case it's relevant, the Phabricator server has Pygments 2.0.2 and git 2.6.1.

Event Timeline

edibiase updated the task description. (Show Details)
edibiase added a subscriber: edibiase.

We run this entire algorithm ourselves and it's pretty simple (basically just looks at indent levels, no language awareness). Should be pretty easy to have it peek at the previous line if it initially finds a line containing only "{" and see if that line is at the same indent level and otherwise suitable.

I'm going to merge this into T11738, which has a more detailed and general discussion of this.