-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
for a *.php file, syntax highlighting only starts after '<?php' #1030
Comments
Try this just to help me troubleshoot:
I'm curious what sort of input would exhibit this problem. Since 1.110, we've added a new Tree-sitter PHP grammar and made it the default, but the old TextMate-style grammar is also designed not to highlight any PHP until it encounters a |
You are right - designed not to highlight any PHP until it encounters a <?php tag (or equivalent). I have confirmed that even the 1.110.2023110716 does not highlight syntax for code that come before the <?php tag but does highlight code that come after - but not for all files it seems. Actually my problem is the absence of bracket pair matching (not the highlighting) in a file that does not have the <?php tag. As I stated when I filed the issue , I am working with some part-files that have tall functions and if '{' are not highlighted, it is practically unworthy using the editor. This is what made me realise that the syntax highlights were also not there and would be there on lines that come after the <?php. With version 1.118.0, I have gone through the steps you prescribed using the file in the archive, markentry.php.zip and found out the following
So for me to work with comfort using version 1.118.0 for now, I have to make use of TextMate. I will test to see if the PHP parser does not mind multiple <?php in the same file. If so, I will insert the <?php tag at the top of each file to enjoy the benefit of syntax highlighting also. |
So after looking at the file you've included, I understand exactly why neither grammar is able to parse this in the way that you expect.
To summarize: PHP is permissive enough to know how to execute this file, but it's practically designed to be hard to highlight. I think both our grammars do quite well with this file, and would highlight it perfectly if you could restructure your code such that you could provide the opening If you can find any other editor in common use that magically knows how to highlight everything in this file, I'd be interested in learning how. But aside from the Tree-sitter exception — which I'll capture separately, and which I appreciate you discovering — I'm afraid this isn't a bug. |
Anyway, @oniwo, sounds like you should opt into the TextMate grammar for PHP; you can do that by visiting #876 and following the directions under the “I want to go back to the old highlighting!” heading. That will save you from manually having to change the parser each time you open one of these files. |
Thank you so much. I am glad now there is a fix for the Tree-sitter exception . Cant wait for version 1.119 to be available for download. Keep up this good work. |
Thanks in advance for your bug report!
What happened?
If a file is saved as a *.php file, the editor checks the code for syntax only after '<?php'.
This is not suitable for me on some files that are deliberately pieces that I assemble to make a whole during usage.
The editor was not working this way at version 1.110.2023110716
Pulsar version
1.118.0
Which OS does this happen on?
🐧 Red Hat based (Fedora, Alma, RockyLinux, CentOS Stream, etc.)
OS details
Linux fedora 6.8.11-300.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 27 14:53:33 UTC 2024 x86_64 GNU/Linux
Which CPU architecture are you running this on?
x86_64/AMD64
What steps are needed to reproduce this?
Additional Information:
No response
The text was updated successfully, but these errors were encountered: