Posted by: viplex | Date: 2015-06-22 12:05 | IP: IP Logged
Hi, I have seen that a closing php tag in comments may lead to errors in php syntax highlighting. This error occurs in html multihighlighter too..
Let's say I have
<p><?= $var ?></p>
If you put a comment aroung that, it should be treated as legit
// <p><?= $var ?></p>
This is not working properly, because the closing tag suggests the end of the file, which is not right.
How it should behave:
Edited 1 time(s). Last edit at 2015-06-22 12:05 by viplex.
Posted by: pspad | Date: 2015-06-22 13:13 | IP: IP Logged
Switch syntax highlighter to PHP instead of the HTML multihighlighter.
Posted by: viplex | Date: 2015-06-22 15:33 | IP: IP Logged
this works and fixes the problems in .php files, which is good.
Unfortunately there are use cases where html is included there too like:
<title><?= $var ;></title>
switching to php only will remove highlighting for html elements.
Is there any way to integrate this into the multihighlighter or does this break constraints that are necessary for html syntax highlighting?
Posted by: Andreas | Date: 2015-06-22 17:24 | IP: IP Logged
// <p><?= $var ?></p>
But this is no comment. The slashes are not in PHP. It should output two slashes in the browser followed by a paragraph. Highlight with multi HL at this point is ok for me.
Posted by: Wirek | Date: 2015-06-27 11:09 | IP: IP Logged
Your assumption is bad, Andreas, because viplex has never claimed that it was a full source code in his post above. It is obvious that it was just a problematic fragment (single line) of his source code.
1. one-line comments (after // 2 char sequence);
2. multi-line block comments (between /* and */ 2 char sequences);
3. multi-line single quoted strings (between ' and ' pair except \' 2 char possible sequences);
4. multi-line double quoted strings (between " and " pair except \" 2 char possible sequences);
5. multi-line unquoted Nowdoc strings (between <<<'Some_Identifier1' and Some_Identifier1;);
6. multi-line unquoted Heredoc strings (between <<<Some_Identifier2 and Some_Identifier2;).
With the priority of implementation in PSPad from 1 (highest) to 6 (lowest) in my opinion.
More info on subject of strings in PHP: php.net
Posted by: Wirek | Date: 2015-06-27 11:34 | IP: IP Logged
I understand that it's not a trivial issue because for example single line comments ("//") may occur in:
- PHP code;
What is more - multiline block comments ("/* ... */") may even occur in CSS blocks that are in (X)HTML code inside PHP files.
But... "multihighlighter" feature is most important exactly in such messy/untidy (PHP) files where human eye is easily tricked and resulting problems in source code are very difficult to find and correct.
Anyway I haven't experienced this issue in Eclipse IDE - heavyweight, I know.
Posted by: Andreas | Date: 2015-06-27 14:13 | IP: IP Logged
Instead of describing the problems, why not showing a complete and valid (but small) code with all the highlight errors so we can test it by our own with copy and paste?
Posted by: viplex | Date: 2015-06-30 16:30 | IP: IP Logged
actually I do not understand why you would need another example if I already posted one in the first post and it has been approved as a fault by the pspad creator.
But here it is:
<p>This is a cool text here</p>
<p>This is a cool <?= $variable ?> here</p>
I admin that this may look odd, but it's just a sample and a use case where you could have that is a view in MVC, were you just want to comment something away (because it's not used yet/anymore).
Here is how pspad renders it:
Here is how it should be shown in my opinion (and that of notepad++).
If you chose php as syntax highlighter, it's shown correct, because that's valid php.
Edited 1 time(s). Last edit at 2015-06-30 16:31 by viplex.
Posted by: Andreas | Date: 2015-06-30 19:15 | IP: IP Logged
As I think you should post a real life example that makes sense. e.g.
* Please use "<?= $variable ?>" to print your variables
// Please use "<?= $variable ?>" to print your variables
In your example you're trying to prevent output of HTML markup by using a PHP wrapper and missuse the PHP comment to achieve this. This is unusual and bad coding style. But you are right, the highlighting in my example is wrong with multihighlighter.
Posted by: viplex | Date: 2015-07-11 09:59 | IP: IP Logged
that has nothing to do with bad style because there is no convention regarding comments content.
Because you are not using it does not mean that it's unusual, in bigger projects (such) comments are used on a regular basis and annotations are necessary.
It's a php comment and I can put everything there, therefore it's a comment.
The highlighter does not do his job and therefore it's a valid bug as other users agree.
Edited 2 time(s). Last edit at 2015-07-11 10:04 by viplex.