CSharpRepl
CSharpRepl copied to clipboard
Curly braces in strings manipulate the indentation level
Version
C# REPL 0.6.7+d2955f13e744320cd6331c484e1286c3ed4f8612
What happened?
Entering curly braces ({}) in strings manipulates the current indentation level, despite being regular characters in this context.
This can be reproduced by entering the following snippet:
{
var _ = "}";
Pressing Enter at this point will dedent the next line, which is unexpected. After entering a statement, adding a semicolon (;) or closing curly brace (}) will fix the indentation, like so:
{
var _ = "}";
Console.WriteLine() // putting a ; or } here will fix the indentation
Because the level of indentation is now desynced, closing the code block by adding another closing brace (}) will set the indentation level to -1. Pressing Shift+Enter at this point will crash the REPL; see #378.