cYn
cYn

Reputation: 3381

Commenting a block of code containing a comment block uncomments the comments

Sorry about the title, but the issue I have is for example the following

var someArray = []

/**
 * Some comment
 * on
 * multiple
 * lines
 */

forEach(someArray, function(stuff) {
    return stuff
})

Now let's say I want to comment that whole code block. I will highlight all of that and use ctrl + /. Well, in Sublime the results will be:

var someArray = []

*
 * Some comment
 * on
 * multiple
 * lines


forEach(someArray, function(stuff) {
    return stuff
})

For some reason the comment block with asterisk is messing up the way Sublime does commenting.

I wanted the expected results to be:

// var someArray = []

// /**
//  * Some comment here
//  * on
//  * multiple
//  * lines
//  */

// forEach(someArray, function(stuff) {
//     return stuff
// })

Anyway I can fix this? It's hard to comment big blocks of code if the comment block is in the middle of it.

I am on Sublime3 Build 3114.

Upvotes: 1

Views: 990

Answers (1)

Frank Tan
Frank Tan

Reputation: 4412

This happens for me too. You may want to report the issue on GitHub. Until they fix it, here's a workaround:

  1. Highlight code block.
  2. Hit ctrl+shift+l. I don't know what the equivalent would be in OSX, but if you open your default keybindings, you can find it by searching for "split_selection_into_lines". This creates a cursor on each line you highlighted.
  3. The cursors start at the end of the line. Hit Home twice to get all cursors to the beginning of the line (again, I don't know the OSX equivalent).
  4. Type in your comments: //.

Upvotes: 1

Related Questions