Skip to content

Conversation

@reese
Copy link

@reese reese commented Jan 15, 2026

Motivation

Closes #1786

This fixes an issue with syntax highlighting where slashes at the end of lines, such as for division across lines, strings with slashes at the end of lines, etc. were being read as regex contents. This would cause many lines of the source to be rendered in the same color, essentially removing any practical syntax highlighting. This would continue until another backslash was seen.

Implementation

This change makes two changes to the regex grammar. The first (the addition of (?!\\s*$)) is a negative lookahead to reject / when followed only by whitespace until end of line. The second change removed the | $ alternative that incorrectly allowed matching at end of line without a closing /.

Automated Tests

See the added automated tests.

Manual Tests

I opened up a VSCode window with these changes.

Before ❌

Screenshot 2026-01-15 at 1 07 19 PM

After ✅

Screenshot 2026-01-15 at 1 07 57 PM

@reese reese requested a review from a team as a code owner January 15, 2026 14:25
@reese reese changed the title Fix syntax highlighting for line-ending backslashes Fix syntax highlighting for line-ending forward slashes Jan 15, 2026
@reese
Copy link
Author

reese commented Jan 15, 2026

I have signed the CLA!

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.

Syntax highlighting fails when / is at the end of the line

1 participant