File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ export function activate(context: vscode.ExtensionContext) {
183183 scriptText += `
184184 -- for more info: https://www.brentozar.com/blitzindex/
185185 ` ;
186- new placeScript ( ) . placescript ( fileName , scriptText ) ;
186+ new placeScript ( ) . placescript ( fileName , scriptText , context ) ;
187187
188188 } ;
189189 var disposable_runspblitzindex = vscode . commands . registerCommand ( 'extension.run_sp_blitzindex' , runspblitzindex ) ;
Original file line number Diff line number Diff line change @@ -5,17 +5,24 @@ import * as vscode from 'vscode';
55
66export class placeScript {
77 // places scriptText into fileName editor with current connection
8- public async placescript ( fileName , scriptText ) {
8+ public async placescript ( fileName , scriptText , context ?: sqlops . ObjectExplorerContext ) {
99 var setting : vscode . Uri = vscode . Uri . parse ( "untitled:" + fileName ) ;
1010 try {
11- let connection = await sqlops . connection . getCurrentConnection ( ) ;
11+ var connectId ;
12+ if ( context ) {
13+ let connection = context . connectionProfile ;
14+ connectId = connection . id ;
15+ } else {
16+ let connection = await sqlops . connection . getCurrentConnection ( ) ;
17+ connectId = connection . connectionId ;
18+ }
1219 let doc = await vscode . workspace . openTextDocument ( setting ) ;
1320 let editor = await vscode . window . showTextDocument ( doc , 1 , false ) ;
1421 editor . edit ( edit => {
1522 edit . insert ( new vscode . Position ( 0 , 0 ) , scriptText ) ;
1623 } ) ;
17- if ( connection ) {
18- await sqlops . queryeditor . connect ( doc . uri . toString ( ) , connection . connectionId ) ;
24+ if ( connectId ) {
25+ await sqlops . queryeditor . connect ( doc . uri . toString ( ) , connectId ) ;
1926 }
2027 } catch ( err ) {
2128 vscode . window . showErrorMessage ( err ) ;
You can’t perform that action at this time.
0 commit comments