PoorMansTSqlFormatter icon indicating copy to clipboard operation
PoorMansTSqlFormatter copied to clipboard

[noformat][/noformat] block adds a linefeed before [/noformat] everytime the document is formatted

Open mc-Jeeves opened this issue 1 year ago • 0 comments

When formatting a dockument in SSMS a new line and spacing is inserted before the [/noformat] tag. This is done every time the document is formatted resulting in more and more empty lines above the [/noformat] tag: Original query:

IF @Ref IS NULL
BEGIN
	IF @DebugMsg = 'x1'
	BEGIN
		--[noformat]
		PRINT 'Some debug info'
		--[/noformat]
	END
	--[noformat]
	SELECT something from table
	--[/noformat]
END;

Formatted once:

IF @Ref IS NULL
BEGIN
	IF @DebugMsg = 'x1'
	BEGIN
		--[noformat]
		PRINT 'Some debug info'
		
			--[/noformat]
	END

	--[noformat]
	SELECT something from table
	
		--[/noformat]
END;

Formatted twice:

IF @Ref IS NULL
BEGIN
	IF @DebugMsg = 'x1'
	BEGIN
		--[noformat]
		PRINT 'Some debug info'
		
			
			--[/noformat]
	END

	--[noformat]
	SELECT something from table
	
		
		--[/noformat]
END;

mc-Jeeves avatar May 22 '24 09:05 mc-Jeeves