From 1203ec23076c851ac6a82f2e9929a8253e36f01c Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 10 Mar 2025 08:19:13 -0400 Subject: [PATCH 1/2] Implement `Show Plan` CodeLens --- .vscodeignore | 9 +- src/commands/documaticPreviewPanel.ts | 37 +- src/commands/restDebugPanel.ts | 2 +- src/commands/showPlanPanel.ts | 261 +++++++++ src/commands/viewOthers.ts | 43 +- src/extension.ts | 7 +- src/providers/ObjectScriptCodeLensProvider.ts | 513 +++++++++++++----- src/utils/index.ts | 60 ++ 8 files changed, 735 insertions(+), 197 deletions(-) create mode 100644 src/commands/showPlanPanel.ts diff --git a/.vscodeignore b/.vscodeignore index 559c52bc..0f566a38 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -3,10 +3,11 @@ ** !dist/*.js !dist/*.txt -!snippets/ -!images/ -!syntaxes/ -!webview/ +!snippets/*.json +!images/*.svg +!images/*.png +!syntaxes/*.json +!webview/*.js !CHANGELOG.md !LICENSE !README.md diff --git a/src/commands/documaticPreviewPanel.ts b/src/commands/documaticPreviewPanel.ts index 6db7f6f0..3bee6640 100644 --- a/src/commands/documaticPreviewPanel.ts +++ b/src/commands/documaticPreviewPanel.ts @@ -38,7 +38,7 @@ export class DocumaticPreviewPanel { */ public static currentPanel: DocumaticPreviewPanel | undefined; - public static create(extensionUri: vscode.Uri): void { + public static create(): void { // Get the open document and check that it's an ObjectScript class const openEditor = vscode.window.activeTextEditor; if (openEditor === undefined) { @@ -70,9 +70,6 @@ export class DocumaticPreviewPanel { return; } - // Get the full path to the folder containing our webview files - const webviewFolderUri: vscode.Uri = vscode.Uri.joinPath(extensionUri, "webview"); - // Create the documatic preview webview const panel = vscode.window.createWebviewPanel( this.viewType, @@ -81,20 +78,20 @@ export class DocumaticPreviewPanel { { enableScripts: true, enableCommandUris: true, - localResourceRoots: [webviewFolderUri], + localResourceRoots: [], } ); panel.iconPath = iscIcon; - this.currentPanel = new DocumaticPreviewPanel(panel, webviewFolderUri, openEditor); + this.currentPanel = new DocumaticPreviewPanel(panel, openEditor); } - private constructor(panel: vscode.WebviewPanel, webviewFolderUri: vscode.Uri, editor: vscode.TextEditor) { + private constructor(panel: vscode.WebviewPanel, editor: vscode.TextEditor) { this._panel = panel; this._editor = editor; // Set the webview's initial content - this.setWebviewHtml(webviewFolderUri); + this.setWebviewHtml(); // Register handlers this.registerEventHandlers(); @@ -114,7 +111,7 @@ export class DocumaticPreviewPanel { /** * Set the static html for the webview. */ - private setWebviewHtml(webviewFolderUri: vscode.Uri) { + private setWebviewHtml() { // Set the webview's html this._panel.webview.html = ` @@ -122,12 +119,20 @@ export class DocumaticPreviewPanel { - + -

+