As a digression, this is exactly the same issue that I have with autoformatters. For example, clang-format under default settings turns your example into:
const neighbors = get(x - 1, y - 1, w, h, prev) + get(x, y - 1, w, h, prev) +
get(x + 1, y - 1, w, h, prev) + get(x - 1, y, w, h, prev) +
get(x + 1, y, w, h, prev) + get(x - 1, y + 1, w, h, prev) +
get(x, y + 1, w, h, prev) + get(x + 1, y + 1, w, h, prev)
In the past, I've resorted to things like adding no-op `+ 0` for alignment and empty comments to force it to preserve line breaks while still allowing it to autoformat the rest:
const neighbors = get(x - 1, y - 1, w, h, prev) + //
get(x + 0, y - 1, w, h, prev) + //
get(x + 1, y - 1, w, h, prev) + //
get(x - 1, y + 0, w, h, prev) + //
get(x + 1, y + 0, w, h, prev) + //
get(x - 1, y + 1, w, h, prev) + //
get(x + 0, y + 1, w, h, prev) + //
get(x + 1, y + 1, w, h, prev)
I
really wish that autoformatters had the smarts to understand that if more than X% of the non-whitespace columns within a block repeat the same character from top to bottom, then the lines are probably intentionally aligned that way and that it should try very hard to preserve that alignment. That would eliminate my one real objection to autoformatters. (Bonus points for detecting parallel structure in the code and exposing it through alignment in the first place, but that's a much harder generalization of the problem. I'd settle for just leaving that to me and then not destroying it.)