-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Thanks for the wonderful enhancement in #187 - did find one possible gap which users may want addressed. Consider the following example:
-- single line comment
select c1
/*
multi line comment
, c2
*/
, c3
from t1After formatting (with [1]), the output looks like this:
-- single line comment
SELECT c1 /*
multi line comment
, c2
*/,
c3
FROM t1;
As you can see, the leading token for the multi-line comment was moved "up" to the previous line. Most cases where multi-line comments are used, stylistically require that the comment start token be the first column.
It would be great to have control over this behavior, with the default to have any preceding newline preserved prior to emitting the multi-line comment in the output.
[1] C# code reference
using (var rdr = new StringReader(textBox1.Text))
{
IList<ParseError> errors = null;
var parser = new TSql170Parser(true, SqlEngineType.All);
var tree = parser.Parse(rdr, out errors);
foreach (ParseError err in errors)
{
Console.WriteLine(err.Message);
}
var scrGenOpts = new SqlScriptGeneratorOptions()
{
PreserveComments = true
};
var scrGen = new Sql170ScriptGenerator(scrGenOpts);
string formattedSQL = null;
scrGen.GenerateScript(tree, out formattedSQL);
textBox2.Text = formattedSQL;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels