@@ -15,6 +15,13 @@ import { promisify } from 'util';
1515import { QueryHistoryItemOptions } from './query-history' ;
1616import { isQuickQueryPath } from './quick-query' ;
1717
18+ /**
19+ * Maximum number of lines to include from database upgrade message,
20+ * to work around the fact that we can't guarantee a scrollable text
21+ * box for it when displaying in dialog boxes.
22+ */
23+ const MAX_UPGRADE_MESSAGE_LINES = 10 ;
24+
1825/**
1926 * queries.ts
2027 * -------------
@@ -273,8 +280,27 @@ async function checkAndConfirmDatabaseUpgrade(qs: qsClient.QueryServerClient, db
273280
274281 logger . log ( descriptionMessage ) ;
275282 // Ask the user to confirm the upgrade.
276- const shouldUpgrade = await helpers . showBinaryChoiceDialog ( `Should the database ${ db . databaseUri . fsPath } be upgraded?\n\n${ descriptionMessage } ` ) ;
277- if ( shouldUpgrade ) {
283+
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+
289+ let messageLines = descriptionMessage . split ( '\n' ) ;
290+ if ( messageLines . length > MAX_UPGRADE_MESSAGE_LINES ) {
291+ messageLines = messageLines . slice ( 0 , MAX_UPGRADE_MESSAGE_LINES ) ;
292+ messageLines . push ( `The list of upgrades was truncated, click "No, Show Changes" to see the full list.` ) ;
293+ dialogOptions . push ( showLogItem ) ;
294+ }
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+ if ( chosenItem === yesItem ) {
278304 return params ;
279305 }
280306 else {
0 commit comments