mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix copy on Linux (#24341)
* add return type for copy results from STS * fix test error * change Result type to CopyResultsRequestResult * remove async * bump data protocol client * bump dataprotocol client version * bump version in yarn.lock * add async back
This commit is contained in:
@@ -209,7 +209,7 @@
|
||||
"update-grammar": "node ../../build/npm/update-grammar.js Microsoft/vscode-azuremonitor ./syntaxes/azuremonitor.tmLanguage"
|
||||
},
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"figures": "^2.0.0",
|
||||
"find-remove": "1.2.1",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
|
||||
@@ -75,9 +75,9 @@ concat-map@0.0.1:
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
"dependencies": {
|
||||
"@microsoft/ads-extension-telemetry": "^3.0.1",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"vscode-nls": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -497,9 +497,9 @@ crypt@0.0.2:
|
||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"htmlparser2": "^3.10.1",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
"@microsoft/ads-extension-telemetry": "^3.0.1",
|
||||
|
||||
@@ -78,7 +78,7 @@ export class TestQueryProvider implements azdata.QueryProvider {
|
||||
saveResults(requestParams: azdata.SaveResultsRequestParams): Thenable<azdata.SaveResultRequestResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Thenable<void> {
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Thenable<azdata.CopyResultsRequestResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
setQueryExecutionOptions(ownerUri: string, options: azdata.QueryExecutionOptions): Thenable<void> {
|
||||
|
||||
@@ -572,9 +572,9 @@ crypt@~0.0.1:
|
||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"figures": "^2.0.0",
|
||||
"find-remove": "1.2.1",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
|
||||
@@ -124,9 +124,9 @@ concat-map@0.0.1:
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
@@ -1567,7 +1567,7 @@
|
||||
"dependencies": {
|
||||
"@microsoft/ads-extension-telemetry": "^3.0.1",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"find-remove": "1.2.1",
|
||||
"vscode-languageclient": "5.2.1",
|
||||
"vscode-nls": "^4.0.0"
|
||||
|
||||
@@ -511,9 +511,9 @@ crypt@~0.0.1:
|
||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.6",
|
||||
"dataprotocol-client": "github:Microsoft/sqlops-dataprotocolclient#1.3.7",
|
||||
"@microsoft/ads-service-downloader": "^1.2.1",
|
||||
"@microsoft/ads-extension-telemetry": "^3.0.1",
|
||||
"uuid": "^8.3.2",
|
||||
|
||||
@@ -62,9 +62,9 @@ chownr@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
|
||||
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==
|
||||
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.6":
|
||||
version "1.3.6"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/fdd415fd7c79c5c889f192a9122ba41dca66b35b"
|
||||
"dataprotocol-client@github:Microsoft/sqlops-dataprotocolclient#1.3.7":
|
||||
version "1.3.7"
|
||||
resolved "https://codeload.github.com/Microsoft/sqlops-dataprotocolclient/tar.gz/0f07d03394eeebc2924971746470ac8224348fa4"
|
||||
dependencies:
|
||||
vscode-languageclient "5.2.1"
|
||||
|
||||
|
||||
9
src/sql/azdata.proposed.d.ts
vendored
9
src/sql/azdata.proposed.d.ts
vendored
@@ -873,6 +873,13 @@ declare module 'azdata' {
|
||||
selections: SelectionRange[];
|
||||
}
|
||||
|
||||
export interface CopyResultsRequestResult {
|
||||
/**
|
||||
* Result string from copy operation
|
||||
*/
|
||||
results: string;
|
||||
}
|
||||
|
||||
export interface QueryProvider {
|
||||
/**
|
||||
* Notify clients that the URI for a connection has been changed.
|
||||
@@ -884,7 +891,7 @@ declare module 'azdata' {
|
||||
* 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>;
|
||||
copyResults?(requestParams: CopyResultsRequestParams): Thenable<CopyResultsRequestResult>;
|
||||
}
|
||||
|
||||
export enum DataProviderType {
|
||||
|
||||
@@ -161,7 +161,7 @@ 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> {
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<azdata.CopyResultsRequestResult> {
|
||||
return Promise.resolve(self._proxy.$copyResults(handle, requestParams));
|
||||
},
|
||||
initializeEdit(ownerUri: string, schemaName: string, objectName: string, objectType: string, rowLimit: number, queryString: string): Promise<void> {
|
||||
|
||||
@@ -420,7 +420,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
return this._resolveProvider<azdata.QueryProvider>(handle).saveResults(requestParams);
|
||||
}
|
||||
|
||||
override $copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<void> {
|
||||
override $copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<azdata.CopyResultsRequestResult> {
|
||||
const provider = this._resolveProvider<azdata.QueryProvider>(handle);
|
||||
if (provider.copyResults) {
|
||||
return provider.copyResults(requestParams);
|
||||
|
||||
@@ -254,7 +254,7 @@ export abstract class ExtHostDataProtocolShape {
|
||||
/**
|
||||
* Copies the selected data to clipboard.
|
||||
*/
|
||||
$copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<void> { throw ni(); }
|
||||
$copyResults(handle: number, requestParams: azdata.CopyResultsRequestParams): Thenable<azdata.CopyResultsRequestResult> { throw ni(); }
|
||||
|
||||
/**
|
||||
* Commits all pending edits in an edit session
|
||||
|
||||
@@ -69,7 +69,7 @@ export interface IQueryManagementService {
|
||||
changeConnectionUri(newUri: string, oldUri: string): Promise<void>;
|
||||
saveResults(requestParams: azdata.SaveResultsRequestParams): Promise<azdata.SaveResultRequestResult>;
|
||||
setQueryExecutionOptions(uri: string, options: azdata.QueryExecutionOptions): Promise<void>;
|
||||
copyResults(params: azdata.CopyResultsRequestParams): Promise<void>;
|
||||
copyResults(params: azdata.CopyResultsRequestParams): Promise<azdata.CopyResultsRequestResult>;
|
||||
|
||||
// Callbacks
|
||||
onQueryComplete(result: azdata.QueryExecuteCompleteNotificationResult): void;
|
||||
@@ -108,7 +108,7 @@ export interface IQueryRequestHandler {
|
||||
disposeQuery(ownerUri: string): Promise<void>;
|
||||
connectionUriChanged(newUri: string, oldUri: string): Promise<void>;
|
||||
saveResults(requestParams: azdata.SaveResultsRequestParams): Promise<azdata.SaveResultRequestResult>;
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<void>;
|
||||
copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<azdata.CopyResultsRequestResult>;
|
||||
setQueryExecutionOptions(ownerUri: string, options: azdata.QueryExecutionOptions): Promise<void>;
|
||||
|
||||
// Edit Data actions
|
||||
@@ -364,7 +364,7 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
});
|
||||
}
|
||||
|
||||
public copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<void> {
|
||||
public copyResults(requestParams: azdata.CopyResultsRequestParams): Promise<azdata.CopyResultsRequestResult> {
|
||||
return this._runAction(requestParams.ownerUri, (runner) => {
|
||||
return runner.copyResults(requestParams);
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import EditQueryRunner from 'sql/workbench/services/editData/common/editQueryRunner';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { ClipboardData, IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
|
||||
const selectionSnippetMaxLen = 100;
|
||||
|
||||
@@ -82,6 +83,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
constructor(
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@INotificationService private _notificationService: INotificationService,
|
||||
@IClipboardService private _clipboardService: IClipboardService,
|
||||
@ILogService private _logService: ILogService
|
||||
) {
|
||||
this._queryInfoMap = new Map<string, QueryInfo>();
|
||||
@@ -170,7 +172,11 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public async copyResults(uri: string, selection: Slick.Range[], batchId: number, resultId: number, includeHeaders?: boolean): Promise<void> {
|
||||
if (this._queryInfoMap.has(uri)) {
|
||||
return this._queryInfoMap.get(uri)!.queryRunner!.copyResults(selection, batchId, resultId, includeHeaders);
|
||||
const results = await this._queryInfoMap.get(uri)!.queryRunner!.copyResults(selection, batchId, resultId, includeHeaders);
|
||||
let clipboardData: ClipboardData = {
|
||||
text: results.results
|
||||
};
|
||||
this._clipboardService.write(clipboardData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { ResultSerializer, SaveFormat } from 'sql/workbench/services/query/commo
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ClipboardData, IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -483,8 +483,8 @@ export default class QueryRunner extends Disposable {
|
||||
* @param resultId The result id of the result to copy from
|
||||
* @param includeHeaders [Optional]: Should column headers be included in the copy selection
|
||||
*/
|
||||
async copyResults(selections: Slick.Range[], batchId: number, resultId: number, includeHeaders?: boolean): Promise<void> {
|
||||
await this.queryManagementService.copyResults({
|
||||
async copyResults(selections: Slick.Range[], batchId: number, resultId: number, includeHeaders?: boolean): Promise<azdata.CopyResultsRequestResult> {
|
||||
return this.queryManagementService.copyResults({
|
||||
ownerUri: this.uri,
|
||||
batchIndex: batchId,
|
||||
resultSetIndex: resultId,
|
||||
@@ -606,7 +606,11 @@ export class QueryGridDataProvider implements IGridDataProvider {
|
||||
|
||||
private async handleCopyRequestByProvider(selections: Slick.Range[], includeHeaders?: boolean): Promise<void> {
|
||||
executeCopyWithNotification(this._notificationService, this._configurationService, selections, async () => {
|
||||
await this.queryRunner.copyResults(selections, this.batchId, this.resultSetId, this.shouldIncludeHeaders(includeHeaders));
|
||||
let results = await this.queryRunner.copyResults(selections, this.batchId, this.resultSetId, this.shouldIncludeHeaders(includeHeaders));
|
||||
let clipboardData: ClipboardData = {
|
||||
text: results.results
|
||||
}
|
||||
this._clipboardService.write(clipboardData);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ export class TestQueryManagementService implements IQueryManagementService {
|
||||
saveResults(requestParams: azdata.SaveResultsRequestParams): Promise<azdata.SaveResultRequestResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
copyResults(params: azdata.CopyResultsRequestParams): Promise<void> {
|
||||
copyResults(params: azdata.CopyResultsRequestParams): Promise<azdata.CopyResultsRequestResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
setQueryExecutionOptions(uri: string, options: azdata.QueryExecutionOptions): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user