Incorrect syntax highlighting for non-word character immediately preceding a keyword
Describe the bug Syntax highlighting in IQ# exhibits several issues:
- Type names at the end of operation names are highlighted as types
- Characters before reserved words are highlighted as part of those words
- Reserved words at the beginning of the line (without whitespace before them) are not highlighted
To Reproduce Add the following Q# code to a Q# notebook:
operation SyntaxHighlight () : Unit {
// Type names at the end of operation names are highlighted
ControlledOnInt();
AssertQubit();
ApplyPauliFromBitString(PauliX, true, negate, inputs);
// Characters before reserved words are highlighted as part of those words
{let b =Length(array);}
ApplyToEach(X, array);
ApplyPauliFromBitString(PauliX,true, negate, inputs);
let array = [false, false];
// Reserved words at the beginning of the line (without whitespace before them) are not highlighted
let a = Length();
Adjoint Z(qubit);
Message("Hi");
}
Screenshots

System information
- OS: Windows 10
- Browser: Firefox
Additional context

Since #151 has now been merged, the current behavior for the sample code in the original issue description now looks like this:

Updating title to reflect the remaining issue here, which is that a single non-word character immediately preceding a keyword still gets highlighted as part of the keyword. This is existing behavior, and I haven't found a way to fix this within the confines of CodeMirror simple mode. We would have to implement a custom mode, which would give us a lot more flexibility but would also be a much larger task.