KapitanOczywisty / language-php

PHP package for Atom
Other
3 stars 3 forks source link

Broken syntax highlighting when missing closing parenthesis character in query string #11

Open syrsly opened 1 year ago

syrsly commented 1 year ago

Also posted to Pulsar issues at https://github.com/pulsar-edit/pulsar/issues/787

Description

When the "language-php" package is enabled and I'm in a PHP script, if I create a "(" character but don't close it, this screws up the formatting for everything after it for the rest of the script, whether it's 10 lines or 7000 lines and regardless of whether or not I later close the parenthesis.

This seems like it's an issue that's been around and mentioned before in the Atom issues, but since it hasn't been addressed in years and is now an issue in Pulsar, I figured I should mention it.

I propose that we add some kind of logic to the language-php package that says, if we can't find a closing parenthesis character ")" by the end of the line, we reset the formatting to normal. Could also add some kind of toggle to turn off the string formatting in case it annoys anyone.

Steps to Reproduce

  1. Enable language-php package with default settings,
  2. open a php file,
  3. insert a string variable with the start of parenthesis "(" character in the string,
  4. create more lines of code after this string and notice the later lines are all appearing to be part of the string.

Expected behavior: Proper syntax highlighting!

Actual behavior: Broken highlighting/coloring of rest of code in script.

Reproduces how often: 100% of the time. Easily reproducible.

Versions

Pulsar 1.110.0 as well at the last version of Atom before it was sunsetted.

Additional Information

Image below taken from old issue at https://github.com/atom/language-php/issues/442 firefox_bwiaLfRVHw

KapitanOczywisty commented 1 year ago

This is known issue, and unfortunately rather hard to fix.

syrsly commented 1 year ago

This is known issue, and unfortunately rather hard to fix.

Even if it's a known issue, it keeps getting waved away as too hard to fix, and if people don't reopen the issue like I did, it'll continually get ignored.

What specifically makes it hard to fix? Is there a known workaround other than just not having incomplete query strings? Incomplete strings are necessary logic pieces for a query builder script.