mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 09:35:39 -05:00
do not run query in multi-selection mode (#20213)
* do not run query in multi-selection mode * fix test * fix more tests
This commit is contained in:
@@ -200,6 +200,7 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
editor: QueryEditor,
|
||||
@IQueryModelService protected readonly queryModelService: IQueryModelService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@ICommandService private readonly commandService?: ICommandService
|
||||
) {
|
||||
super(connectionManagementService, editor, RunQueryAction.ID, RunQueryAction.EnabledClass);
|
||||
@@ -238,6 +239,13 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
if (this.isConnected(editor)) {
|
||||
// Hide IntelliSense suggestions list when running query to match SSMS behavior
|
||||
this.commandService?.executeCommand('hideSuggestWidget');
|
||||
// Do not execute when there are multiple selections in the editor until it can be properly handled.
|
||||
// Otherwise only the first selection will be executed and cause unexpected issues.
|
||||
if (editor.getSelections()?.length > 1) {
|
||||
this.notificationService.error(nls.localize('query.multiSelectionNotSupported', "Running query is not supported when the editor is in multiple selection mode."));
|
||||
return true;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user