ITextSnapshotReader.PeekTokenReverse

SyntaxEditor for WPF Forum

Posted 1 year ago by Daisuke Nakada
Version: 18.1.0672
Avatar

Hi,

I just found out that there is a difference in the snapshot reader between before and after calling the PeekTokenReverse method on the ITextSnapshotReader.

 

How to reproduce it:

snapshot text: "a" (only one character)

reader offset: 1

call reader.PeekTokenReverse()

 

Before calling reader.PeekTokenReverse() is called, reader.IsAtTokenStart is true and reader.Token is {[MergableToken: (1, 1)]}. But after calling it, reader.IsAtTokenStart is false and reader.Token is null.

 

I'm seeing this in CSharpContextFactory.UpdateTargetExpression. Inside that method, reader.PeekTokenReverse() is called when the LexicalStateId of the token is DocumentEnd or LineTerminator.

 

Thank you.

Comments (2)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thanks for reporting this.  This only happens at the end of the document, right?  I believe we found the problem and fixed it for the next maintenance release.


Actipro Software Support

Posted 1 year ago by Daisuke Nakada
Avatar

Right. That happens for the document end.

Thank you.

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.