mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
fixed actual show plan command (#2620)
This commit is contained in:
committed by
Karl Burtram
parent
084042ad13
commit
a2fb0ec029
@@ -553,7 +553,10 @@ class GridTable<T> extends Disposable implements IView {
|
|||||||
private loadData(offset: number, count: number): Thenable<T[]> {
|
private loadData(offset: number, count: number): Thenable<T[]> {
|
||||||
return this.runner.getQueryRows(offset, count, this.resultSet.batchId, this.resultSet.id).then(response => {
|
return this.runner.getQueryRows(offset, count, this.resultSet.batchId, this.resultSet.id).then(response => {
|
||||||
if (this.runner.isQueryPlan) {
|
if (this.runner.isQueryPlan) {
|
||||||
this.instantiationService.createInstance(ShowQueryPlanAction).run(response.resultSubset.rows[0][0].displayValue);
|
// it's a show plan response
|
||||||
|
if (response.resultSubset.rowCount === 1) {
|
||||||
|
this.instantiationService.createInstance(ShowQueryPlanAction).run(response.resultSubset.rows[0][0].displayValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return response.resultSubset.rows.map(r => {
|
return response.resultSubset.rows.map(r => {
|
||||||
let dataWithSchema = {};
|
let dataWithSchema = {};
|
||||||
|
|||||||
@@ -377,6 +377,26 @@ export class QueryEditor extends BaseEditor {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getAllSelection(): ISelectionData {
|
||||||
|
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||||
|
let control = this._sqlEditor.getControl();
|
||||||
|
let codeEditor: ICodeEditor = <ICodeEditor>control;
|
||||||
|
if (codeEditor) {
|
||||||
|
let model = codeEditor.getModel();
|
||||||
|
let totalLines = model.getLineCount();
|
||||||
|
let endColumn = model.getLineMaxColumn(totalLines);
|
||||||
|
let selection: ISelectionData = {
|
||||||
|
startLine: 0,
|
||||||
|
startColumn: 0,
|
||||||
|
endLine: totalLines - 1,
|
||||||
|
endColumn: endColumn - 1,
|
||||||
|
};
|
||||||
|
return selection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public getSelectionText(): string {
|
public getSelectionText(): string {
|
||||||
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
if (this._sqlEditor && this._sqlEditor.getControl()) {
|
||||||
let control = this._sqlEditor.getControl();
|
let control = this._sqlEditor.getControl();
|
||||||
|
|||||||
@@ -271,7 +271,11 @@ export class ActualQueryPlanAction extends QueryTaskbarAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.isConnected(editor)) {
|
if (this.isConnected(editor)) {
|
||||||
editor.currentQueryInput.runQuery(editor.getSelection(), {
|
let selection = editor.getSelection();
|
||||||
|
if (!selection) {
|
||||||
|
selection = editor.getAllSelection();
|
||||||
|
}
|
||||||
|
editor.currentQueryInput.runQuery(selection, {
|
||||||
displayActualQueryPlan: true
|
displayActualQueryPlan: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export class QueryPlanView implements IPanelView {
|
|||||||
}
|
}
|
||||||
container.appendChild(this.container);
|
container.appendChild(this.container);
|
||||||
container.style.overflow = 'scroll';
|
container.style.overflow = 'scroll';
|
||||||
container.style.background = '#FFFFFF';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(dimension: Dimension): void {
|
public layout(dimension: Dimension): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user