editor: Adding support of PHP and fix combined injection#1970
editor: Adding support of PHP and fix combined injection#1970huacnlee merged 7 commits intolongbridge:mainfrom
Conversation
|
Thanks for your feedback and the test file! Indeed after investigations there's a case where the closing html tags are not highlighted. It looks like there's no trivial solution, I'll look more into this as the solution may be somewhere in tree-sitter-php. A short term solution could be to remove the HTML support, as per default. |
|
It was a tricky one but we made it! ProblemTree-sitter-php splits HTML content into separate Produces three pieces: This is a well-known issue (tree-sitter-php#123, nvim-treesitter#2565). FixIn the context of the PHP highlighter:
This solution was inspired by commented code already present in highlighter.rs (and partly reused) and the implementation of PHP highlighting in Zed. It is not limited to PHP & HTML. Screenshot
|
|
Thank you. |


Description
Adds PHP syntax highlighting to the code editor component using tree-sitter-php.
Screenshot
Before:

After:

How to Test
cargo run -p gpui-component-story --example editorChecklist
cargo runfor story tests related to the changes.