"Format Code" Bug -- Trailing Comment

Whenever I have a statement that has a trailing comment after the semi-colon,
every successive time I run Format Code, the comment moves further and further
to the right by 9 spaces each time.

My Formatter option for comments are not to align comments with the margin
(checkbox is unchecked). The right-hand margin is set at 78. Indentation is set
at 2 spaces.

Here is my proof:

– illustrate bug

– initial state

INSERT INTO some_table(a,b,c,d,e,f,g,h)

VALUES (1,2,3,4,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

);-- where will this comment align?

– run Format Code from Edit menu

– after 1x (added 9 spaces of padding in front of the trailing comment)

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

– after 2x

– now there’s 18 spaces of padding

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

– after 3x

– now there’s 27 spaces of padding

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

– after 4x

– now there’s 376 spaces of padding

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

– after 5x

– now there’s 45 spaces of padding

– and comment exceeds right-hand margin

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

– after 6x

– 54 spaces and no end in sight

INSERT INTO some_table(

a

,b

,c

,d

,e

,f

,g

,h

)

VALUES (

1

,2

,3

,4

,5

,‘what causes comment to wind up so far to the right?’

,‘I am sure I do not know’

,‘perhaps I should log a bug with the Formatter.’

); – where will this comment align?

Eventually, the trailing comment extends so far to the right I don’t even notice
it in my editor. But such a script is problematic when run in SQL*Plus (which we
must support with our scripts) – the statement doesn’t execute.

I’m running TOAD for Oracle Xpert 10.6.1.3.

Dan Clamage

Oracle Database Developer

Join Confluence and your industry peers for the 2011 Client Conference,
Innovation, Best Practices and the Bottom Line, May 15 – 17 in Pittsburgh,
PA. Go to www.confluence.com/clientconference to register today.

C O N F L U E N C E

412.246.1806 direct

412.802.8632 main

412.802.8647 fax

THE MATERIAL CONTAINED IN THIS MESSAGE IS CONFIDENTIAL AND IS SUBJECT TO
RESTRICTIONS ON ITS DISCLOSURE. The recipient acknowledges that the information
contained herein is the exclusive, proprietary and confidential property of
Confluence Technologies, Inc. and shall be at all times regarded, treated and
protected as such by the recipient. The use and disclosure of this information
is subject to the restrictions contained in the Software License Agreement
between the recipient (or the recipient’s employer or its affiliates) and
Confluence Technologies, Inc.

Did you ever get an answer to this? I have the same problem

Hi!

Here is mine code from Formatter (Toad 12.1):

– illustrate bug

– initial state

INSERT INTO some_table (a, b, c, d, e, f, g, h)
VALUES (
1, 2, 3,
4, 5, ‘what causes comment to wind up so far to the right?’,
‘I am sure I do not know’, ‘perhaps I should log a bug with the Formatter.’
); – where will this comment align?

and please use rich formatting as well as Toad version you are using …

I can reproduce and will forward this along to the formatter team.

Michael

On 10/09/2013 09:42 AM, damir.vadas_531 wrote:

RE: "Format Code" Bug -- Trailing Comment

Reply by damir.vadas_531
Here is mine code from Formatter:

-- illustrate bug

-- initial state

INSERT INTO some_table (a, b, c, d, e, f, g, h)

 VALUES (

         1, 2, 3,

         4, 5, 'what causes comment to wind up so far to the right?',

         'I am sure I do not know', 'perhaps I should log a bug with the Formatter.'

        );  -- where will this comment align?

a

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle - General
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.