mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Rework how we handle custom editors (#5696)
* update how we handle editors * small edit * handle changing languages * implement generic language association * implement notebook serializers * fix tests * formatting * update how we handle editors * small edit * handle changing languages * implement generic language association * implement notebook serializers * fix tests * formatting * fix broken * fix compile * fix tests * add back in removed note book contributions * fix layering * fix compile errors * fix workbench * fix hanging promises * idk why these changed * fix change * add comments to language change code * fix a few bugs * add query plan association
This commit is contained in:
@@ -20,7 +20,7 @@ import { ipcRenderer as ipc } from 'electron';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { localize } from 'vs/nls';
|
||||
import { QueryInput } from 'sql/workbench/contrib/query/common/queryInput';
|
||||
import { QueryEditorInput } from 'sql/workbench/contrib/query/common/queryEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -202,21 +202,18 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
// If an open and connectable query editor exists for the given URI, attach it to the connection profile
|
||||
private async processFile(uriString: string, profile: IConnectionProfile, warnOnConnectFailure: boolean): Promise<void> {
|
||||
let activeEditor = this._editorService.editors.filter(v => v.getResource().toString() === uriString).pop();
|
||||
if (activeEditor) {
|
||||
let queryInput = activeEditor as QueryInput;
|
||||
if (queryInput && queryInput.state.connected) {
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: queryInput },
|
||||
saveTheConnection: false,
|
||||
showDashboard: false,
|
||||
showConnectionDialogOnError: warnOnConnectFailure,
|
||||
showFirewallRuleOnError: warnOnConnectFailure
|
||||
};
|
||||
if (this._notificationService) {
|
||||
this._notificationService.status(localize('connectingQueryLabel', "Connecting query file"), { hideAfter: 2500 });
|
||||
}
|
||||
await this._connectionManagementService.connect(profile, uriString, options);
|
||||
if (activeEditor instanceof QueryEditorInput && activeEditor.state.connected) {
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: activeEditor },
|
||||
saveTheConnection: false,
|
||||
showDashboard: false,
|
||||
showConnectionDialogOnError: warnOnConnectFailure,
|
||||
showFirewallRuleOnError: warnOnConnectFailure
|
||||
};
|
||||
if (this._notificationService) {
|
||||
this._notificationService.status(localize('connectingQueryLabel', "Connecting query file"), { hideAfter: 2500 });
|
||||
}
|
||||
await this._connectionManagementService.connect(profile, uriString, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user