Skip to content

Commit f15f84b

Browse files
authored
Ensure CompletionsResponse contains targets (microsoft#362)
If a client sent a completion request without a frameId then the server returned a completion response without targets. According to the specification the response of a completions request must always contain a `targets` property. It is not optional. See https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Completions
1 parent 7943067 commit f15f84b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/CompletionsHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
package com.microsoft.java.debug.core.adapter.handler;
1313

14-
import java.util.ArrayList;
1514
import java.util.Arrays;
15+
import java.util.Collections;
1616
import java.util.List;
1717
import java.util.concurrent.CompletableFuture;
1818

@@ -46,7 +46,7 @@ public CompletableFuture<Response> handle(Command command, Arguments arguments,
4646
// completions should be illegal when frameId is zero, it is sent when the program is running, while during running we cannot resolve
4747
// the completion candidates
4848
if (completionsArgs.frameId == 0) {
49-
response.body = new ArrayList<>();
49+
response.body = new Responses.CompletionsResponseBody(Collections.emptyList());
5050
return CompletableFuture.completedFuture(response);
5151
}
5252

0 commit comments

Comments
 (0)