Closed FichteFoll closed 8 years ago
I would expect the toggle_comment command to prepend the // to the php line, within the <?php ?> tags, as if I'm inside a php block I'm probably looking to comment that out and not the html.
The issue is that the comment might result in the ?>
not being recognized. I'm actually not sure if HTML will find that (and if the current PHP syntax definition respects that case and does not consume it) or if it needs a non-commented ?>
to close the block.
Also, the normal behavior is to comment the entire line in all other files (not considering embedded right now).
And finally, even if this worked with HTML&PHP it might not with all other language combinations. Going the save way would definitely be the more desireable option here.
There doesn't seem to be any issues if you manually add the comment to the beginning of the php block, I end up doing that all the time - wouldn't that be the same thing?
Because this is, in its core, the same issue as https://github.com/SublimeTextIssues/Core/issues/43 and we decided to list issues with the Default package in the other repo (since it's considered to be "core"), I'm closing this as duplicate.
Example file:
If you run toggle_comment anywhere in the php line, it will prepend
//
to the line, even though it should be choosing HTML comments (or with the current implementations of the toggle_comment command, do nothing at all).The reason for this is that php source is detected in the HTML syntax using look-aheads and the PHP syntax then matches the entire
<?php
block, including the block markers, and assignssource.php.embedded.block
to it. That results in toggle_comments finding thesource.php
scope both at the location of the caret and at the beginning of the (whitespace-stripped) line.It is debatable if the
<?php
and?>
markers should be matched assource.php
, but if they should, this is hardly fixable for the toggle_commends command when it occurs at the beginning of the line without leading whitespace.Original report: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=8230