File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 11# Change Log
22
3+ ## Unreleased
4+
5+ - New configuration option for maximum number of result rows before truncating the result table.
6+ Defaults to ` 25 ` .
7+
8+ ``` json
9+ {
10+ "SQLNotebook.maxResultRows" : 25
11+ }
12+ ```
13+
314## v0.5.0
415
516- Bundle ` sqls ` language server into ` vscode-sql-notebook ` .
Original file line number Diff line number Diff line change 102102 "type" : " number" ,
103103 "default" : 30000 ,
104104 "description" : " Query timeout in milliseconds for cell query execution."
105+ },
106+ "SQLNotebook.maxResultRows" : {
107+ "type" : " number" ,
108+ "default" : 25 ,
109+ "description" : " Maximum number of result rows to display before truncating result table."
105110 }
106111 }
107112 },
Original file line number Diff line number Diff line change @@ -189,15 +189,24 @@ function resultToMarkdownTable(result: TabularResult): string {
189189 return '*Empty Results Table*' ;
190190 }
191191
192- if ( result . length > 20 ) {
193- result = result . slice ( 0 , 20 ) ;
192+ const maxRows = getMaxRows ( ) ;
193+ if ( result . length > maxRows ) {
194+ result = result . slice ( 0 , maxRows ) ;
194195 result . push (
195196 Object . fromEntries ( Object . entries ( result ) . map ( ( pair ) => [ pair [ 0 ] , '...' ] ) )
196197 ) ;
197198 }
198199 return `${ markdownHeader ( result [ 0 ] ) } \n${ result . map ( markdownRow ) . join ( '\n' ) } ` ;
199200}
200201
202+ function getMaxRows ( ) : number {
203+ const fallbackMaxRows = 25 ;
204+ const maxRows : number | undefined = vscode . workspace
205+ . getConfiguration ( 'SQLNotebook' )
206+ . get ( 'maxResultRows' ) ;
207+ return maxRows ?? fallbackMaxRows ;
208+ }
209+
201210function escapeNewline ( a : string | number | null ) : string | number | null {
202211 if ( typeof a === 'string' ) {
203212 return a . replace ( / \n / g, '\\n' ) . replace ( / \r / g, '\\r' ) ;
You can’t perform that action at this time.
0 commit comments