mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Switch query events to just send ranges instead of full query text (#19823)
* Switch query events to just send ranges instead of full query text * undo azdata changes * fix type * comment + remove unneeded ?
This commit is contained in:
@@ -9,7 +9,8 @@ import * as azdata from 'azdata';
|
||||
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';
|
||||
import { IQueryEvent } from 'sql/workbench/services/query/common/queryModel';
|
||||
import * as sqlTypeConverters from 'sql/workbench/api/common/sqlExtHostTypeConverters';
|
||||
|
||||
class ExtHostQueryDocument implements azdata.queryeditor.QueryDocument {
|
||||
constructor(
|
||||
@@ -64,11 +65,11 @@ export class ExtHostQueryEditor implements ExtHostQueryEditorShape {
|
||||
});
|
||||
}
|
||||
|
||||
public $onQueryEvent(providerId: string, handle: number, fileUri: string, event: IExtHostQueryEvent): void {
|
||||
public $onQueryEvent(providerId: string, handle: number, fileUri: string, event: IQueryEvent): 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, event.queryInfo);
|
||||
listener.onQueryEvent(event.type, new ExtHostQueryDocument(providerId, fileUri, this._proxy), params, sqlTypeConverters.QueryInfo.to(event.queryInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ import {
|
||||
IModelViewWizardDetails, IModelViewWizardPageDetails, IExecuteManagerDetails, INotebookSessionDetails,
|
||||
INotebookKernelDetails, INotebookFutureDetails, FutureMessageType, INotebookFutureDone, INotebookEditOperation,
|
||||
NotebookChangeKind,
|
||||
ISerializationManagerDetails,
|
||||
IExtHostQueryEvent
|
||||
ISerializationManagerDetails
|
||||
} from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IUndoStopOptions } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
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';
|
||||
import { IQueryEvent } from 'sql/workbench/services/query/common/queryModel';
|
||||
|
||||
export abstract class ExtHostAzureBlobShape {
|
||||
public $createSas(connectionUri: string, blobContainerUri: string, blobStorageKey: string, storageAccountName: string, expirationDate: string): Thenable<mssql.CreateSasResponse> { throw ni(); }
|
||||
@@ -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: IExtHostQueryEvent): void;
|
||||
$onQueryEvent(providerId: string, handle: number, fileUri: string, event: IQueryEvent): void;
|
||||
}
|
||||
|
||||
export interface MainThreadQueryEditorShape extends IDisposable {
|
||||
|
||||
21
src/sql/workbench/api/common/sqlExtHostTypeConverters.ts
Normal file
21
src/sql/workbench/api/common/sqlExtHostTypeConverters.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import type * as azdata from 'azdata';
|
||||
import { IQueryInfo } from 'sql/workbench/services/query/common/queryModel';
|
||||
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
|
||||
|
||||
export namespace QueryInfo {
|
||||
|
||||
export function to(queryInfo: IQueryInfo | undefined): azdata.queryeditor.QueryInfo | undefined {
|
||||
if (!queryInfo) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
messages: queryInfo.messages,
|
||||
range: queryInfo.range.map(r => typeConverters.Range.to(r))
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1057,14 +1057,3 @@ 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user