mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
enable provider/extension side copy to clipboard support (#23363)
* improve copy data experience * add copy result handler * refactoring * updates * add thirdparty notice for TextCopy nuget package * add await * comments
This commit is contained in:
@@ -159,6 +159,9 @@ export class MainThreadDataProtocol extends Disposable implements MainThreadData
|
||||
return Promise.resolve(self._serializationService.saveAs(requestParams.resultFormat, requestParams.filePath, undefined, true));
|
||||
}
|
||||
},
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<void> {
|
||||
return Promise.resolve(self._proxy.$copyResults(handle, requestParams));
|
||||
},
|
||||
initializeEdit(ownerUri: string, schemaName: string, objectName: string, objectType: string, rowLimit: number, queryString: string): Promise<void> {
|
||||
return Promise.resolve(self._proxy.$initializeEdit(handle, ownerUri, schemaName, objectName, objectType, rowLimit, queryString));
|
||||
},
|
||||
|
||||
@@ -414,6 +414,15 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).saveResults(requestParams);
|
||||
}
|
||||
|
||||
override $copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<void> {
|
||||
const provider = this._resolveProvider<azdata.QueryProvider>(handle);
|
||||
if (provider.copyResults) {
|
||||
return provider.copyResults(requestParams);
|
||||
} else {
|
||||
throw new Error(`copyResults() is not implemented by the provider`);
|
||||
}
|
||||
}
|
||||
|
||||
// Edit Data handlers
|
||||
override $commitEdit(handle: number, ownerUri: string): Thenable<void> {
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).commitEdit(ownerUri);
|
||||
|
||||
@@ -251,6 +251,11 @@ export abstract class ExtHostDataProtocolShape {
|
||||
*/
|
||||
$saveResults(handle: number, requestParams: azdata.SaveResultsRequestParams): Thenable<azdata.SaveResultRequestResult> { throw ni(); }
|
||||
|
||||
/**
|
||||
* Copies the selected data to clipboard.
|
||||
*/
|
||||
$copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<void> { throw ni(); }
|
||||
|
||||
/**
|
||||
* Commits all pending edits in an edit session
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user