Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions extensions/mssql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1805,6 +1805,12 @@
"default": false,
"scope": "resource"
},
"mssql.showBatchMessages": {
"type": "boolean",
"description": "%mssql.showBatchMessages%",
"default": true,
"scope": "resource"
},
"mssql.splitPaneSelection": {
"type": "string",
"description": "%mssql.splitPaneSelection%",
Expand Down
1 change: 1 addition & 0 deletions extensions/mssql/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"mssql.copyIncludeHeaders": "[Optional] Configuration options for copying results from the Results View",
"mssql.copyRemoveNewLine": "[Optional] Configuration options for copying multi-line results from the Results View",
"mssql.showBatchTime": "[Optional] Should execution time be shown for individual batches",
"mssql.showBatchMessages": "[Optional] Show batch start and completion messages including 'Started executing query at...' and 'Commands completed successfully' messages.",
"mssql.splitPaneSelection": "[Optional] Configuration options for which column new result panes should open in",
"mssql.preventAutoExecuteScript": "Prevent automatic execution of scripts (e.g., 'Select Top 1000'). When enabled, scripts will not be automatically executed upon generation.",
"mssql.format.alignColumnDefinitionsInColumns": "Should column definitions be aligned?",
Expand Down
1 change: 1 addition & 0 deletions extensions/mssql/src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export const configMaxRecentConnections = "maxRecentConnections";
export const configCopyRemoveNewLine = "copyRemoveNewLine";
export const configSplitPaneSelection = "splitPaneSelection";
export const configShowBatchTime = "showBatchTime";
export const configShowBatchMessages = "showBatchMessages";
export const configPreventAutoExecuteScript = "mssql.query.preventAutoExecuteScript";
export enum extConfigResultKeys {
Shortcuts = "shortcuts",
Expand Down
24 changes: 18 additions & 6 deletions extensions/mssql/src/controllers/queryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,13 +559,25 @@ export default class QueryRunner {
let message = obj.message;
message.time = new Date(message.time).toLocaleTimeString();

// save the message into the batch summary so it can be restored on view refresh
if (message.batchId >= 0 && this._batchSetMessages[message.batchId] !== undefined) {
this._batchSetMessages[message.batchId].push(message);
}
// Check configuration to see if batch messages should be shown
let extConfig = this._vscodeWrapper.getConfiguration(
Constants.extensionConfigSectionName,
this.uri,
);
let showBatchMessages: boolean = extConfig.get(Constants.configShowBatchMessages);

// Only show success messages if the configuration allows it
let shouldShowMessage = message.isError || showBatchMessages;

// Send the message to the results pane
this._messageEmitter.fire(message);
if (shouldShowMessage) {
// save the message into the batch summary so it can be restored on view refresh
if (message.batchId >= 0 && this._batchSetMessages[message.batchId] !== undefined) {
this._batchSetMessages[message.batchId].push(message);
}

// Send the message to the results pane
this._messageEmitter.fire(message);
}

// Set row count on status bar if there are no errors
if (!obj.message.isError) {
Expand Down
12 changes: 12 additions & 0 deletions extensions/mssql/src/models/sqlOutputContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,18 @@ export class SqlOutputContentProvider {
);

const batchStartListener = queryRunner.onBatchStart(async (batch) => {
// Check configuration to see if batch messages should be shown
let queryUri = queryRunner.uri;
let extConfig = this._vscodeWrapper.getConfiguration(
Constants.extensionConfigSectionName,
queryUri,
);
let showBatchMessages: boolean = extConfig.get(Constants.configShowBatchMessages);

if (showBatchMessages === false) {
return;
}

let time = new Date().toLocaleTimeString();
if (batch.executionElapsed && batch.executionEnd) {
time = new Date(batch.executionStart).toLocaleTimeString();
Expand Down