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:
Aasim Khan
2022-03-16 15:07:29 -07:00
committed by GitHub
parent 95980130c8
commit a0c2dc199e
24 changed files with 692 additions and 161 deletions

View File

@@ -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
});
}
}