Skip to content
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

?" confuses the syntax highlighter #185

Closed
gausby opened this issue May 19, 2015 · 9 comments
Closed

?" confuses the syntax highlighter #185

gausby opened this issue May 19, 2015 · 9 comments

Comments

@gausby
Copy link
Contributor

gausby commented May 19, 2015

Hi, thanks for a great package. I have a small problem and I think this is the right repo to report it in.

"\"foo\"" |> String.strip(?")

Will confuse the syntax highlighter. Everything to the end of the file will be considered as a binary.

@andreas-roehler
Copy link
Contributor

Am 19.05.2015 um 17:30 schrieb Martin Gausby:

Hi, thanks for a great package. I have a small problem and I think
this is the right repo to report it in.

""foo"" |> String.strip(?")

Will confuse the syntax highlighter. Everything to the end of the file
will be considered as a binary.


Reply to this email directly or view it on GitHub
#185.

The doublequote is special, needs to be quoted as a literal

""foo"" |> String.strip(?")

@gausby
Copy link
Contributor Author

gausby commented May 19, 2015

Okay, that works. But I guess ?" is valid Elixir, so I guess the highlighter should take it into account. (I wish I know more about elisp so I could give it a hurl myself)

@mattdeboard
Copy link
Contributor

@gausby You are correct, it should work like this, and the fact that ?" is not handled by the highlighter is a bug. However, if I recall correctly, as I was rewriting this mode last year this one specifically was quite difficult to fix. I agree it is annoying.

It can be very complicated. For example, how to tell the syntax highlighter to color the following:

"""
"How should I color this?" she asked
"""

Also note that at least one test deals with this issue. If you wanted to contribute, writing a test that captures your highlighting bug as an expected failure (example) would be a big help.

It is my belief that some of the syntactic choices of Elixir (optional parens w/ significant whitespace, using ? as an escape character) are not easily handled with the syntax highlighting and indentation mechanisms for language modes in Emacs. This is a problem with Emacs, not Elixir. That said, I am positive there is a way to accomplish this. Having a failing test to work against would be a great starting point.

@mattdeboard
Copy link
Contributor

By "if you wanted to contribute" I mean, "If you have the time and inclination to contribute". I think that could be misinterpreted as snark or something, but it definitely is not. Just wanted to clarify.

@gausby
Copy link
Contributor Author

gausby commented May 20, 2015

I do want to contribute; I was about to start an elixir emacs mode, but then Samuel started rocking hard on Alchemist, so I never got to start learning elisp because I could focus on Elixir (and my daytime job.)

I will look into adding the unit tests, but time are scarce, and I don't have a proper internet connection at home.

Do you know any good material on learning elisp; I know enough to do basic stuff in my emacs.d

@andreas-roehler
Copy link
Contributor

Am 20.05.2015 um 07:31 schrieb Martin Gausby:

I do want to contribute; I was about to start an elixir emacs mode,
but then Samuel started rocking hard on Alchemist, so I never got to
start learning elisp because I could focus on Elixir (and my daytime job.)

I will look into adding the unit tests, but time are scarce, and I
don't have a proper internet connection at home.

Do you know any good material on learning elisp; I know enough to do
basic stuff in my emacs.d


Reply to this email directly or view it on GitHub
#185 (comment).

Going through Elisp as provided by info was great for me.

@mattdeboard
Copy link
Contributor

Good news and bad news.

Bad news is, this still isn't fixed.

The good news is, @andreas-roehler's TQS implementation does not get thrown off by ?" tokens. That is, ?" is highlighted normally in a triple-quoted string. This is good news because it means the solution, or a solution, can be adapted from his code for use in single-quoted strings.

@tonini
Copy link
Contributor

tonini commented Apr 21, 2016

Hey @syohex

Do you think you could have a look at this issue if you get some time?

Thanks

@tonini
Copy link
Contributor

tonini commented Apr 21, 2016

Fixed by #340

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants