@@ -111,7 +111,7 @@ export async function showPlanWebview(args: {
111111 const planXML : string = await api
112112 . actionQuery ( "SELECT %SYSTEM.QUERY_PLAN(?,,,,,?) XML" , [
113113 args . sqlQuery . trimEnd ( ) ,
114- `{"selectmode":"${ args . selectMode } "${ args . imports . length ? `,"packages":"$LFS(\\"${ [ ...new Set ( args . imports ) ] . join ( "," ) } \\")"` : "" } ${ args . includes . length ? `,"includeFiles":"$LFS(\\"${ [ ...new Set ( args . includes ) ] . join ( "," ) } \\")"` : "" } }` ,
114+ `{${ ! lt ( api . config . serverVersion , "2026.1.0" ) ? '"format":"LINEAR-XML",' : "" } "selectmode":"${ args . selectMode } "${ args . imports . length ? `,"packages":"$LFS(\\"${ [ ...new Set ( args . imports ) ] . join ( "," ) } \\")"` : "" } ${ args . includes . length ? `,"includeFiles":"$LFS(\\"${ [ ...new Set ( args . includes ) ] . join ( "," ) } \\")"` : "" } }` ,
115115 ] )
116116 . then ( ( data ) => data ?. result ?. content [ 0 ] ?. XML )
117117 . catch ( ( error ) => {
@@ -134,8 +134,8 @@ export async function showPlanWebview(args: {
134134 switch ( planChild . nodeName ) {
135135 case "sql" :
136136 planHTML += '<h3>Statement Text</h3>\n<div class="code-block">\n' ;
137- for ( const line of planChild . textContent . trim ( ) . split ( / \r ? \n / ) ) {
138- planHTML += `${ htmlEncode ( line . trim ( ) ) } \n` ;
137+ for ( const line of args . sqlQuery . trimEnd ( ) . split ( / \r ? \n / ) ) {
138+ planHTML += `${ htmlEncode ( line . trimEnd ( ) ) } \n` ;
139139 }
140140 planHTML += `</div>\n<hr class="vscode-divider">\n` ;
141141 break ;
@@ -145,18 +145,15 @@ export async function showPlanWebview(args: {
145145 case "info" :
146146 planHTML += `<h3 class="info-h">Information</h3>\n${ formatTextBlock ( planChild . textContent ) } <hr class="vscode-divider">\n` ;
147147 break ;
148- case "cost" :
148+ case "cost" : {
149149 planHTML += `<h4>Relative Cost ` ;
150150 // The plan might not have a cost
151- planHTML +=
152- planChild . attributes . length &&
153- planChild . attributes . item ( 0 ) . nodeName == "value" &&
154- + planChild . attributes . item ( 0 ) . value
155- ? `= ${ planChild . attributes . item ( 0 ) . value } `
156- : "Unavailable" ;
151+ const cost = planChild . attributes . getNamedItem ( "value" ) ?. value ;
152+ planHTML += + cost ? `= ${ cost } ` : "Unavailable" ;
157153 planHTML += "</h4>\n" ;
158154 capturePlan = true ;
159155 break ;
156+ }
160157 case "#text" :
161158 if ( capturePlan ) {
162159 planText += planChild . textContent ;
0 commit comments