   }
 
   private func extractLeadingTrivia(_ token: TokenSyntax) {
-    var isStartOfFile = token.previousToken == nil
+    var isStartOfFile = token.previousToken(viewMode: .all) == nil
     let trivia = token.leadingTrivia
 
     // If we're at the end of the file, determine at which index to stop checking trivia pieces to

  /// alongside the last token of the given node. Any tokens between `node.lastToken` and the
  /// returned node's `lastToken` are delimiter tokens that shouldn't be preceded by a break.
  private func outermostEnclosingNode(from node: Syntax) -> Syntax? {
    guard let afterToken = node.lastToken?.nextToken, closingDelimiterTokens.contains(afterToken)
    else {
      return nil
    }
    var parenthesizedExpr = afterToken.parent
    while let nextToken = parenthesizedExpr?.lastToken?.nextToken,
      closingDelimiterTokens.contains(nextToken),
      let nextExpr = nextToken.parent
    {

      // Due to visitation order, the matching .open break is added in ParameterClauseSyntax.
      after(node.signature.lastToken, tokens: .close)
    }

    arrangeParameterClause(node.signature.input, forcesBreakBeforeRightParen: node.body != nil)

    // Prioritize keeping "<modifiers> init<punctuation>" together.
