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: Add syntax highlighting inside heredoc strings #18368

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

sylbru
Copy link
Contributor

@sylbru sylbru commented Sep 25, 2024

PHP heredoc strings make it easy to define string literals over multiple lines:

    $someString = <<<EOT
        multiline
        text
        EOT;

That EOT identifier can be anything else, and it is actually being used in Sublime Text and VS Code to inject syntax highlighting for another language in said string, depending on the identifier. For instance, if the identifier is SQL, SQL syntax highlighting will be applied to the contents of the string. Likewise if the identifier is CSS or JS.

    $someString = <<<SQL
        SELECT *
        FROM my_table
        SQL;

This PR changes the PHP extension so that it supports that feature too.

Release Notes:

  • php: Added syntax highlighting inside heredoc strings

…ifier

If the identifier of a heredoc string matches a language, apply that language’s syntax highlighting to the contents of the string.
Copy link

cla-bot bot commented Sep 25, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @sylbru on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@sylbru
Copy link
Contributor Author

sylbru commented Sep 25, 2024

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 25, 2024
Copy link

cla-bot bot commented Sep 25, 2024

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title Add syntax highlighting inside PHP heredoc strings PHP: Add syntax highlighting inside heredoc strings Sep 26, 2024
@maxdeviant maxdeviant changed the title PHP: Add syntax highlighting inside heredoc strings php: Add syntax highlighting inside heredoc strings Sep 26, 2024
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@SomeoneToIgnore SomeoneToIgnore self-assigned this Sep 30, 2024
@SomeoneToIgnore SomeoneToIgnore merged commit 898d48a into zed-industries:main Sep 30, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants