Formatter: Comment block start being moved to end of previous line

I just installed the latest version (6.5.0.3001). and ran into this problem, which appears to have been reported as a bug in the SQL Navigator Beta in 2010. The following:

ALTER PROCEDURE dbo.foo
/*
2014-12-15 Created
*/
AS

was reformatted as

ALTER PROCEDURE dbo.foo /*
2014-12-15 Created
*/
AS

with the actual comment tabbed out to line up with the asterisk. It should have been left alone. How can I get TOAD to not rearrange the comment block?

Hello. I could not reproduce it, it seems to format normally here. Could you please paste here the formatter option values you’re using? Go to the top pane of the options tree (the one labeled “Sql Server Formatter Options”), then click on Copy Options, and paste it here.

Also, is there any SQL code preceding or following this snippet that you think influences the result?

Thanks,

Andre

Andre,

I could not reproduce it today. Instead, it is doing something even more strange. Here's the original code:

USE [MyDatabase];

GO

SET ANSI_NULLS ON;

GO

SET QUOTED_IDENTIFIER ON;

GO

ALTER PROCEDURE dbo.foo

AS

/*

This is a test comment.

*/

SET NOCOUNT ON;

SET TRANSACTION ISOLATION LEVEL SNAPSHOT;

WITH /dbo.foo/

foo1 AS (

SELECT DISTINCT id

FROM dbo.bar

)

SELECT bar

INTO #MyTemp

FROM bar;

SELECT /dbo.foo/

bar

FROM #MyTemp;

TRUNCATE TABLE #MyTemp;

GO

After I click the Format button, it pulls the "AS" up to the "ALTER" line and indents everything below it until it hits the "TRUNCATE" line, which it leaves at the left margin. If I click the Format button again, it indents the comment line and the line with the closing comment characters by one indent, leaving everything else alone. Every time I click Format, it indents just those two lines by one more indent increment.

252

5.266.0

5.267

4

1

4

1

1

1

132

<LF_ConsecLFLimit>2</LF_ConsecLFLimit>

0

0

1

2

1

0

1

0

1

2

0

4

4

4

D

6

D

6

4

4

4

2

0

0

Mark Freeman
Database Administrator | R****ogue Fitness
1080 Steelwood Road, Columbus, OH 43212
MFreeman@RogueFitness.com

On Sat, Jan 3, 2015 at 2:40 PM, Andre Vergison bounce-avergison@toadworld.com wrote:

RE: Formatter: Comment block start being moved to end of previous line

Reply by Andre Vergison
Hello. I could not reproduce it, it seems to format normally here. Could you please paste here the formatter option values you're using? Go to the top pane of the options tree (the one labeled "Sql Server Formatter Options"), then click on Copy Options, and paste it here.

Also, is there any SQL code preceding or following this snippet that you think influences the result?

Thanks,

Andre

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for SQL Server - General notifications altogether.

Toad for SQL Server - Discussion Forum

Flag this post as spam/abuse.

The one and only cause seems to be the Output Tabs setting , when set to “Insert tabs”… (i.e. 1 )

The TRUNCATE should indent as well, agree.

Doesn't Output Tabs just tell it to use tabs instead of spaces? I'd rather that it didn't indent (almost) every line in the proc whether it uses spaces or tabs. And why would it continue to add more indentation every time I tell it to format? Surely that is a bug.

Mark Freeman
Database Administrator | R****ogue Fitness
1080 Steelwood Road, Columbus, OH 43212
MFreeman@RogueFitness.com

On Wed, Jan 7, 2015 at 10:28 AM, Andre Vergison bounce-avergison@toadworld.com wrote:

RE: Formatter: Comment block start being moved to end of previous line

Reply by Andre Vergison
The one and only cause seems to be the Output Tabs setting , when set to "Insert tabs"...

The TRUNCATE should indent as well, agree.

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for SQL Server - General notifications altogether.

Toad for SQL Server - Discussion Forum

Flag this post as spam/abuse.

Output Tabs was only used to generate tabs. When reading a file then each actual tab was converted to a single space (i.e. tabsize 1), which did upset the comment formatting. This caused the comment to get shifted each time. (Please note that the formatter will never output tabs inside a comment to avoid layout distortions.)

I changed the code such that the input will use the Output Tabs value. So I don’t see the shifting anymore.

If you see qp5.dll version 5.274 (or higher) in your Toad then it’ll be in there.

Thanks,

Andre

I have 5.267. How can I get a copy of 5.274?

Is there a way to keep the formatter from indenting every line in the proc? I'd rather that it did not, as I don't see the value in it.

Thanks,

Mark Freeman
Database Administrator | R****ogue Fitness
1080 Steelwood Road, Columbus, OH 43212
MFreeman@RogueFitness.com

On Wed, Jan 7, 2015 at 3:24 PM, Andre Vergison bounce-avergison@toadworld.com wrote:

RE: Formatter: Comment block start being moved to end of previous line

Reply by Andre Vergison
Output Tabs was only used to generate tabs. When reading a file then each actual tab was converted to a single space (i.e. tabsize 1), which did upset the comment formatting. This caused the comment to get shifted each time. (Please note that the formatter will never output tabs inside a comment to avoid layout distortions.)

I changed the code such that the input will use the Output Tabs value. So I don't see the shifting anymore.

If you see qp5.dll version 5.274 (or higher) in your Toad then it'll be in there.

Thanks,

Andre

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for SQL Server - General notifications altogether.

Toad for SQL Server - Discussion Forum

Flag this post as spam/abuse.

5.274 will be available soon. Please talk to the Toad guys about the way to get it.

Indenting is a logical step inside a BEGIN/END block but in the ALTER PROCEDURE case there is no such block. It feels better indeed not to indent at all. I removed it.