Sublime Forum

Toggle comment bug between PHP brackets

#1

Mac OSX
I’ve found a bug while using the option Edit > Comment > Toggle Comment when applying to HTML code between open brackets in PHP code.

Attached is an image with examples:

In the image I’m Toggling comment in two portions of code, the first one outside the PHP loop is commented correctly, the second one inside the PHP loop is commented as it was PHP code.

This happens inside if, while, for, foreach…

1 Like

#2

You can fix this by doing the following:

  1. Install PackageResourceViewer if it is not already installed
  2. Open the Command Palette
  3. Type PRV: O and select PackageResourceViewer: Open Resource
  4. Select PHP
  5. Select Comments.tmPreferences
  6. Change <string>source.php</string> to <string>source.php &amp; - source text.html</string>
  7. Save it. This will create an override of the Comments.tmPreferences file in your Packages folder.

Because it creates an override, your version of the file will take precedence, essentially overriding the version that comes with ST3. Therefore, when the next build of ST3 comes out, I would highly recommend deleting the new file, so that you receive any official changes made to it. Maybe it will be fixed in a slightly different way officially, and having your override means you will experience different behavior, and it won’t be obvious why something is working differently for you than it is for everyone else :wink:

0 Likes