Red Gate forums :: View topic - Code formatting
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Prompt 5
SQL Prompt 5 forum

Code formatting

Search in SQL Prompt 5 forum
Post new topic   Reply to topic
Jump to:  
Author Message
@dsfog



Joined: 04 Dec 2012
Posts: 1

PostPosted: Tue Dec 04, 2012 10:10 am    Post subject: Code formatting Reply with quote

I have noticed som mishaps when auto formatting my code, where perfectly sane TSQL is going off.

Most simple example I have found:
Write
Code:
DROP TABLE

With caret placed exactly after TABLE press Ctrl + Enter.
Line is now
Code:
DROTABLELE


Same mishaps are at times found for ASC and DESC keywords, but I have not identified a way to consistently reproduce these errors (nor tried to).


Setup
SSMS 2012
SQL Prompt 5.3.6.28
Connection Coloring as only experimental feature[/code]

Exported Style XML:
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<!---->
<LayoutOptions version="1" type="LayoutOptions">
<ReservedWordsCasing>1</ReservedWordsCasing>
<BuiltInFunctionCasing>1</BuiltInFunctionCasing>
<BuiltInDataTypeCasing>1</BuiltInDataTypeCasing>
<DelimitIdentifiers>False</DelimitIdentifiers>
<IndentationAmount>4</IndentationAmount>
<UseTabs>False</UseTabs>
<ReformatExpressions>True</ReformatExpressions>
<FirstColumnOnNewLine>False</FirstColumnOnNewLine>
<CommasAtStart>True</CommasAtStart>
<MultilineSpacesAfterCommas>True</MultilineSpacesAfterCommas>
<MultilineSpacesBeforeCommas>True</MultilineSpacesBeforeCommas>
<MultilineAlignCommasWithStatement>False</MultilineAlignCommasWithStatement>
<OperatorsOnNewline>True</OperatorsOnNewline>
<OperatorsAtStart>True</OperatorsAtStart>
<IndentBeginToken>True</IndentBeginToken>
<IndentWithExpressionBrackets>True</IndentWithExpressionBrackets>
<IndentWithParameterBrackets>True</IndentWithParameterBrackets>
<IndentWithQueryBrackets>True</IndentWithQueryBrackets>
<CloseBracketsOnNewLine>True</CloseBracketsOnNewLine>
<OpenBracketsOnNewLine>False</OpenBracketsOnNewLine>
<Wrap>True</Wrap>
<WrapWidth>78</WrapWidth>
<ShortLength>15</ShortLength>
<CreateBracketsAtStartOfLines>False</CreateBracketsAtStartOfLines>
<ParameterBracketOnNewline>True</ParameterBracketOnNewline>
<CloseParameterBracketsOnNewLine>True</CloseParameterBracketsOnNewLine>
<CompactShortStatements>False</CompactShortStatements>
<SinglelineSpacesAfterCommas>True</SinglelineSpacesAfterCommas>
<SinglelineSpacesBeforeCommas>False</SinglelineSpacesBeforeCommas>
<SpacesAroundOperators>True</SpacesAroundOperators>
<SpacesAroundComparisons>True</SpacesAroundComparisons>
<FirstParameterDefinitionOnNewLine>True</FirstParameterDefinitionOnNewLine>
<SpacesAfterBrackets>False</SpacesAfterBrackets>
<LayoutSelectStatements>True</LayoutSelectStatements>
<LayoutCreateStatements>True</LayoutCreateStatements>
<QueryNewlineAfterOpenBracket>False</QueryNewlineAfterOpenBracket>
<QueryNewlineBeforeCloseBracket>True</QueryNewlineBeforeCloseBracket>
<JoinConditionsOnNewline>True</JoinConditionsOnNewline>
<AlignConditionsWithJoins>False</AlignConditionsWithJoins>
<AlignJoinsWithFrom>True</AlignJoinsWithFrom>
<IndentByKeywordWidth>False</IndentByKeywordWidth>
<ColumnsOnSingleLine>False</ColumnsOnSingleLine>
<DoNotIndentProcedureContents>False</DoNotIndentProcedureContents>
<ExecuteParametersOnSingleLine>True</ExecuteParametersOnSingleLine>
<UseSpacesInsteadOfTabs>False</UseSpacesInsteadOfTabs>
<IndentSelectSubclauses>False</IndentSelectSubclauses>
</LayoutOptions>
Back to top
View user's profile Send private message
Matt_B



Joined: 19 Feb 2008
Posts: 9

PostPosted: Wed Dec 05, 2012 10:26 am    Post subject: Same here Reply with quote

I've been noticing this same problem for some time now, the ASC and DESC keywords being frequently rewritten seemingly without my input.

As per the OP, I can't find a certain way to consistently reproduce (although the Ctrl+Enter after DROP TABLE produces the same results), so was assuming it was keyboard clumsiness.
Back to top
View user's profile Send private message
kevriley



Joined: 07 Apr 2009
Posts: 70
Location: UK

PostPosted: Fri Dec 21, 2012 4:32 pm    Post subject: Reply with quote

Glad I've seen this thread - I thought I was going mad!

The example I had was 'select * from' then Ctrl+Enter, becomes 'select fromom'
Back to top
View user's profile Send private message
WeeeBob



Joined: 14 Jun 2007
Posts: 12

PostPosted: Mon Dec 31, 2012 12:50 pm    Post subject: Reply with quote

Why are you using Ctrl + Enter ?? shouldn't you be using Ctrl + Space if you want to manually trigger suggestions?

Drop Table Ctrl+space works fine, but I too get the problem with Ctrl+Enter with version 5.3.6.28 in SSMS 2008r2
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group