diff --git a/src/sql/workbench/contrib/notebook/test/electron-browser/cell.test.ts b/src/sql/workbench/contrib/notebook/test/electron-browser/cell.test.ts index f61a96a70a..d8b77fad64 100644 --- a/src/sql/workbench/contrib/notebook/test/electron-browser/cell.test.ts +++ b/src/sql/workbench/contrib/notebook/test/electron-browser/cell.test.ts @@ -24,6 +24,7 @@ import { URI } from 'vs/base/common/uri'; import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService'; +import { ICommandService, NullCommandService } from 'vs/platform/commands/common/commands'; import { ControlType, IChartOption } from 'sql/workbench/contrib/charts/browser/chartOptions'; import { CellModel } from 'sql/workbench/services/notebook/browser/models/cell'; @@ -31,6 +32,7 @@ let instantiationService: IInstantiationService; suite('Cell Model', function (): void { let serviceCollection = new ServiceCollection(); + serviceCollection.set(ICommandService, NullCommandService); instantiationService = new InstantiationService(serviceCollection, true); let factory = new ModelFactory(instantiationService); diff --git a/src/sql/workbench/contrib/query/browser/queryActions.ts b/src/sql/workbench/contrib/query/browser/queryActions.ts index 4e3e6de3b2..422381d6ca 100644 --- a/src/sql/workbench/contrib/query/browser/queryActions.ts +++ b/src/sql/workbench/contrib/query/browser/queryActions.ts @@ -197,7 +197,8 @@ export class RunQueryAction extends QueryTaskbarAction { constructor( editor: QueryEditor, @IQueryModelService protected readonly queryModelService: IQueryModelService, - @IConnectionManagementService connectionManagementService: IConnectionManagementService + @IConnectionManagementService connectionManagementService: IConnectionManagementService, + @ICommandService private readonly commandService?: ICommandService ) { super(connectionManagementService, editor, RunQueryAction.ID, RunQueryAction.EnabledClass); this.label = nls.localize('runQueryLabel', "Run"); @@ -237,6 +238,8 @@ export class RunQueryAction extends QueryTaskbarAction { } if (this.isConnected(editor)) { + // Hide IntelliSense suggestions list when running query to match SSMS behavior + this.commandService?.executeCommand('hideSuggestWidget'); // if the selection isn't empty then execute the selection // otherwise, either run the statement or the script depending on parameter let selection = editor.getSelection(false); diff --git a/src/sql/workbench/services/notebook/browser/models/cell.ts b/src/sql/workbench/services/notebook/browser/models/cell.ts index 7bf4b6be7b..46130ed54a 100644 --- a/src/sql/workbench/services/notebook/browser/models/cell.ts +++ b/src/sql/workbench/services/notebook/browser/models/cell.ts @@ -559,6 +559,8 @@ export class CellModel extends Disposable implements ICellModel { return false; } this._outputCounter = 0; + // Hide IntelliSense suggestions list when running cell to match SSMS behavior + this._commandService.executeCommand('hideSuggestWidget'); this._telemetryService?.createActionEvent(TelemetryKeys.TelemetryView.Notebook, TelemetryKeys.NbTelemetryAction.RunCell) .withAdditionalProperties({ cell_language: kernel.name }) .send();