private static OracleToken BuildToken(StringBuilder builder, int index, CommentType commentType = CommentType.None) { var value = builder.ToString(); var token = new OracleToken(value, index - value.Length, commentType); builder.Clear(); return(token); }
public bool TryFinishFoldingSection(OracleToken token, out FoldingSection foldingSection) { foldingSection = _foldingStacks.Values.SelectMany(s => s).FirstOrDefault(); if (foldingSection == null) { return(false); } foldingSection.FoldingEnd = token.Index + token.Value.Length; return(true); }
public bool TryFinishFoldingSection(string placeholder, string stackKey, OracleToken token, out FoldingSection foldingSection) { var foldingSectionStack = GetFoldingStack(stackKey); var sectionExists = !Equals(token, OracleToken.Empty) && IsScopeValid(placeholder, foldingSectionStack); if (sectionExists) { foldingSection = foldingSectionStack.Pop(); _sectionScopes.Remove(foldingSection); foldingSection.FoldingEnd = token.Index + token.Value.Length; } else { foldingSection = null; } return(sectionExists); }