Add queryInfo to query events (#19777)

* Add queryInfo to query events

* docs
This commit is contained in:
Charles Gagnon
2022-06-20 11:01:39 -07:00
committed by GitHub
parent 9c9b6343f8
commit f7286b8e81
6 changed files with 113 additions and 19 deletions

View File

@@ -6,10 +6,10 @@
import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostQueryEditorShape, SqlMainContext, MainThreadQueryEditorShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
import * as azdata from 'azdata';
import { IQueryEvent } from 'sql/workbench/services/query/common/queryModel';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { Disposable } from 'vs/workbench/api/common/extHostTypes';
import { URI } from 'vs/base/common/uri';
import { IExtHostQueryEvent } from 'sql/workbench/api/common/sqlExtHostTypes';
class ExtHostQueryDocument implements azdata.queryeditor.QueryDocument {
constructor(
@@ -64,11 +64,11 @@ export class ExtHostQueryEditor implements ExtHostQueryEditorShape {
});
}
public $onQueryEvent(providerId: string, handle: number, fileUri: string, event: IQueryEvent): void {
public $onQueryEvent(providerId: string, handle: number, fileUri: string, event: IExtHostQueryEvent): void {
let listener: azdata.queryeditor.QueryEventListener = this._queryListeners[handle];
if (listener) {
let params = event.params && event.params.planXml ? event.params.planXml : event.params;
listener.onQueryEvent(event.type, new ExtHostQueryDocument(providerId, fileUri, this._proxy), params);
listener.onQueryEvent(event.type, new ExtHostQueryDocument(providerId, fileUri, this._proxy), params, event.queryInfo);
}
}

View File

@@ -23,11 +23,11 @@ import {
IModelViewWizardDetails, IModelViewWizardPageDetails, IExecuteManagerDetails, INotebookSessionDetails,
INotebookKernelDetails, INotebookFutureDetails, FutureMessageType, INotebookFutureDone, INotebookEditOperation,
NotebookChangeKind,
ISerializationManagerDetails
ISerializationManagerDetails,
IExtHostQueryEvent
} from 'sql/workbench/api/common/sqlExtHostTypes';
import { IUndoStopOptions } from 'vs/workbench/api/common/extHost.protocol';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IQueryEvent } from 'sql/workbench/services/query/common/queryModel';
import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
import { TreeDataTransferDTO } from 'vs/workbench/api/common/shared/treeDataTransfer';
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
@@ -921,7 +921,7 @@ export interface MainThreadModelViewDialogShape extends IDisposable {
$setDirty(handle: number, isDirty: boolean): void;
}
export interface ExtHostQueryEditorShape {
$onQueryEvent(providerId: string, handle: number, fileUri: string, event: IQueryEvent): void;
$onQueryEvent(providerId: string, handle: number, fileUri: string, event: IExtHostQueryEvent): void;
}
export interface MainThreadQueryEditorShape extends IDisposable {

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { nb, IConnectionProfile } from 'azdata';
import * as azdata from 'azdata';
import * as vsExtTypes from 'vs/workbench/api/common/extHostTypes';
import { URI } from 'vs/base/common/uri';
@@ -448,7 +448,7 @@ export enum AzureResource {
}
export class TreeItem extends vsExtTypes.TreeItem {
payload?: IConnectionProfile;
payload?: azdata.IConnectionProfile;
providerHandle?: string;
}
@@ -613,7 +613,7 @@ export enum FutureMessageType {
export interface INotebookFutureDone {
succeeded: boolean;
rejectReason: string;
message: nb.IShellMessage;
message: azdata.nb.IShellMessage;
}
export interface ICellRange {
@@ -686,7 +686,7 @@ export interface INotebookEditOperation {
/**
* The cell metadata to use for the edit operation (only for some edit operations)
*/
cell: Partial<nb.ICellContents>;
cell: Partial<azdata.nb.ICellContents>;
/**
* Whether to append the content to the existing content or replace it.
*/
@@ -1057,3 +1057,14 @@ export namespace executionPlan {
None = 4
}
}
/**
* Query event info to send to the extension host. This is a separate type from IQueryEvent
* since this has the query text ranges converted into the actual query text.
*/
export interface IExtHostQueryEvent {
type: azdata.queryeditor.QueryEventType;
uri: string;
queryInfo: azdata.queryeditor.IQueryInfo;
params?: any;
}