@@ -16,11 +16,11 @@ import { QueryHistoryItemOptions } from './query-history';
1616import { isQuickQueryPath } from './quick-query' ;
1717
1818/**
19- * Maximum number of lines to put in a binary choice dialog message,
19+ * Maximum number of lines to include from database upgrade message,
2020 * to work around the fact that we can't guarantee a scrollable text
21- * box for it.
21+ * box for it when displaying in dialog boxes .
2222 */
23- const MAX_MESSAGE_LINES = 20 ;
23+ const MAX_UPGRADE_MESSAGE_LINES = 10 ;
2424
2525/**
2626 * queries.ts
@@ -281,12 +281,26 @@ async function checkAndConfirmDatabaseUpgrade(qs: qsClient.QueryServerClient, db
281281 logger . log ( descriptionMessage ) ;
282282 // Ask the user to confirm the upgrade.
283283
284+ const showLogItem : vscode . MessageItem = { title : 'No, Show Changes' , isCloseAffordance : true } ;
285+ const yesItem = { title : 'Yes' , isCloseAffordance : false } ;
286+ const noItem = { title : 'No' , isCloseAffordance : true }
287+ let dialogOptions : vscode . MessageItem [ ] = [ yesItem , noItem ] ;
288+
284289 let messageLines = descriptionMessage . split ( '\n' ) ;
285- if ( messageLines . length > MAX_MESSAGE_LINES ) {
286- messageLines = messageLines . slice ( 0 , MAX_MESSAGE_LINES ) ;
287- messageLines . push ( "... [full list of changes can be found in Output > CodeQL Extension Log]" ) ;
290+ if ( messageLines . length > MAX_UPGRADE_MESSAGE_LINES ) {
291+ messageLines = messageLines . slice ( 0 , MAX_UPGRADE_MESSAGE_LINES ) ;
292+ messageLines . push ( "... [truncating list of upgrades, click 'No, Show Changes' see full list]" ) ;
293+ dialogOptions . push ( showLogItem ) ;
288294 }
289- const shouldUpgrade = await helpers . showBinaryChoiceDialog ( `Should the database ${ db . databaseUri . fsPath } be upgraded?\n\n${ messageLines . join ( "\n" ) } ` ) ;
295+
296+ const message = `Should the database ${ db . databaseUri . fsPath } be upgraded?\n\n${ messageLines . join ( "\n" ) } ` ;
297+ const chosenItem = await vscode . window . showInformationMessage ( message , { modal : true } , ...dialogOptions ) ;
298+
299+ if ( chosenItem === showLogItem ) {
300+ logger . outputChannel . show ( ) ;
301+ }
302+
303+ const shouldUpgrade = chosenItem === yesItem ;
290304 if ( shouldUpgrade ) {
291305 return params ;
292306 }
0 commit comments