Slight refactorings and remove maven-model dependency (#1365)

* trying to allow manual trigger for publishing vscode pre-releases

* remove usage of proposed chat variable resolver api for now

* remove maven-model dependency and clean up code

---------

Co-authored-by: Martin Lippert <martin.lippert@broadcom.com>
This commit is contained in:
Udayani Vaka
2024-10-03 17:53:10 +05:30
committed by GitHub
parent cd18390a45
commit 4e7e551eec
10 changed files with 13 additions and 110 deletions

View File

@@ -21,7 +21,7 @@ export async function applyLspEdit(uri: Uri) {
}, async (progress, cancellation) => {
progress.report({ message: "applying edits..." });
const fileContent = (await readResponseFromFile(uri)).toString();
const lspEdit = await commands.executeCommand("sts/copilot/agent/lspEdits", uri.toString(), path.dirname(uri.fsPath), fileContent);
const lspEdit = await commands.executeCommand("sts/copilot/agent/lspEdits", uri.toString(), fileContent);
const workspaceEdit = await CONVERTER.asWorkspaceEdit(lspEdit);

View File

@@ -65,23 +65,21 @@ export default class SpringBootChatAgent {
// Chat request to copilot LLM
const response = await this.copilotRequest.chatRequest(messages, {}, cancellationToken);
// write the response to markdown file
const targetMarkdownUri = await writeResponseToFile(response, bootProjInfo.name, selectedProject.fsPath);
let documentContent;
if (!targetMarkdownUri) {
documentContent = 'Note: The code provided is just an example and may not be suitable for production use. \n ' + response;
if (response == null || response === '') {
documentContent = 'Failed to process the request. Please try again.';
} else {
// modify the response from copilot LLM i.e. make response Boot 3 compliant if necessary
if (bootProjInfo.springBootVersion.startsWith('3')) {
const enhancedResponse = await commands.executeCommand("sts/copilot/agent/enhanceResponse", response) as string;
await writeResponseToFile(enhancedResponse, bootProjInfo.name, selectedProject.fsPath);
documentContent = await commands.executeCommand("sts/copilot/agent/enhanceResponse", response) as string;
} else {
documentContent = 'Note: The code provided is just an example and may not be suitable for production use. \n ' + response;
}
documentContent = await workspace.fs.readFile(targetMarkdownUri);
}
// write the final response to markdown file
await writeResponseToFile(documentContent, bootProjInfo.name, selectedProject.fsPath);
const chatResponse = Buffer.from(documentContent).toString();
stream.markdown(chatResponse);
stream.button({

View File

@@ -30,9 +30,6 @@
"activationEvents": [
"onCommand:vscode-spring-boot.ls.start"
],
"enabledApiProposals": [
"chatVariableResolver"
],
"contributes": {
"chatParticipants": [
{