Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Comment toggle (CTRL-/)(Comment toggling has been an ongoing issue with Eclipse through multiple versions, and it still exists in Juno)
Comment toggle (CTRL-/) [message #893820] Thu, 05 July 2012 10:54 Go to next message
Tom G is currently offline Tom G
Messages: 6
Registered: July 2012
Junior Member
As others have noted, there appear to be ongoing issues with the comment toggle keyboard shortcut CTRL-/ (and CTRL-7).

I have had this issue appear in Ganymede and Indigo, and now it has reappeared in Juno, and I can recreate it fairly consistently.

* Open a PHP project
* Open a PHP file
- CTRL-/ will work
* Open a second PHP file
- CTRL-/ will work in the first file, not in the second

* Close all PHP files
* Open a 2 PHP files
- CTRL-/ will work in the first file, not the second. If you close the second, CTRL-/ will STOP working in the first.

* Close all PHP files
* Open 3 PHP files
- CTRL-/ will work in the SECOND file opened, none of the others

* Open a PHP file
- CTRL-/ will work
* UNDO all changes
* Open a second PHP file
- CTRL-/ will work in the second file, and stop working in the first

There are some variations, but it seems to be around code modification as the keystroke appears to be accepted, but the actual process of modifying the code in the currently open window fails. There are no entries in workspace/.metadata/.log, and the issue occurs after running `eclipse -clean`. Running eclipse in debug mode (`./eclipse -debug`) also shows no errors.

The workaround is to close all open files and re-open the one you want to use the shortcut in.

It is not related to PHP or Smarty support for a project as the bug occurs in general projects that have PHP files in them. It's also not related to Smarty PDT specifically as the bug occurs even when Smarty PDT is removed.

Environment details:
Linux (Ubuntu 11.04)

Installed packages:
Subclipse
SmartyPDT
Re: Comment toggle (CTRL-/) [message #893917 is a reply to message #893820] Thu, 05 July 2012 23:05 Go to previous messageGo to next message
Toshihiro Izumi is currently offline Toshihiro Izumi
Messages: 342
Registered: July 2009
Location: Japan
Senior Member
Confirmed on Juno4.2 + pdt3.0.1(and current in cvs) on WindowsXP.
This is a new issue and it doesn't occur on Juno3.8 + pdt. I'm not sure this issue is a bug of e4, though.(e4 blocks the action, so pdt is not triggered to handle the action)
It is necessary to edit plugin.xml in org.eclipse.php.ui_...jar for a workaround.
Re: Comment toggle (CTRL-/) [message #893967 is a reply to message #893917] Fri, 06 July 2012 04:56 Go to previous messageGo to next message
Tom G is currently offline Tom G
Messages: 6
Registered: July 2012
Junior Member
Thanks Toshihiro. What's the edit that needs to be made?
Re: Comment toggle (CTRL-/) [message #894162 is a reply to message #893967] Sat, 07 July 2012 01:19 Go to previous messageGo to next message
Toshihiro Izumi is currently offline Toshihiro Izumi
Messages: 342
Registered: July 2009
Location: Japan
Senior Member
Extract plugin.xml from org.eclipse.php.ui_3.0.1.v201201110400.jar
Edit it
from:(l.612-)
<!-- overriding WST's Handlers with the same 'commanId' -->
<handler class="org.eclipse.php.internal.ui.actions.PHPToggleLineCommentHandler"
    commandId="org.eclipse.wst.sse.ui.toggle.comment">
    <activeWhen>
    <or>
        <reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
       <with variable="activePartId">
        <equals value="org.eclipse.php.editor"/>
       </with>
    </or>
        
    </activeWhen>
    <enabledWhen>
        <reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
    </enabledWhen>
</handler>

to:
<!-- overriding WST's Handlers with the same 'commanId' -->
<handler class="org.eclipse.php.internal.ui.actions.PHPToggleLineCommentHandler"
    commandId="org.eclipse.wst.sse.ui.toggle.comment">
    <activeWhen>
        <reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
    </activeWhen>
    <enabledWhen>
        <reference definitionId="org.eclipse.php.ui.phpContentType.definition" />
    </enabledWhen>
</handler>

Archive it back to org.eclipse.php.ui_3.0.1.v201201110400.jar
Start eclipse from command line with "-clean" option.(first time only)
HTH
Re: Comment toggle (CTRL-/) [message #894500 is a reply to message #894162] Mon, 09 July 2012 08:53 Go to previous messageGo to next message
Tom G is currently offline Tom G
Messages: 6
Registered: July 2012
Junior Member
Thanks, I made those changes and everything seems to be working very well now.
Re: Comment toggle (CTRL-/) [message #894626 is a reply to message #894500] Mon, 09 July 2012 17:27 Go to previous messageGo to next message
David Hollingshead is currently offline David Hollingshead
Messages: 31
Registered: January 2010
Member
When is an actual fix to this going to be implemented? I've been seeing this problem for over a year now on multiple versions of Eclipse and I don't think this workaround should be the solution.

Edit: I'm also unable to extract the file in Windows 7... maybe I need to use a zip file extractor. This is still way too complicated.

[Updated on: Mon, 09 July 2012 17:34]

Report message to a moderator

Re: Comment toggle (CTRL-/) [message #894630 is a reply to message #894626] Mon, 09 July 2012 17:28 Go to previous message
David Hollingshead is currently offline David Hollingshead
Messages: 31
Registered: January 2010
Member
Also, I remember when I used to be able to hit Ctrl+/ to comment a selected block of code and Ctrl+/ again to uncomment... now General > Keys bindings seem to require Ctrl+\ to uncomment (which doesn't work either).
Previous Topic:How to remove smart quotes from text file?
Next Topic:Regression in Juno? Dragging source files between Windows
Goto Forum:
  


Current Time: Wed Jul 23 06:02:36 EDT 2014

Powered by FUDForum. Page generated in 0.02710 seconds