mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Adding Execution Plan Editor to ADS (#18696)
* Pushing Execution Plan Editor * Renaming class Handling error * Awaiting for handlers to be registered * Addressing some PR comments * Fixing return type for provider * Fixing editor id and removing unnecessary overrides * Adding a namespace * adding execution plan namespace * Adding protocol comment * Fixing if logic * Fixing error message * Cleaning up code * cleanup code * Adding help comments * Fixing method call * Using path.ts to get the base file name * converting to lambda functions * Adding comment for run action * Fixing pr comments * Fixing editor label * Fixing doc comments * Adding some more comments * Fixign branding in comments
This commit is contained in:
@@ -1114,3 +1114,16 @@ export namespace DisposeTableDesignerRequest {
|
||||
export const type = new RequestType<azdata.designers.TableInfo, void, void, void>('tabledesigner/dispose');
|
||||
}
|
||||
// ------------------------------- < Table Designer > ------------------------------------
|
||||
|
||||
|
||||
// ------------------------------- < Execution Plan > ------------------------------------
|
||||
|
||||
export interface GetExecutionPlanParams {
|
||||
graphInfo: azdata.executionPlan.ExecutionPlanGraphInfo,
|
||||
}
|
||||
|
||||
export namespace GetExecutionPlanRequest {
|
||||
export const type = new RequestType<GetExecutionPlanParams, azdata.executionPlan.GetExecutionPlanResult, void, void>('queryexecutionplan/getexecutionplan');
|
||||
}
|
||||
|
||||
// ------------------------------- < Execution Plan > ------------------------------------
|
||||
|
||||
@@ -1183,3 +1183,48 @@ export class TableDesignerFeature extends SqlOpsFeature<undefined> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execution Plan Service Feature
|
||||
* TODO: Move this feature to data protocol client repo once stablized
|
||||
*/
|
||||
export class ExecutionPlanServiceFeature extends SqlOpsFeature<undefined> {
|
||||
private static readonly messagesTypes: RPCMessageType[] = [
|
||||
contracts.GetExecutionPlanRequest.type,
|
||||
];
|
||||
|
||||
constructor(client: SqlOpsDataClient) {
|
||||
super(client, ExecutionPlanServiceFeature.messagesTypes);
|
||||
}
|
||||
|
||||
public fillClientCapabilities(capabilities: ClientCapabilities): void {
|
||||
}
|
||||
|
||||
public initialize(capabilities: ServerCapabilities): void {
|
||||
this.register(this.messages, {
|
||||
id: UUID.generateUuid(),
|
||||
registerOptions: undefined
|
||||
});
|
||||
}
|
||||
|
||||
protected registerProvider(options: undefined): Disposable {
|
||||
const client = this._client;
|
||||
|
||||
const getExecutionPlan = (planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.GetExecutionPlanResult> => {
|
||||
const params: contracts.GetExecutionPlanParams = { graphInfo: planFile };
|
||||
return client.sendRequest(contracts.GetExecutionPlanRequest.type, params).then(
|
||||
r => r,
|
||||
e => {
|
||||
client.logFailedRequest(contracts.GetExecutionPlanRequest.type, e);
|
||||
return Promise.reject(e);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return azdata.dataprotocol.registerExecutionPlanProvider({
|
||||
providerId: client.providerId,
|
||||
getExecutionPlan
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as path from 'path';
|
||||
import { getCommonLaunchArgsAndCleanupOldLogFiles, getOrDownloadServer } from './utils';
|
||||
import { Telemetry, LanguageClientErrorHandler } from './telemetry';
|
||||
import { SqlOpsDataClient, ClientOptions } from 'dataprotocol-client';
|
||||
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature, TableDesignerFeature } from './features';
|
||||
import { TelemetryFeature, AgentServicesFeature, SerializationFeature, AccountFeature, SqlAssessmentServicesFeature, ProfilerFeature, TableDesignerFeature, ExecutionPlanServiceFeature } from './features';
|
||||
import { CredentialStore } from './credentialstore/credentialstore';
|
||||
import { AzureResourceProvider } from './resourceProvider/resourceProvider';
|
||||
import { SchemaCompareService } from './schemaCompare/schemaCompareService';
|
||||
@@ -165,7 +165,8 @@ function getClientOptions(context: AppContext): ClientOptions {
|
||||
ProfilerFeature,
|
||||
SqlMigrationService.asFeature(context),
|
||||
SqlCredentialService.asFeature(context),
|
||||
TableDesignerFeature
|
||||
TableDesignerFeature,
|
||||
ExecutionPlanServiceFeature
|
||||
],
|
||||
outputChannel: new CustomOutputChannel()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user