add copy results to query provider (#23357)

* add copy results to query provider

* mark as optional

* fix test stub

* Update src/sql/azdata.proposed.d.ts

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

* address comments

* update return type

---------

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
Alan Ren
2023-06-08 15:06:23 -07:00
committed by GitHub
parent 7886b28565
commit 54b12da330
2 changed files with 51 additions and 1 deletions

View File

@@ -823,11 +823,58 @@ declare module 'azdata' {
parentTypeName?: string;
}
/**
* Represents a selected range in the result grid.
*/
export interface SelectionRange {
fromRow: number;
toRow: number;
fromColumn: number;
toColumn: number;
}
/**
* Parameters for the copy results request.
*/
export interface CopyResultsRequestParams {
/**
* URI of the editor.
*/
ownerUri: string;
/**
* Index of the batch.
*/
batchIndex: number;
/**
* Index of the result set.
*/
resultSetIndex: number;
/**
* Whether to include the column headers.
*/
includeHeaders: boolean
/**
* Whether to remove line breaks from the cell value.
*/
removeNewLines: boolean;
/**
* The selected ranges to be copied.
*/
selections: SelectionRange[];
}
export interface QueryProvider {
/**
* Notify clients that the URI for a connection has been changed.
*/
connectionUriChanged(newUri: string, oldUri: string): Thenable<void>;
connectionUriChanged?(newUri: string, oldUri: string): Thenable<void>;
/**
* Copy the selected data to the clipboard.
* This is introduced to address the performance issue of large amount of data to ADS side.
* ADS will use this if 'supportCopyResultsToClipboard' property is set to true in the provider contribution point in extension's package.json.
* Otherwise, The default handler will load all the selected data to ADS and perform the copy operation.
*/
copyResults?(requestParams: CopyResultsRequestParams): Thenable<void>;
}
export enum DataProviderType {