Author Topic: Comment Confusion  (Read 9372 times)

outsider

  • Community Member
  • Posts: 64
  • Hero Points: 1
Comment Confusion
« on: August 30, 2006, 07:53:35 pm »
Hi,

I've seen the previous posts on comments but I'm afraid it hasn't been of much help in making Slickedit's comment functionality any clearer.

First of all;

LINE COMMENTS - Checking 'enable line comment wrap' seems to have no effect. Comments characters will only be inserted if I manually insert a carriage return at the end of the line, and then only from the 2nd contiguous comment line. I would have hoped that ticking this box would automatically send new // characters to the start of the new line, in keeping with the previous line's indentation level, without requiring me to manually insert CR.

BLOCK COMMENTS - This is even more perplexing.
   Enable block comment wrap - if /* starts the line or is preceded only by whitespace on the same line, no wrapping occurs!!
                                         - if /* is preceded by non-whitespace characters on the same line, wrapping occurs!
   Uncheck enable block comment wrap - wrapping always occurs!

I am an amateur programmer so maybe I am missing some professional convention on how this should work or even what the expression 'word wrap' actually means. In which case, please could somebody enlighten me.

Thanks

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Comment Confusion
« Reply #1 on: August 30, 2006, 10:18:34 pm »
Your confusion is natural. We're still trying to determine the best way for some of this to work. On line comments, we want to be sure not to interefere when you are typing a single end of line comment, though we appear to have erred to far on the side of caution. So we auto-insert the // characters only after you hit a carriage return on the second contigous line of line comments. We also don't start comment wrapping for line comments until the 3rd line. In v12 we will introduce some user-settable options to control this better. We're also looking at some ways to give feedback when the wrapping will occur, before it occurs. Please let me know if you have any suggestions on how you'd like to see this work.

As for Block Comments, I can't reproduce these problems. What language are you using? Can you attach a code sample and a screen shot of Comment Wrapping tab (Tools > Options > File Extension Setup)?  That should help me figure out what's wrong. Also, be sure you have the latest version, v11.0.2.

--Scott

outsider

  • Community Member
  • Posts: 64
  • Hero Points: 1
Re: Comment Confusion
« Reply #2 on: August 31, 2006, 12:55:49 am »
Hi Scott,

Thanks for the speedy response. I appreciate it.

I have version 11.0.1. My language is C/C++ and I am using Vim emulation. I also have word wrapping switched on which is probably also clouding the issue but still doesn't resolve the block comment issue when I switch the former off. I have attached some screen shots.

Going forward, this is what would work for me. Line comment wrapping can be configured to be on or off. If it is on, typing past the word wrap limit will cause an automatic jump to the next line with insertion of // aligned with the // characters from the previous line and no need for a CR. If I hit deliberately hit CR at the end of a line comment then this has the same behaviour. When I finally want to start writing some code, I hit shift + CR to suppress commenting the next line.

regards

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Comment Confusion
« Reply #3 on: August 31, 2006, 02:27:00 pm »
Please turn off Word Wrap. That could be causing some of the irregularities you are seeing. The regular Word Wrap functionality is really intended for text files, like if you are editting a readme file. In general, code doesn't benefit from word wrap because, as programmers, we are particular about where new lines occur. That's why we introduced Comment Wrapping, so that the editor would wrap the text portion of your files but leave your code alone.

You should be able to leave Soft Wrap on, but please shut it off while we're trying to isolate the root cause. That doesn't insert any line breaks; it just changes how the lines are displayed. I really find Soft Wrap more useful when I'm viewing files rather than when I'm writing code. You can toggle that on and off quickly by selecting View > Soft Wrap.

I like your description of how line comments should wrap. We're working on the scenarios for that now so we can improve this behavior.

Finally, be sure to upgrade to v11.0.2, available on website, because there are a few bug fixes related to comment wrap in there.

--Scott

outsider

  • Community Member
  • Posts: 64
  • Hero Points: 1
Re: Comment Confusion
« Reply #4 on: August 31, 2006, 04:01:34 pm »
OK

Word wrap - off
Enable comment wrap - on
Enable block comment wrap - on (11.0.2)
Enable line comment wrap - on
Set maximum right column - on (setting is at 80)

Result:
Block commenting now works!
Line commenting now works - albeit still idiosyncratic - you need to manually insert the // characters after the first line but thereafter all commenting and wrapping is automatic. To switch this off when I want to start coding, I hit shift + CR and the // characters are suppressed.

Incidentally, this still works even with soft wrap on, which I find helpful for reading the messages I get from .process.

Overall - I am a happy camper. Thanks for helping me sort this out.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Comment Confusion
« Reply #5 on: August 31, 2006, 09:06:07 pm »
My pleasure! Thanks for your feedback to help us make this feature more useful and intuitive.

--Scott (one of the t's is silent...but which one?)

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Comment Confusion
« Reply #6 on: September 28, 2006, 11:55:31 am »
Out of curiosity, what's the design reason for not wrapping single-line comments whenever it hits the comment width limit (when the user has specified a fixed-width for comments)?  For me, this would be a totally awesome feature because writing single-line comments that turn out to need more than one line is very common, but I rarely need to go to the third line, so for the current single-line comment mode is OK, but not as awesome as it could be.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Comment Confusion
« Reply #7 on: September 28, 2006, 01:54:32 pm »
You'd be surprised how hard it is to design features for an editor that are beneficial but don't interfere with "normal" typing.  This is one of those cases where we want the feature to be useful but not do too much.

We thought there would be cases where users want a single-line line comment that didn't wrap. This could occur when you are placing line comments to the right of lines of code to document what they are doing. Unlike a block comment, with line comments it's hard to tell when the intent is to have a series of single-line, line comments and when those lines form a multi-line comment.

We'll probably change this to an option, allowing the user to specify when comment wrapping kicks in on line comments.

--Scott

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Comment Confusion
« Reply #8 on: September 28, 2006, 02:40:54 pm »
Thanks Scott, I understand now.  It's really nice to know why the decision was made.  I agree that an option would be really nice here.

Kodros

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Comment Confusion
« Reply #9 on: September 29, 2006, 09:04:15 pm »
What if you made the line comments wrap if the line only consists of a comment?  So in the "Comment at the end of some code" example, the editor would know (I'm assuming here) that non commented code is contained on this line and therefore this comment can't be wrapped.

David_O

  • Senior Community Member
  • Posts: 152
  • Hero Points: 8
Re: Comment Confusion
« Reply #10 on: October 05, 2006, 07:37:22 pm »
Another reason we thought that a single line should not wrap has to do with Enter at the end of a short one-line comment.  Comment wrap would add the '//' to the next line in this case.  If you really only wanted a one-line comment, the '//' would have to be removed every time.  The feature has been design to err on the side of doing too little, rather than too much. 

In addition to making an option for the number of consecutive line comments needed for wrapping, I'd like to have undo help in this case.  If you hit Enter on the last line of a line comment, the first undo step will take out the '//' and adjust the cursor, while a second undo would then take out the Enter and move the cursor back up.

This might be the best way to let line comment wrapping work on one-line comments, but still make it easy to get rid of unwanted '//' when a one-line comment is really intended.

Thoughts?

-David-

hs2

  • Senior Community Member
  • Posts: 2732
  • Hero Points: 284
Re: Comment Confusion
« Reply #11 on: October 05, 2006, 09:01:01 pm »
The '2-stage-smart-undo' sounds like a great idea !

HS2

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Comment Confusion
« Reply #12 on: October 06, 2006, 02:18:46 am »
I'm not quite sure I understand why it would be a problem to have the following:

one a one-line comment, don't add the // to the next line, but do wrap if you go past 80, or however many, characters, and once you wrap, continue to add the //s once the user hits enter.  I guess it's kind of a special case, but for what it's worth, that's how I would expect it to work.

But I also like the 2 stage undo for more general use.

greggman

  • Senior Community Member
  • Posts: 273
  • Hero Points: 13
Re: Comment Confusion
« Reply #13 on: October 06, 2006, 09:15:50 am »
I think the idea of comment wrapping is pretty cool but I ended up turning it off and I thought I'd ask if there is some configuration or settings that would fix the problems I ran into.

I'm using doxygen style (I wish you guys could add support for that too :-p). It's close enough to Javadoc that I can just use the Javadoc helper dialog but I guess it has a few differences.

Anyway, the problem I ran into was it was impossible to type an example with comment wrap on because it kept trying to wrap the example code. I don't know if it would be possible to either notice I'm in the example (@example) part of the comment and turn off wrap, or if something more simple would work like many wikis for example notice if there is extra whitespace before a line they assume the line is preformatted and don't do anything with it.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4120
  • Hero Points: 287
Re: Comment Confusion
« Reply #14 on: October 06, 2006, 07:14:29 pm »
I think you need
 or <xmp></xmp> tags to turn off wrapping.