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

Regular expression breaks syntax highlighting #154706

Closed
zaharazod opened this issue Jul 10, 2022 · 2 comments
Closed

Regular expression breaks syntax highlighting #154706

zaharazod opened this issue Jul 10, 2022 · 2 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@zaharazod
Copy link

zaharazod commented Jul 10, 2022

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.69.0
  • OS Version: Debian unstable, Linux 5.18.0

Regular expression breaks syntax highlighting for remainder of the file. The offending line (perl) is here:

if ((($var, $val) = /^\s*([_a-zA-Z0-9]+)\s*=\s*(.*)/) != 2) {

The *'s after each \s seem to be relevant; deleting one fixes the formatting (but deleting two breaks it again).

Steps to Reproduce:

  1. Do above
  2. See error
@RedCMD
Copy link
Contributor

RedCMD commented Jul 11, 2022

Looking at the highlighter code
It looks like regex strings can only come after (, {, ~, &, |, if, unless or a newline.
in your example, the regex is after a =, which isn't supported
image

As a temp work around, you can just surround the regex with brackets (or any other valid character)
image

Or add = to the list of allowed characters
image
image
https://github.com/textmate/perl.tmbundle/blob/a85927a902d6e5d7805f56a653f324d34dfad53a/Syntaxes/Perl.plist#L1174

Should make report to: https://github.com/textmate/perl.tmbundle

@alexr00
Copy link
Member

alexr00 commented Jul 11, 2022

Thanks for the investigation @RedCMD. I've opened an issue in the upstream repo: textmate/perl.tmbundle#52

@alexr00 alexr00 closed this as completed Jul 11, 2022
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream and removed new release labels Jul 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

5 participants