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

[PHP] block comments are not working as expected if they are placed inside a <script> tag #3812

Open
arasanoutdoinc opened this issue Jul 21, 2023 · 2 comments
Labels
C: Syntax T: bug A bug in an existing language feature

Comments

@arasanoutdoinc
Copy link

What happened?

image

After applying the patch from this GitHub repository: https://github.com/jfcherng-sublime/ST-my-settings/blob/master/scripts/update_official_packages.sh, the overall functionality seems to be working fine.

However, there is an issue with the PHP block comment inside the script tag, which is not functioning correctly.

followed by #3811

@michaelblyons michaelblyons changed the title PHP block comments are not working as expected if they are placed inside a <script> tag [PHP] block comments are not working as expected if they are placed inside a <script> tag Jul 21, 2023
@michaelblyons
Copy link
Collaborator

It's always helpful to include your sample code as text as well as the screenshot, so testers can copy it without retyping.

@deathaxe
Copy link
Collaborator

deathaxe commented Jul 21, 2023

PHP tags are embedded in CSS/JavaScript to keep syntax size and complexity in sane limits.

- match: <\?(?i:php\b|=)?
scope: meta.embedded.php punctuation.section.embedded.begin.php
embed: Packages/PHP/PHP Source.sublime-syntax
embed_scope: meta.embedded.php source.php.embedded.js
escape: (\?>)(\s*\n)?
escape_captures:
0: meta.embedded.php
1: punctuation.section.embedded.end.php
2: meta.html-newline-after-php.php

PHP Source.sublime-syntax is mainly designed to switch between html<->php.

Not sure what a solution would look like without risk of hitting 25k context sanity limit and keep already significant complexity in sane limits.

It's hard to mix 2 context sensitive syntaxes such as PHP and JavaScript without bloating resource usage and complexity.

Not sure whether its worth for such a tiny edge case. There are likely more when using PHP within JS/CSS. Those are designed to take simple php expressions only.

@deathaxe deathaxe added T: bug A bug in an existing language feature C: Syntax labels Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Syntax T: bug A bug in an existing language feature
Projects
None yet
Development

No branches or pull requests

3 participants