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

[language-php] Injection logic should not throw exceptions #1032

Closed
5 tasks done
savetheclocktower opened this issue Jun 22, 2024 · 0 comments
Closed
5 tasks done

[language-php] Injection logic should not throw exceptions #1032

savetheclocktower opened this issue Jun 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@savetheclocktower
Copy link
Contributor

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

Because of the strange way that tree-sitter-php structures its tree, I use an unusual method to determine which ranges of a .php file are HTML and which are PHP. It tries to match balanced pairs of <?php (and equivalent) and ?>.

But I did something silly: when it finds an unbalanced token, it throws an exception! This exception goes uncaught and ends up preventing any editing attempts by the user.

Instead, it should be more tolerant of errors, and do something logical, even if it's not going to be correct. (The code is syntactically invalid in this scenario, so there is no such thing as “correct”; favor the solution that keeps the editor running.)

Pulsar version

1.118

Which OS does this happen on?

❓ Other(Please specify in the OS details field below)

OS details

(any OS)

Which CPU architecture are you running this on?

None

What steps are needed to reproduce this?

I was able to reproduce this issue by following the instructions in this issue comment.

Additional Information:

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant