public virtual IChameleonNode ReSync(CachingLexer cachingLexer, TreeTextRange changedRange, int insertedTextLen) { TreeTextRange oldRange = this.GetTreeTextRange(); Logger.Assert(changedRange.ContainedIn(oldRange), "The condition “changedRange.ContainedIn(oldRange)” is false."); int newLength = oldRange.Length - changedRange.Length + insertedTextLen; // Find starting comment if (!cachingLexer.FindTokenAt(oldRange.StartOffset.Offset) || cachingLexer.TokenType != this.GetTokenType() || cachingLexer.TokenStart != oldRange.StartOffset.Offset || cachingLexer.TokenEnd != oldRange.StartOffset.Offset + newLength) { return(null); } var element = TreeElementFactory.CreateLeafElement( cachingLexer.TokenType, new ProjectedBuffer( cachingLexer.Buffer, new TextRange(cachingLexer.TokenStart, cachingLexer.TokenStart + newLength)), 0, newLength); var comment = element as Comment; if (comment == null || this.CommentType != comment.CommentType) { return(null); } return(comment); }
public override void FindNodesAtInternal(TreeTextRange relativeRange, List <ITreeNode> result, bool includeContainingNodes) { if (relativeRange.ContainedIn(TreeTextRange.FromLength(GetTextLength()))) { base.FindNodesAtInternal(relativeRange, result, includeContainingNodes); } }
public override IChameleonNode FindChameleonWhichCoversRange(TreeTextRange textRange) { if (textRange.ContainedIn(TreeTextRange.FromLength(GetTextLength()))) { return(base.FindChameleonWhichCoversRange(textRange) ?? this); } return(null); }
public IChameleonNode ReSync(CachingLexer cachingLexer, TreeTextRange changedRange, int insertedTextLen) { TreeTextRange oldRange = this.GetTreeTextRange(); Logger.Assert(changedRange.ContainedIn(oldRange), "The condition “changedRange.ContainedIn(oldRange)” is false."); int newLength = oldRange.Length - changedRange.Length + insertedTextLen; // Find starting comment if (!cachingLexer.FindTokenAt(oldRange.StartOffset.Offset) || cachingLexer.TokenType != GetTokenType() || cachingLexer.TokenStart != oldRange.StartOffset.Offset || cachingLexer.TokenEnd != oldRange.StartOffset.Offset + newLength) { return null; } LeafElementBase element = TreeElementFactory.CreateLeafElement(cachingLexer.TokenType, new ProjectedBuffer(cachingLexer.Buffer, new TextRange(cachingLexer.TokenStart, cachingLexer.TokenStart + newLength)), 0, newLength); var comment = element as Comment; if (comment == null || CommentType != comment.CommentType) { return null; } return comment; }
public override IChameleonNode FindChameleonWhichCoversRange(TreeTextRange textRange) { return textRange.ContainedIn(TreeTextRange.FromLength(GetTextLength())) ? this : null; }
public override IChameleonNode FindChameleonWhichCoversRange(TreeTextRange textRange) { return(textRange.ContainedIn(TreeTextRange.FromLength(this.GetTextLength())) ? this : null); }
public override IChameleonNode FindChameleonWhichCoversRange(TreeTextRange textRange) { if (textRange.ContainedIn(TreeTextRange.FromLength(GetTextLength()))) { return base.FindChameleonWhichCoversRange(textRange) ?? this; } return null; }