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

Fix language_js regex constant detection #1581

Merged
merged 4 commits into from
Nov 29, 2023

Conversation

Guldoman
Copy link
Member

This should improve regex constant detection in js.

Before:
Schermata del 2023-08-13 18-31-41

After:
Schermata del 2023-08-13 18-32-22

Fixes #1580.

The initial (?<=^|[(,;=]) doesn't really work, because #860 makes the regex engine only receive the part we're trying to match, so the lookbehind doesn't work properly.
We could solve this by using subsyntaxes, but this would make the plugin way more complex, or by reverting #860, but we'd need to find a different solution for the problem it fixes.

@Guldoman Guldoman force-pushed the PR_improve_js_regex branch 2 times, most recently from 68569f7 to 9f3301c Compare September 6, 2023 23:45
@Guldoman
Copy link
Member Author

Guldoman commented Sep 6, 2023

With the latest changes this should be even more robust, and will allow in the future to match elements inside the pattern more easily.

@Guldoman Guldoman force-pushed the PR_improve_js_regex branch from c933ef9 to fb0c3dc Compare November 8, 2023 02:48
…tion

This avoids more catastrophic backtracking cases.
@Guldoman
Copy link
Member Author

Guldoman commented Nov 8, 2023

With the latest commits the regex has been simplified a bit.

@adamharrison
Copy link
Member

I love you Guldo. You know that right? You're awesome. I'll port these changes to the .jsx plugin as well when this is merged.

@adamharrison
Copy link
Member

Whatever it is, it's better than what we've got. Merging.

@adamharrison adamharrison merged commit 1c10bb8 into lite-xl:master Nov 29, 2023
9 checks passed
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Nov 30, 2023
* Fix `language_js` regex constant detection

* Simplify regex constant detection in `language_js`

* Add more possessive quantifiers in `language_js` regex constant detection

This avoids more catastrophic backtracking cases.

* Allow `.` after regex constant in `language_js`
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Nov 30, 2023
* Fix `language_js` regex constant detection

* Simplify regex constant detection in `language_js`

* Add more possessive quantifiers in `language_js` regex constant detection

This avoids more catastrophic backtracking cases.

* Allow `.` after regex constant in `language_js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

wrong syntax highlight after divide / sign
2 participants