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

enh(scala) fix triple quoted string #2987

Merged
merged 3 commits into from Feb 7, 2021

Conversation

joshgoebel
Copy link
Member

@joshgoebel joshgoebel commented Feb 5, 2021

Resolves #2986

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md
  • Added myself to AUTHORS.txt, under Contributors

{
begin: '"""',
end: '"""',
relevance: 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically the main change I see here is that you removed the relevance, and that you changed the order. Can you please explain what do those changes do? Next time I might just contribute it myself :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well if " matches first that breaks everything, so we have to match """ first... and the relevance is a much longer explication... find the thread on huge relevance and read it for a start for more thoughts... 10 is just too high for something that is shared by several languages now, so I removed the huge relevance bump.

The sequencing is what fixes the issue.

@toshetah
Copy link

toshetah commented Feb 6, 2021

I'd add another test of multi line string:

val multiLineString =
  """aaa
    |ddd
    |sdfa""".stripMargin

should produce:

aaa
ddd
sdfa

and:

val multiLineString =
  """aaa
    |ddd
    |sdfa"""

should produce:

aaa
    |ddd
    |sdfa

Code run at Scastie.

@joshgoebel
Copy link
Member Author

If you wanted to contribute additional tests to the project (expanding on strings.txt) that'd be great... long-term it'd be nice to test all the different types of strings, escaping of special chars, etc...

@joshgoebel
Copy link
Member Author

I'd add another test of multi line string:

Of course our parsing engine doesn't care about the how the string is interpreted, we just highlight it. So your last two examples are irrelevant in our context - as far as I can tell. The highlighted is the same in both cases, regardless of what the end result it inside the runtime.

@joshgoebel joshgoebel merged commit b1b0815 into highlightjs:master Feb 7, 2021
Real-John-Cheung pushed a commit to Real-John-Cheung/highlight.js that referenced this pull request Feb 9, 2021
* enh(scala) fix triple quoted string
* add initial string tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Scala) Strings in triple quotes are highlighted incorrectly.
2 participants