Author Topic: Maintaining Method note formatting on import  (Read 2322 times)

sl@sh

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
    • View Profile
Maintaining Method note formatting on import
« on: May 09, 2007, 11:46:08 pm »
Hi everyone.
Does anyone happen to know how I can influence the method used to import comments? Currently import removes all 'formatting' from comments found for methods and classes it imports or synchronizes: hard line breaks are removed, multiple spaces or tabs are kept, but without the line breaks this has no meaning. Also, the standard commenting characters '/' and '*' are partially removed from the notes, even if they appear within the notes and are thus part of the comment (or, actually, part of the formatting)! Moreover, on code generation the line is broken into multiple lines, using an arbitrary(?) line length.

This is an actual problem for me, because I am refactoring existing C- functions into class methods: on import EA reads the function's header comments from the cpp file, and on code generation it "copies" them into the header. Now the class header contains lots of blocks of mangled comments that are close to unreadable - and removing them isn't really an option either, because they will be regenerated the next time I generate the code...

I'd really like to know
1. how to prevent the obliteration of line breaks on importing comments
2. how to prevent the removal of existing symbols that are either part of the comment delimiters or just part of the formatting

Personally, I don't understand why EA doesn't import multiple line comments verbatim. Changing *anything* just makes it more likely that on code generation the user will *not* get the expected results.


Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8063
  • Karma: +118/-20
    • View Profile
Re: Maintaining Method note formatting on import
« Reply #1 on: May 10, 2007, 01:22:08 pm »
Some of what you want can be done.

Have a look at Tools | Options | Source Code Engineering.

Uncheck 'Remove hard breaks from comments on import'.
Change 'Wrap long comment lines at:' to -1 (to disable automatic wrapping)

Then go to the C page.

Set 'Method Notes in Header' to False.
Set 'Method Notes in Implementation' to True.

This should fix most of what you are complaining about.  Removing '/' and '*' characters from the start of lines is done so that the notes in the model are more readable.  I'm guessing that you have something like the following.

Code: [Select]
///////////////////////////////
// This is my operation note...

And the leading line of delimiters is being removed.  If that is the case, and you want all of your notes to use this convention, then you can modify the code templates to generate this.

If you believe that the import is removing characters that it shouldn't, can you provide an example?

sl@sh

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
    • View Profile
Re: Maintaining Method note formatting on import
« Reply #2 on: May 10, 2007, 11:36:55 pm »
Quote
Uncheck 'Remove hard breaks from comments on import'.
Change 'Wrap long comment lines at:' to -1 (to disable automatic wrapping)
[snip]

Thanks a lot, that helps!
Quote
Removing '/' and '*' characters from the start of lines is done so that the notes in the model are more readable.  I'm guessing that you have something like the following.

Code: [Select]
///////////////////////////////
// This is my operation note...
And the leading line of delimiters is being removed.

Yup, that is essentially the effect I was referring to. It causes a minor misalignment on some cases, but apart from that it's not a biggie, I can live with that. I'd rather not change the templates for the moment since various pieces of legacy libraries use quite different styles of comments ::)
« Last Edit: May 10, 2007, 11:37:48 pm by sl@sh »