Pressing '.' in a string incorrectly displays intelliprompt

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0545
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar
Repro Steps:

1. Open the Actipro Sample Browser
2. Open the C# Editor Sample
3. Add the following text below the Console.WriteLine command:

"bob"
4. Between the last 'b' in Bob and the close quote, type '.' (no quotes)
5. Notice that you get intelliprompt within the quoted string, which is incorrect behavior.

Question:
I've remedied this by using the following code:

if (e.TypedText == ".")
{
    var reader = editor.ActiveView.GetReader();
    var token = reader.Token;
    if (token != null && token.Id != CSharpTokenId.LiteralString && token.Id != CSharpTokenId.LiteralVerbatimString)
    {
        // request session
    }
}
Is this approach the best way to detect if I'm typing within a string?

Thanks,

-Craig

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

Thanks for reporting this, we've fixed it for the next version.

Yes what you have is fine as a workaround although you may wish to allow it if you are at the token start offset since that is right before the string.


Actipro Software Support

Posted 13 years ago by Craig - Varigence, Inc.
Avatar
So, to clarify, you're suggesting I do the following?


if (e.TypedText == ".")
{
    var reader = editor.ActiveView.GetReader();
    var token = reader.Token;  

    if (token != null)
    {
        if (token.StartOffset == reader.Offset || (token.Id != CSharpTokenId.LiteralString && token.Id != CSharpTokenId.LiteralVerbatimString))
        {
            // request session
        }
    }
}
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, and we also added checks for character literals and comments as well.


Actipro Software Support

The latest build of this product (v24.1.3) 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.