Skip to content

Commit

Permalink
Merge branch 'main' of github.com:microsoft/sqlops-dataprotocolclient…
Browse files Browse the repository at this point in the history
… into lewissanchez/release/copy-results-to-clipboard-rel
  • Loading branch information
lewis-sanchez committed Sep 12, 2024
2 parents 39d7544 + 59bae53 commit b9f0c72
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

# Description

This repo is for the `dataprotocol-client` package, which is used by Azure Data Studio extensions wishing to implement certain core features, such as a Query Provider.

This is done through an implementation on top of the VS Code [Language Client](https://code.visualstudio.com/api/language-extensions/language-server-extension-guide). This package is used to set up the features and messages that will then be implemented by the backing language server (such as [SQL Tools Service](https://github.com/Microsoft/sqltoolsservice)). You can see further descriptions of the messages defined [here](https://github.com/microsoft/sqltoolsservice/blob/main/docs/guide/jsonrpc_protocol.md)

Currently, this package is NOT published to npm or any other package manager. Instead, extensions will reference the Github releases directly. These releases point to commits out of the [release](https://github.com/microsoft/sqlops-dataprotocolclient/tree/release) branch, which contains the compiled
JS sources that extensions will be using at runtime.

See [the wiki](https://github.com/microsoft/sqlops-dataprotocolclient/wiki/Releasing-Changes#using-this-package) for more information.

# Build and Run From Source

```bash
Expand All @@ -9,11 +20,8 @@ yarn run watch
```

# Create a release
New releases need to be created off the release branch, the release branch contains the lib folder.
1. make the changes in the main branch
1. cherry-pick the changes to release branch and build it, lib folder will be updated
1. commit the changes to release branch
1. create a release: https://github.com/microsoft/sqlops-dataprotocolclient/releases, the source will be included automatically.

See [the wiki](https://github.com/microsoft/sqlops-dataprotocolclient/wiki/Releasing-Changes) for instructions on making and releasing new changes.

# Contributing

Expand Down
23 changes: 15 additions & 8 deletions src/azdata.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,20 @@ declare module 'azdata' {
export function openChangePasswordDialog(profile: IConnectionProfile): Thenable<string | undefined>;
}

export interface ConnectionInfoSummary {
/**
* ID used to identify the connection on the server, if available.
*/
serverConnectionId?: string | undefined;
}

export interface QueryExecuteCompleteNotificationResult {
/**
* ID used to identify the connection used to run the query on the server, if available.
*/
serverConnectionId?: string | undefined;
}

/*
* Add optional per-OS default value.
*/
Expand Down Expand Up @@ -873,13 +887,6 @@ 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.
Expand All @@ -891,7 +898,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<CopyResultsRequestResult>;
copyResults?(requestParams: CopyResultsRequestParams): Thenable<void>;
}

export enum DataProviderType {
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,9 @@ export class QueryFeature extends SqlOpsFeature<undefined> {
);
};

let copyResults = (params: azdata.CopyResultsRequestParams): Thenable<azdata.CopyResultsRequestResult> => {
let copyResults = (params: azdata.CopyResultsRequestParams): Thenable<void> => {
return client.sendRequest(protocol.CopyResultsRequest.type, params).then(
r => r,
r => undefined,
e => {
client.logFailedRequest(protocol.CopyResultsRequest.type, e);
return Promise.reject(e);
Expand Down
2 changes: 1 addition & 1 deletion src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export namespace SaveResultsAsXmlRequest {
// --------------------------------- < Copy Results Request > ------------------------------------------
// copy results to clipboard
export namespace CopyResultsRequest {
export const type = new RequestType<azdata.CopyResultsRequestParams, azdata.CopyResultsRequestResult, void, void>('query/copy');
export const type = new RequestType<azdata.CopyResultsRequestParams, void, void, void>('query/copy');
}
// --------------------------------- </ Copy Results Request > ------------------------------------------

Expand Down

0 comments on commit b9f0c72

Please sign in to comment.