ALSchwalm / janet-mode

A major mode for the janet programming language: https://janet-lang.org/
GNU General Public License v3.0
47 stars 14 forks source link

Correctly handle backtick strings, including nesting. Fix #9. #12

Open AlbertoGP opened 3 years ago

sogaiu commented 3 years ago

@AlbertoGP Thanks for this -- at least locally it seems to yield a nicer experience with code such as this:

(decl-normalize "win32" `\` (set `\/`) (* (? (* (range "AZ" "az") `:`)) `\`))

I had been noticing weirdness when using janet-mode with rainbow-delimiters-mode, but this PR seems to help for at least the above case.

Here's a screenshot of how things can look without the PR code:

janet-mode-backticks-rainbow-delimiters

Here, the upper left white rectangle is the cursor.

I don't know why the closing parenthesis on the last line has a white background.

In any case, the "rainbow" colors are broken in the decl-normalize form.

The initial opening parenthesis is red (to the left of decl-normalize) while the matching closing one is orange (last visible character on the line that has (* (? (* ...).

Starting from the opening parenthesis to the left of set, the rainbow colors seem to go away, only to resume after the last backtick.