Skip to content

Commit 9b1052b

Browse files
committed
Changes to properties in yaml format from AI response
1 parent 084d3a9 commit 9b1052b

20 files changed

+260
-81
lines changed

headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/ORDocUtils.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,20 @@ public static Optional<WorkspaceEdit> createWorkspaceEdit(SimpleTextDocumentServ
160160
}
161161
WorkspaceEdit we = new WorkspaceEdit();
162162
we.setDocumentChanges(new ArrayList<>());
163+
addToWorkspaceEdit(documents, results, changeAnnotationId, we);
164+
return Optional.of(we);
165+
}
166+
167+
public static void addToWorkspaceEdit(SimpleTextDocumentService documents, List<Result> results, String changeAnnotationId, WorkspaceEdit we) {
163168
for (Result result : results) {
164169
String docUri = result.getBefore() == null ? result.getAfter().getSourcePath().toUri().toASCIIString() : result.getBefore().getSourcePath().toUri().toASCIIString();
165170
String oldContent = result.getBefore() == null ? null : result.getBefore().printAll();
166171
String newContent = result.getAfter() == null ? null : result.getAfter().printAll();
167-
createWorkspaceEdit(documents, docUri, oldContent, newContent, changeAnnotationId, we);
172+
addToWorkspaceEdit(documents, docUri, oldContent, newContent, changeAnnotationId, we);
168173
}
169-
return Optional.of(we);
170174
}
171175

172-
public static void createWorkspaceEdit(SimpleTextDocumentService documents, String docUri, String oldContent, String newContent, String changeAnnotationId, WorkspaceEdit we) {
176+
public static void addToWorkspaceEdit(SimpleTextDocumentService documents, String docUri, String oldContent, String newContent, String changeAnnotationId, WorkspaceEdit we) {
173177
if(oldContent == null) {
174178
createNewFileEdit(docUri, newContent, changeAnnotationId, we);
175179
} else if (newContent == null) {

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/AbstractInjectMavenActionHandler.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.io.BufferedWriter;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/CopilotAgentCommandHandler.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
*******************************************************************************/
1111
package org.springframework.ide.vscode.boot.java.copilot;
1212

13-
import java.io.IOException;
14-
import java.nio.file.Paths;
1513
import java.util.List;
1614
import java.util.UUID;
1715
import java.util.concurrent.CompletableFuture;
@@ -61,7 +59,7 @@ private void registerCommands() {
6159
return CompletableFuture.supplyAsync(() -> {
6260
try {
6361
return createLspEdits(params);
64-
} catch (IOException e) {
62+
} catch (Exception e) {
6563
throw new CompletionException(e);
6664
}
6765
}).thenCompose(we -> {
@@ -86,15 +84,15 @@ private CompletableFuture<Object> enhanceResponseHandler(ExecuteCommandParams pa
8684
return CompletableFuture.completedFuture(modifiedResp);
8785
}
8886

89-
private WorkspaceEdit createLspEdits(ExecuteCommandParams params) throws IOException {
87+
private WorkspaceEdit createLspEdits(ExecuteCommandParams params) throws Exception {
9088
log.info("Command Handler for lsp edits: ");
9189
String docURI = ((JsonElement) params.getArguments().get(0)).getAsString();
9290
String content = ((JsonElement) params.getArguments().get(1)).getAsString();
9391

9492
IJavaProject project = this.projectFinder.find(new TextDocumentIdentifier(docURI)).get();
9593
List<ProjectArtifact> projectArtifacts = computeProjectArtifacts(content);
9694
ProjectArtifactEditGenerator editGenerator = new ProjectArtifactEditGenerator(server.getTextDocumentService(),
97-
projectArtifacts, Paths.get(project.getLocationUri()), docURI);
95+
projectArtifacts, project, docURI);
9896
return editGenerator.process().getResult();
9997
}
10098

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/InjectMavenActionHandler.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.nio.file.Path;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/InjectMavenBuildPlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.Objects;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/InjectMavenDependencyManagement.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.Objects;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/InjectMavenRepository.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.Objects;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/MarkdownResponseVisitor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.ArrayList;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/ProcessArtifactResult.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.ArrayList;

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/copilot/ProjectArtifact.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2024 Broadcom, Inc.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* https://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Broadcom, Inc. - initial API and implementation
10+
*******************************************************************************/
111
package org.springframework.ide.vscode.boot.java.copilot;
212

313
import java.util.Objects;

0 commit comments

Comments
 (0)