Skip to content

Commit 8aa70b8

Browse files
Avoid adding empty edits; only add the text edit if it is not null.
1 parent 582d5c8 commit 8aa70b8

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediatorService/AIConnectorHandler.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ private TextEdit ensureMcpConnectionExists(DOMDocument document, DOMNode agentNo
11561156

11571157
if (mcpConnectionsNode != null) {
11581158
if (hasMCPConnection(mcpConnectionsNode, connectionName)) {
1159-
return emptyEdit(documentUri);
1159+
return null;
11601160
}
11611161
return insertMCPConnection(document, mcpConnectionsNode, connectionName, documentUri);
11621162
}
@@ -1193,13 +1193,6 @@ private TextEdit insertNewMCPConnectionsBlock(DOMDocument document, DOMNode agen
11931193
return new DocumentTextEdit(insertRange, renderMcpConnectionsBlock(List.of(keyXml)), documentUri);
11941194
}
11951195

1196-
private TextEdit emptyEdit(String documentUri) {
1197-
1198-
Position pos = new Position(0, 0);
1199-
Range emptyRange = new Range(pos, pos);
1200-
return new DocumentTextEdit(emptyRange, "", documentUri);
1201-
}
1202-
12031196
private boolean hasMCPConnection(DOMNode mcpConnectionsNode, String connectionName) {
12041197

12051198
for (DOMNode child : mcpConnectionsNode.getChildren()) {

org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/customservice/synapse/mediatorService/pojo/SynapseConfigResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ public List<TextEdit> getTextEdits() {
4242

4343
public void addTextEdit(TextEdit edit) {
4444

45-
textEdits.add(edit);
45+
if (edit != null) {
46+
textEdits.add(edit);
47+
}
4648
}
4749

4850
public void sort() {

0 commit comments

Comments
 (0)