public override void ExitWhiteSpace([NotNull] VBAParser.WhiteSpaceContext context) { if (context.GetText().Contains(Environment.NewLine)) { _contexts.Add(context); } }
private int IndentationLevelFromWhitespace(VBAParser.WhiteSpaceContext wsContext) { if (wsContext == null) { return(0); } // the only thing that contains underscores is the line-continuation at this point var lineContinuation = wsContext.children.LastOrDefault((tree) => tree.GetText().Contains("_")); var index = lineContinuation != null?wsContext.children.IndexOf(lineContinuation) : 0; return((wsContext?.ChildCount ?? 0 - index) / _indenterSettings.IndentSpaces); }