[go: up one dir, main page]

Skip to content

Combine Linked File isExpandDown and new special case for expanding up with single files

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussion from !194243 (merged) should be addressed:

  • @GitLabDuo started a discussion: (+1 comment)

    The condition targetIsBeforeMatch && isExpandDown && previousLine && newLine < previousLine.new_line is checking if the target line is before the match line, but we're trying to expand downwards. This is the correct fix for the issue described in the MR, but I'd suggest adding a brief comment to explain this special case for better maintainability:

      // Special case: When the target line is before the match line but the algorithm wants to expand down,
      // we need to expand upwards instead to properly show the target line
      if (targetIsBeforeMatch && isExpandDown && previousLine && newLine < previousLine.new_line) {
  • It's unlikely that isExpandDown is correct in isolation. It is true when it should be false in the special case as described in the linked MR

  • The new code added in the linked MR should probably be combined with the !isExpandDown logic into a simpler "region-based" set of logic that goes through the possible locations and directions (match before, match after, expand up, expand down, expand both).

Edited by 🤖 GitLab Bot 🤖