From c441505506af24f5ce85d5c19752bbfca01c6543 Mon Sep 17 00:00:00 2001 From: Christopher Date: Sun, 18 Jun 2023 17:09:15 -0400 Subject: [PATCH] fix(format-queries): Now the question is displayed atop the files and the file contents are formatted to display the contents of the files. --- extension.js | 130 +++++++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 57 deletions(-) diff --git a/extension.js b/extension.js index e87ad09..0382d94 100644 --- a/extension.js +++ b/extension.js @@ -133,71 +133,87 @@ const refreshFilesCommand = vscode.commands.registerCommand('extension.refreshFi // Helper function to generate the HTML content for the webview panel function getWebviewContent(fileContents, question) { - const fileList = selectedFiles - .map( - file => - `
${file.uri.fsPath}
` - ) - .join(''); + const fileList = selectedFiles + .map( + file => + `
${file.uri.fsPath}
` + ) + .join(''); - return ` - - -

GPT Context

-
- - - - - -
- ${ - fileContents ? `
${fileContents}
` : '' - } -
-

Selected Files:

- ${fileList} -
-
${question ? question : ''}
- - - - `; + function refreshSelectedFiles() { + vscode.postMessage({ + command: 'refreshFiles' + }); + } + + const form = document.getElementById('questionForm'); + form.addEventListener('submit', event => { + event.preventDefault(); + const question = document.getElementById('question').value; + vscode.postMessage({ + command: 'submitQuestion', + text: question + }); + }); + + + + `; } + // Activates the extension function activate(context) { // Register the file data provider