mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-17 17:23:48 -05:00
Progressive Results Part 1: Batch Completion Notification (#95)
The main feature of this pull request is a new callback that's added to the query class that is called when a batch has completed execution and retrieval of results. This callback will send an event to the extension with the batch summary information. After that, the extension can submit subset requests for the resultsets of the batch. Other smaller changes in this pull request: Refactor to assign a batch a id when its created instead of when returning the list of batch summaries Passing the SelectionData around instead of extracting the values for it Moving creation of BatchSummary into the Batch class Retrieval of results is now permitted even if the entire query has not completed, as long as the batch requested has completed. Also note, this does not break the protocol. It adds a new event that a queryRunner can listen to, but it doesn't require it to be listened to. * Refactor to remove SectionData class in favor of BufferRange * Adding callback for batch completion that will let the extension know that a batch has completed execution * Refactoring to make progressive results work as per async query execution * Allowing retrieval of batch results while query is in progress * reverting global.json, whoops * Adding a few missing comments, and fixing a couple code style bugs * Using SelectionData everywhere again * One more missing comment
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Parameters to be sent back as part of a QueryExecuteBatchCompleteEvent to indicate that a
|
||||
/// batch of a query completed.
|
||||
/// </summary>
|
||||
public class QueryExecuteBatchCompleteParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary of the batch that just completed
|
||||
/// </summary>
|
||||
public BatchSummary BatchSummary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// URI for the editor that owns the query
|
||||
/// </summary>
|
||||
public string OwnerUri { get; set; }
|
||||
}
|
||||
|
||||
public class QueryExecuteBatchCompleteEvent
|
||||
{
|
||||
public static readonly
|
||||
EventType<QueryExecuteBatchCompleteParams> Type =
|
||||
EventType<QueryExecuteBatchCompleteParams>.Create("query/batchComplete");
|
||||
}
|
||||
}
|
||||
@@ -7,21 +7,6 @@ using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Container class for a selection range from file
|
||||
/// </summary>
|
||||
public class SelectionData {
|
||||
public int StartLine { get; set; }
|
||||
public int StartColumn { get; set; }
|
||||
public int EndLine { get; set; }
|
||||
public int EndColumn { get; set; }
|
||||
public SelectionData(int startLine, int startColumn, int endLine, int endColumn) {
|
||||
StartLine = startLine;
|
||||
StartColumn = startColumn;
|
||||
EndLine = endLine;
|
||||
EndColumn = endColumn;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Parameters for the query execute request
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
||||
{
|
||||
/// <summary>
|
||||
/// Container class for a selection range from file
|
||||
/// </summary>
|
||||
/// TODO: Remove this in favor of buffer range end-to-end
|
||||
public class SelectionData
|
||||
{
|
||||
public SelectionData() { }
|
||||
|
||||
public SelectionData(int startLine, int startColumn, int endLine, int endColumn)
|
||||
{
|
||||
StartLine = startLine;
|
||||
StartColumn = startColumn;
|
||||
EndLine = endLine;
|
||||
EndColumn = endColumn;
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public int EndColumn { get; set; }
|
||||
|
||||
public int EndLine { get; set; }
|
||||
|
||||
public int StartColumn { get; set; }
|
||||
public int StartLine { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public BufferRange ToBufferRange()
|
||||
{
|
||||
return new BufferRange(StartLine, StartColumn, EndLine, EndColumn);
|
||||
}
|
||||
|
||||
public static SelectionData FromBufferRange(BufferRange range)
|
||||
{
|
||||
return new SelectionData
|
||||
{
|
||||
StartLine = range.Start.Line,
|
||||
StartColumn = range.Start.Column,
|
||||
EndLine = range.End.Line,
|
||||
EndColumn = range.End.Column
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user