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

@@ -601,7 +601,7 @@ declare module 'azdata' {
/**
* Contains execution plans returned by the database in ResultSets.
*/
executionPlans: ExecutionPlanGraph[];
executionPlans: executionPlan.ExecutionPlanGraph[];
}
export interface ObjectMetadata {
@@ -633,11 +633,13 @@ declare module 'azdata' {
}
export enum DataProviderType {
TableDesignerProvider = 'TableDesignerProvider'
TableDesignerProvider = 'TableDesignerProvider',
ExecutionPlanProvider = 'ExecutionPlanProvider'
}
export namespace dataprotocol {
export function registerTableDesignerProvider(provider: designers.TableDesignerProvider): vscode.Disposable;
export function registerExecutionPlanProvider(provider: executionPlan.ExecutionPlanProvider): vscode.Disposable;
}
export namespace designers {
@@ -1111,138 +1113,154 @@ declare module 'azdata' {
}
}
export interface ExecutionPlanGraph {
/**
* Root of the execution plan tree
*/
root: ExecutionPlanNode;
/**
* Underlying query for the execution plan graph.
*/
query: string;
/**
* String representation of graph
*/
graphFile: ExecutionPlanGraphFile;
/**
* Query recommendations for optimizing performance
*/
recommendations: ExecutionPlanRecommendations[];
}
export namespace executionPlan {
export interface ExecutionPlanGraph {
/**
* Root of the execution plan tree
*/
root: ExecutionPlanNode;
/**
* Underlying query for the execution plan graph.
*/
query: string;
/**
* String representation of graph
*/
graphFile: ExecutionPlanGraphInfo;
/**
* Query recommendations for optimizing performance
*/
recommendations: ExecutionPlanRecommendations[];
}
export interface ExecutionPlanNode {
/**
* Type of the node. This property determines the icon that is displayed for it
*/
type: string;
/**
* Cost associated with the node
*/
cost: number;
/**
* Cost of the node subtree
*/
subTreeCost: number;
/**
* Relative cost of the node compared to its siblings.
*/
relativeCost: number;
/**
* Time take by the node operation in milliseconds
*/
elapsedTimeInMs: number;
/**
* Node properties to be shown in the tooltip
*/
properties: ExecutionPlanGraphElementProperty[];
/**
* Display name for the node
*/
name: string;
/**
* Description associated with the node.
*/
description: string;
/**
* Subtext displayed under the node name
*/
subtext: string[];
/**
* Direct children of the nodes.
*/
children: ExecutionPlanNode[];
/**
* Edges corresponding to the children.
*/
edges: ExecutionPlanEdge[];
}
export interface ExecutionPlanNode {
/**
* Type of the node. This property determines the icon that is displayed for it
*/
type: string;
/**
* Cost associated with the node
*/
cost: number;
/**
* Cost of the node subtree
*/
subTreeCost: number;
/**
* Relative cost of the node compared to its siblings.
*/
relativeCost: number;
/**
* Time take by the node operation in milliseconds
*/
elapsedTimeInMs: number;
/**
* Node properties to be shown in the tooltip
*/
properties: ExecutionPlanGraphElementProperty[];
/**
* Display name for the node
*/
name: string;
/**
* Description associated with the node.
*/
description: string;
/**
* Subtext displayed under the node name
*/
subtext: string[];
/**
* Direct children of the nodes.
*/
children: ExecutionPlanNode[];
/**
* Edges corresponding to the children.
*/
edges: ExecutionPlanEdge[];
}
export interface ExecutionPlanEdge {
/**
* Count of the rows returned by the subtree of the edge.
*/
rowCount: number;
/**
* Size of the rows returned by the subtree of the edge.
*/
rowSize: number;
/**
* Edge properties to be shown in the tooltip.
*/
properties: ExecutionPlanGraphElementProperty[]
}
export interface ExecutionPlanEdge {
/**
* Count of the rows returned by the subtree of the edge.
*/
rowCount: number;
/**
* Size of the rows returned by the subtree of the edge.
*/
rowSize: number;
/**
* Edge properties to be shown in the tooltip.
*/
properties: ExecutionPlanGraphElementProperty[]
}
export interface ExecutionPlanGraphElementProperty {
/**
* Name of the property
*/
name: string;
/**
* value for the property
*/
value: string | ExecutionPlanGraphElementProperty[];
/**
* Flag to show/hide props in tooltip
*/
showInTooltip: boolean;
/**
* Display order of property
*/
displayOrder: number;
/**
* Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip
*/
positionAtBottom: boolean;
/**
* Display value of property to show in tooltip and other UI element.
*/
displayValue: string;
}
export interface ExecutionPlanGraphElementProperty {
/**
* Name of the property
*/
name: string;
/**
* value for the property
*/
value: string | ExecutionPlanGraphElementProperty[];
/**
* Flag to show/hide props in tooltip
*/
showInTooltip: boolean;
/**
* Display order of property
*/
displayOrder: number;
/**
* Flag to indicate if the property has a longer value so that it will be shown at the bottom of the tooltip
*/
positionAtBottom: boolean;
/**
* Display value of property to show in tooltip and other UI element.
*/
displayValue: string;
}
export interface ExecutionPlanRecommendations {
/**
* Text displayed in the show plan graph control description
*/
displayString: string;
/**
* Query that is recommended to the user
*/
queryText: string;
/**
* Query that will be opened in a new file once the user click on the recommendation
*/
queryWithDescription: string;
}
export interface ExecutionPlanRecommendations {
/**
* Text displayed in the show plan graph control description
*/
displayString: string;
/**
* Query that is recommended to the user
*/
queryText: string;
/**
* Query that will be opened in a new file once the user click on the recommendation
*/
queryWithDescription: string;
}
export interface ExecutionPlanGraphFile {
/**
* File contents
*/
graphFileContent: string;
/**
* File type for execution plan. This will be the file type of the editor when the user opens the graph file
*/
graphFileType: string;
export interface ExecutionPlanGraphInfo {
/**
* File contents
*/
graphFileContent: string;
/**
* File type for execution plan. This will be the file type of the editor when the user opens the graph file
*/
graphFileType: string;
}
export interface GetExecutionPlanResult extends ResultStatus {
graphs: ExecutionPlanGraph[]
}
export interface ExecutionPlanProvider extends DataProvider {
// execution plan service methods
/**
* Gets the execution plan graph from the provider for a given plan file
* @param planFile file that contains the execution plan
*/
getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable<GetExecutionPlanResult>;
}
}
/**