private static void CheckIf(SyntaxNodeAnalysisContext context) { IfStatementSyntax ifStatement = (IfStatementSyntax)context.Node; // Special case for "else if" on the same line. // In that case, we'll check that the statement is more indented then the "else", not the "if". // Highlighting: "if (...)", or "else if (...)" as appropriate SyntaxNode controlNode; SyntaxToken startToken; string conditionLabelText; if (ifStatement.Parent is ElseClauseSyntax elseClause && ifStatement.GetLineNumberToReport() == elseClause.GetLineNumberToReport()) { controlNode = elseClause; startToken = elseClause.ElseKeyword; conditionLabelText = "else if"; }