mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
Fix opening new untitled query (#16078)
This commit is contained in:
@@ -24,6 +24,7 @@ import { getCurrentGlobalConnection } from 'sql/workbench/browser/taskUtilities'
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
const defaults: INewSqlEditorOptions = {
|
||||
open: true
|
||||
};
|
||||
@@ -50,7 +51,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
/**
|
||||
* Creates new untitled document for SQL/Kusto query and opens in new editor tab
|
||||
*/
|
||||
public async newSqlEditor(options: INewSqlEditorOptions = {}, connectionProviderName?: string): Promise<IConnectableInput> {
|
||||
public async newSqlEditor(options: INewSqlEditorOptions = {}, connectionProviderName?: string): Promise<UntitledQueryEditorInput> {
|
||||
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(connectionProviderName) });
|
||||
|
||||
@@ -7,6 +7,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
|
||||
import { IConnectableInput } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
|
||||
export interface IQueryEditorOptions extends IEditorOptions {
|
||||
|
||||
@@ -44,7 +45,7 @@ export interface IQueryEditorService {
|
||||
_serviceBrand: undefined;
|
||||
|
||||
// Creates new untitled document for SQL/KUSTO queries and opens it in a new editor tab
|
||||
newSqlEditor(options?: INewSqlEditorOptions, connectionProviderName?: string): Promise<IConnectableInput>;
|
||||
newSqlEditor(options?: INewSqlEditorOptions, connectionProviderName?: string): Promise<UntitledQueryEditorInput>;
|
||||
|
||||
// Creates new edit data session
|
||||
newEditDataEditor(schemaName: string, tableName: string, queryString: string): Promise<IConnectableInput>;
|
||||
|
||||
@@ -19,7 +19,7 @@ export class TestQueryEditorService implements IQueryEditorService {
|
||||
@IEditorService private readonly editorService: IEditorService) {
|
||||
}
|
||||
|
||||
newSqlEditor(options?: INewSqlEditorOptions): Promise<IConnectableInput> {
|
||||
newSqlEditor(options?: INewSqlEditorOptions): Promise<UntitledQueryEditorInput> {
|
||||
const base = this.editorService.createEditorInput({ forceUntitled: true }) as UntitledTextEditorInput;
|
||||
return Promise.resolve(this.instantiationService.createInstance(UntitledQueryEditorInput, '', base, new QueryResultsInput(base.resource.toString(true))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user