Menu

#752 Toogle Comments

None
closed
nobody
None
1
2018-01-29
2014-08-07
Anonymous
No

Why not toggle comments with CTRL+T instead of "increment % in front of the line"?
This feature doesn't look so hard to implement and it is very useful!

Related

Feature Requests: #1085
Feature Requests: #483

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2014-08-11

    If you go into the details, it's a bit harder. You cannot simply toggle on a per-line basis for selections (which also need to be covered by the command). What if you have a selection with part normal lines and part commented lines. What if you have multiple selections?

    I'm not saying that it's not possible to implement a good comment toggle, but one would have to carefully think about all the corner cases and handle them correctly. It's not a one-liner.

     
  • Tim Hoffmann

    Tim Hoffmann - 2016-06-23

    implemented hg 6109 (6bf48f7a3fef)

    • status: open --> closed
    • Group: -->
     

    Last edit: Tim Hoffmann 2016-07-29
  • hofingermarkus

    hofingermarkus - 2018-01-29

    One could use a very simple and pragmatic solution, which is also done by various other programs these days (sublime, spyder, notepad++,...)

    The command only looks at those lines that are currently at least partly selected one character or more.
    If all these lines are currently commented out, they will all be commented in.
    If this isn't the case, they will all be commented out.
    This is also simple to implement and already helps a lot for many daily usecases, and furthermore people are already used to that behaviour from other programs anyway...

    Example:

    % This is my internal note
    My first line of text
    
    Next paragraph
    

    All these lines are at least selected partly => New Toggle comment command

    %% This is my internal note:
    %My first line of text
    %
    %Next paragraph
    
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB