mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-22 17:24:07 -05:00
* Create ServiceHost a service-specific class * Renaming hosting namespace * Rename credentials namespace * Fix namespaces
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
//
|
|
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
//
|
|
|
|
using System.Composition;
|
|
using Microsoft.SqlServer.Management.SqlParser.SqlCodeDom;
|
|
using Microsoft.SqlTools.Utility;
|
|
|
|
namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
|
{
|
|
[Export(typeof(ASTNodeFormatterFactory))]
|
|
internal class SqlSelectClauseFormatterFactory : ASTNodeFormatterFactoryT<SqlSelectClause>
|
|
{
|
|
protected override ASTNodeFormatter DoCreate(FormatterVisitor visitor, SqlSelectClause codeObject)
|
|
{
|
|
return new SqlSelectClauseFormatter(visitor, codeObject);
|
|
}
|
|
}
|
|
|
|
internal class SqlSelectClauseFormatter : CommaSeparatedListFormatter
|
|
{
|
|
private NewLineSeparatedListFormatter NewLineSeparatedListFormatter { get; set; }
|
|
|
|
internal SqlSelectClauseFormatter(FormatterVisitor visitor, SqlSelectClause codeObject)
|
|
: base(visitor, codeObject, visitor.Context.FormatOptions.PlaceEachReferenceOnNewLineInQueryStatements)
|
|
{
|
|
NewLineSeparatedListFormatter = new NewLineSeparatedListFormatter(visitor, codeObject, true);
|
|
}
|
|
|
|
internal override void ProcessInterChildRegion(SqlCodeObject previousChild, SqlCodeObject nextChild)
|
|
{
|
|
Validate.IsNotNull(nameof(previousChild), previousChild);
|
|
Validate.IsNotNull(nameof(nextChild), nextChild);
|
|
|
|
if (previousChild is SqlTopSpecification)
|
|
{
|
|
NewLineSeparatedListFormatter.ProcessInterChildRegion(previousChild, nextChild);
|
|
}
|
|
else
|
|
{
|
|
base.ProcessInterChildRegion(previousChild, nextChild);
|
|
}
|
|
}
|
|
}
|
|
}
|