Skip to content

Conversation

@reese
Copy link
Contributor

@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
Contributor Author

reese commented Jan 15, 2026

I have signed the CLA!

@rafaelfranca rafaelfranca added the bugfix This PR will fix an existing bug label Jan 19, 2026
@rafaelfranca rafaelfranca added the vscode This pull request should be included in the VS Code extension's release notes label Jan 19, 2026
@rafaelfranca rafaelfranca merged commit c4526f5 into Shopify:main Jan 19, 2026
21 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants