mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 17:23:05 -05:00
Adding Execution Plan Editor to ADS (#18696)
* Pushing Execution Plan Editor * Renaming class Handling error * Awaiting for handlers to be registered * Addressing some PR comments * Fixing return type for provider * Fixing editor id and removing unnecessary overrides * Adding a namespace * adding execution plan namespace * Adding protocol comment * Fixing if logic * Fixing error message * Cleaning up code * cleanup code * Adding help comments * Fixing method call * Using path.ts to get the base file name * converting to lambda functions * Adding comment for run action * Fixing pr comments * Fixing editor label * Fixing doc comments * Adding some more comments * Fixign branding in comments
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { EditorModel } from 'vs/workbench/common/editor/editorModel';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
|
||||
export class ExecutionPlanInput extends EditorInput {
|
||||
|
||||
public static ID: string = 'workbench.editorinputs.executionplan';
|
||||
public static SCHEMA: string = 'executionplan';
|
||||
|
||||
private _content?: string;
|
||||
|
||||
constructor(
|
||||
private _uri: URI,
|
||||
@ITextFileService private readonly _fileService: ITextFileService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
override get typeId(): string {
|
||||
return ExecutionPlanInput.ID;
|
||||
}
|
||||
|
||||
public override getName(): string {
|
||||
return path.basename(this._uri.fsPath);
|
||||
}
|
||||
|
||||
public get content(): string | undefined {
|
||||
return this._content;
|
||||
}
|
||||
|
||||
public getUri(): string {
|
||||
return this._uri.toString();
|
||||
}
|
||||
|
||||
public getFileExtension(): string {
|
||||
return path.extname(this._uri.fsPath);
|
||||
}
|
||||
|
||||
public supportsSplitEditor(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
public override async resolve(refresh?: boolean): Promise<EditorModel | undefined> {
|
||||
if (!this._content) {
|
||||
this._content = (await this._fileService.read(this._uri, { acceptTextOnly: true })).value;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get resource(): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user