mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Use existing resource for untitled if it is already open (#11536)
* use existing resource for untitled if it is already open * remove unnecessary call
This commit is contained in:
@@ -48,8 +48,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
public async newSqlEditor(options: INewSqlEditorOptions = {}): Promise<IConnectableInput> {
|
||||
options = mixin(options, defaults, false);
|
||||
// Create file path and file URI
|
||||
let filePath = await this.createUntitledSqlFilePath();
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
let docUri: URI = options.resource ?? URI.from({ scheme: Schemas.untitled, path: await this.createUntitledSqlFilePath() });
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: 'sql' }) as UntitledTextEditorInput;
|
||||
|
||||
@@ -6,6 +6,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';
|
||||
|
||||
export interface IQueryEditorOptions extends IEditorOptions {
|
||||
|
||||
@@ -27,6 +28,10 @@ export interface INewSqlEditorOptions {
|
||||
* defaults to true
|
||||
*/
|
||||
open?: boolean;
|
||||
/**
|
||||
* use an existing resource, if this matches a resource already open that resource will be opened instead
|
||||
*/
|
||||
resource?: URI
|
||||
}
|
||||
|
||||
export interface IQueryEditorService {
|
||||
|
||||
Reference in New Issue
Block a user