mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-13 11:38:33 -05:00
Removing a lot of redundant async/await wrappers (#1486)
* Removing a lot of redundant async/await wrappers * Removing kusto changes
This commit is contained in:
@@ -110,9 +110,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<TextEdit[]> FormatRangeAndReturnEdits(DocumentRangeFormattingParams docFormatParams)
|
||||
private Task<TextEdit[]> FormatRangeAndReturnEdits(DocumentRangeFormattingParams docFormatParams)
|
||||
{
|
||||
return await Task.Factory.StartNew(() =>
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (ShouldSkipFormatting(docFormatParams))
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
ScriptFile scriptFile = GetFile(docFormatParams);
|
||||
if (scriptFile == null)
|
||||
{
|
||||
return new TextEdit[0];
|
||||
return Array.Empty<TextEdit>();
|
||||
}
|
||||
TextEdit textEdit = new TextEdit { Range = range };
|
||||
string text = scriptFile.GetTextInRange(range.ToBufferRange());
|
||||
@@ -142,9 +142,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
return (LanguageService != null && LanguageService.ShouldSkipNonMssqlFile(docFormatParams.TextDocument.Uri));
|
||||
}
|
||||
|
||||
private async Task<TextEdit[]> FormatAndReturnEdits(DocumentFormattingParams docFormatParams)
|
||||
{
|
||||
return await Task.Factory.StartNew(() =>
|
||||
private Task<TextEdit[]> FormatAndReturnEdits(DocumentFormattingParams docFormatParams)
|
||||
{
|
||||
return Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (ShouldSkipFormatting(docFormatParams))
|
||||
{
|
||||
@@ -155,7 +155,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
if (scriptFile == null
|
||||
|| scriptFile.FileLines.Count == 0)
|
||||
{
|
||||
return new TextEdit[0];
|
||||
return Array.Empty<TextEdit>();
|
||||
}
|
||||
TextEdit textEdit = PrepareEdit(scriptFile);
|
||||
string text = scriptFile.Contents;
|
||||
@@ -205,12 +205,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
if (settings.PlaceSelectStatementReferencesOnNewLine.HasValue) { options.PlaceEachReferenceOnNewLineInQueryStatements = settings.PlaceSelectStatementReferencesOnNewLine.Value; }
|
||||
|
||||
if (settings.UseBracketForIdentifiers.HasValue) { options.EncloseIdentifiersInSquareBrackets = settings.UseBracketForIdentifiers.Value; }
|
||||
|
||||
|
||||
options.DatatypeCasing = settings.DatatypeCasing;
|
||||
options.KeywordCasing = settings.KeywordCasing;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private ScriptFile GetFile(DocumentFormattingParams docFormatParams)
|
||||
{
|
||||
return WorkspaceService.Workspace.GetFile(docFormatParams.TextDocument.Uri);
|
||||
|
||||
Reference in New Issue
Block a user