-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify illegal $ tokens in string interpolators #196
Conversation
Fixes scala#195 Scala 2 stops parsing after one of these failures. It does not matter how we highlight the rest. Scala 3 continues parsing assuming the string has been closed. Highlighting the following code as if the string was closed helps to understand the following parsing errors.
I see that Scala 3 considers the string closed when there's an illegal To me, when a highlighter highlights more than I expect as a string, it's a very clear indication that I haven't closed the string properly. I think that's actually the best user experience for a case like this: it indicates very clearly the mistake that I made: the string is unclosed, and that's why I'm seeing the rest highlighted as a string. As soon as I fix that, I'll see the other parsing errors, if there are any. The feedback loop is very short here. When running the compiler, or building a webpage where Pygments is highlighting code, the feedback loop is longer, so it may make sense to put more information about errors at once, but this sometimes comes at the cost of the clarity of the errors. In the example with
This can be implemented as a very simple rule, something along the lines of |
Also fix missing rules for `"""` and `raw`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slow reply on this. These new changes look very good, let's get them merged.
Fixes #195
Scala 2 stops parsing after one of these failures. It does not matter how we highlight the rest.
Scala 3 continues parsing assuming the string has been closed. Highlighting the following code as if the string was closed helps to understand the following parsing errors.