private static TextChangeType CheckWhiteSpaceChange(TextChangeContext context, IAstNode node, PositionType positionType) {
context.ChangedNode = node;
if (string.IsNullOrWhiteSpace(context.OldText) && string.IsNullOrWhiteSpace(context.NewText)) {
// In R there is no line continuation so expression may change when user adds or deletes line breaks.
bool lineBreakSensitive = node is If;
if (lineBreakSensitive) {
string oldLineText = context.OldTextProvider.GetText(new TextRange(context.OldStart, context.OldLength));
string newLineText = context.NewTextProvider.GetText(new TextRange(context.NewStart, context.NewLength));
if (oldLineText.IndexOfAny(CharExtensions.LineBreakChars) >= 0 || newLineText.IndexOfAny(CharExtensions.LineBreakChars) >= 0) {
return TextChangeType.Structure;
}
}
// Change inside token node is destructive: consider adding space inside an indentifier
if (!IsChangeDestructiveForChildNodes(node, context.OldRange)) {
return TextChangeType.Trivial;
}
}
return TextChangeType.Structure;
}