-
Notifications
You must be signed in to change notification settings - Fork 28
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
Use simpler string syntax table in Emacs #1587
base: master
Are you sure you want to change the base?
Conversation
This minimally fixes a bug at the cost of slightly worse syntax highlighting for strings. The bug is that, as written, any of `"`, `'`, `{`, or `}` are treated as the `|` (generic string delimiter) syntax class. This means that these act like "string toggles". This has the benefit of allowing things like string interpolation to work: "foo{bar}" ^ ^ ^^ | | || | | |End string | | Start string | End string Start string However, this creates problems if the strings are ever unbalanced. E.g., the following is mis-highlighted without this patch: "foo'bar" ^ ^ ^ | | | | | | | | Start string | End string Start string Avoid all this by just forcing `'` and `"` to make everything inside them strings. This loses the syntax highlighting for string interpolation. However, this seems like a win overall as some internal Wake files run into this bug and I'm seeing the entire file show up as a string. Signed-off-by: Schuyler Eldridge <[email protected]>
I'm tagging @mikeurbach on this as I know he is an Emacs user and I think has higher elisp proficiency than I do. |
Hold off on review/merging this as this has some issues with quote escaping. |
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.
Ah, thanks for the tag. I'm honestly not an elisp expert, but happy to take a look. I've been annoyed by this, and I do agree with the premise of this PR. Sacrificing highlighting of interpolated strings in favor of not highlighting the rest of the file as a string if a '
is used in a string seems like a win.
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.
I know absolutely nothing about Emacs highlighting, but that does seem to be a better strategy, if you can get the quote escaping to work.
This minimally fixes a bug at the cost of slightly worse syntax highlighting for strings. The bug is that, as written, any of
"
,'
,{
, or}
are treated as the|
(generic string delimiter) syntax class. This means that these act like "string toggles". This has the benefit of allowing things like string interpolation to work:However, this creates problems if the strings are ever unbalanced. E.g., the following is mis-highlighted without this patch:
Avoid all this by just forcing
'
and"
to make everything inside them strings. This loses the syntax highlighting for string interpolation. However, this seems like a win overall as some internal Wake files run into this bug and I'm seeing the entire file show up as a string.