mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Kusto - ADS Core changes (#11750)
* ADS Core changes * Generic fix to get language mode based on providerId * Addressed comments * Fix failing tests * Fix for "New Notebook" from file menu option * Remove line * Fix for merge conflict * Add removed comment back * Addressed comments Co-authored-by: Monica Gupta <mogupt@microsoft.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
import { EditDataInput } from 'sql/workbench/browser/editData/editDataInput';
|
||||
import { IConnectableInput } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IConnectableInput, IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IQueryEditorService, INewSqlEditorOptions } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
|
||||
@@ -36,22 +36,23 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
@IUntitledTextEditorService private _untitledEditorService: IUntitledTextEditorService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
|
||||
) {
|
||||
}
|
||||
|
||||
////// Public functions
|
||||
|
||||
/**
|
||||
* Creates new untitled document for SQL query and opens in new editor tab
|
||||
* Creates new untitled document for SQL/Kusto query and opens in new editor tab
|
||||
*/
|
||||
public async newSqlEditor(options: INewSqlEditorOptions = {}): Promise<IConnectableInput> {
|
||||
public async newSqlEditor(options: INewSqlEditorOptions = {}, connectionProviderName?: string): Promise<IConnectableInput> {
|
||||
options = mixin(options, defaults, false);
|
||||
// Create file path and file URI
|
||||
let docUri: URI = options.resource ?? URI.from({ scheme: Schemas.untitled, path: await this.createUntitledSqlFilePath() });
|
||||
let docUri: URI = options.resource ?? URI.from({ scheme: Schemas.untitled, path: await this.createUntitledSqlFilePath(connectionProviderName) });
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: 'sql' }) as UntitledTextEditorInput;
|
||||
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: this._connectionManagementService.getProviderLanguageMode(connectionProviderName) }) as UntitledTextEditorInput;
|
||||
let untitledEditorModel = await fileInput.resolve() as UntitledTextEditorModel;
|
||||
if (options.initalContent) {
|
||||
untitledEditorModel.textEditorModel.setValue(options.initalContent);
|
||||
@@ -99,8 +100,11 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
}
|
||||
|
||||
////// Private functions
|
||||
private createUntitledSqlFilePath(providerName?: string): Promise<string> {
|
||||
if (providerName === 'KUSTO') {
|
||||
return this.createPrefixedSqlFilePath(providerName + 'Query');
|
||||
}
|
||||
|
||||
private createUntitledSqlFilePath(): Promise<string> {
|
||||
return this.createPrefixedSqlFilePath('SQLQuery');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user