File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898 "default" : false ,
9999 "description" : " (Unstable) Use embedded language server for intelligent completion and hover information."
100100 },
101+ "SQLNotebook.outputJSON" : {
102+ "type" : " boolean" ,
103+ "default" : false ,
104+ "description" : " Output JSON in addition to markdown. Other extensions may use this output type to render an interactive table."
105+ },
101106 "SQLNotebook.queryTimeout" : {
102107 "type" : " number" ,
103108 "default" : 30000 ,
Original file line number Diff line number Diff line change @@ -92,10 +92,13 @@ export class SQLNotebookController {
9292
9393 writeSuccess (
9494 execution ,
95- result . map ( ( item ) => [
96- text ( resultToMarkdownTable ( item ) , 'text/markdown' ) ,
97- json ( item ) ,
98- ] )
95+ result . map ( ( item ) => {
96+ const outputs = [ text ( resultToMarkdownTable ( item ) , 'text/markdown' ) ] ;
97+ if ( outputJsonMimeType ( ) ) {
98+ outputs . push ( json ( item ) ) ;
99+ }
100+ return outputs ;
101+ } )
99102 ) ;
100103 }
101104}
@@ -118,3 +121,9 @@ function writeSuccess(
118121 ) ;
119122 execution . end ( true , Date . now ( ) ) ;
120123}
124+
125+ function outputJsonMimeType ( ) : boolean {
126+ return (
127+ vscode . workspace . getConfiguration ( 'SQLNotebook' ) . get ( 'outputJSON' ) ?? false
128+ ) ;
129+ }
You can’t perform that action at this time.
0 commit comments