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:
Alan Ren
2023-06-09 14:24:45 -07:00
committed by GitHub
parent 80b733ebe0
commit 58082402aa
24 changed files with 217 additions and 104 deletions

View File

@@ -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));
},

View File

@@ -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);

View File

@@ -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
*/