jiller / agentsmithplugin

Automatically exported from code.google.com/p/agentsmithplugin
0 stars 0 forks source link

Reflow logic does not calculate max length correctly #135

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When calculating the wrap points the reflow logic starts counting characters
after ///. It should reduce maxLength by the position of the last / in ///.

Suggested fix is to reduce the maxLength based on the comment start offset:

internal class CommentReflowAction : OneItemContextActionBase
{ ....

   protected override void ExecuteInternal()
   {...
      // Calculate line offset where /// starts and add 3 for each slash.
      int startPos = CalcLineOffset(ownerNode) + 3;       
      maxLength -= startPos;
     ...
   }

    private int CalcLineOffset( IDocCommentBlockOwnerNode node )
    {
            ITreeNode prev = node.PrevSibling;
            if ( prev != null && prev is IWhitespaceNode &&
                 !( (IWhitespaceNode)prev ).IsNewLine )
            {
                return prev.GetTextLength();
            }
            else
            {
                return 0;
            }
     }

The fixed class is attached.

Dimitry Fayerman

Original issue reported on code.google.com by dfayerma@gmail.com on 9 Jul 2009 at 4:45

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks Dimitry.

P.S. I didn't have time recently to look at Agent Smith. I think I'll release 
new 
version with your fix and couple of other I may fix on weekend.

Original comment by forever....@gmail.com on 9 Jul 2009 at 8:53

GoogleCodeExporter commented 8 years ago
Thanks, Dimitry.
Fixed in 1.3.8

Shall I add you to the project commiters, if you'd like? :)

Original comment by forever....@gmail.com on 16 Jul 2009 at 7:58

GoogleCodeExporter commented 8 years ago
Thanks.
That would be great!

What is your process for contributing new features?
Dimitry

Original comment by dfayerma@gmail.com on 17 Jul 2009 at 3:12

GoogleCodeExporter commented 8 years ago
There is almost no process. New features must relate to what Agent Smith does - 
Coding Standards, Naming Conventions, Error Checking, Documentation ...
The feature shall be useful to more or less large audience.

And I would also like to review it :)

Usually I checkin into 4.5 branch and when I'm ready to release I tag it.

I think that's it.

Original comment by forever....@gmail.com on 18 Jul 2009 at 1:51