mbien commented on code in PR #4142:
URL: https://github.com/apache/netbeans/pull/4142#discussion_r893730882


##########
java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java:
##########
@@ -3228,7 +3228,12 @@ public CompletableFuture<ApplyWorkspaceEditResponse> 
applyEdit(ApplyWorkspaceEdi
 
             @Override
             public CompletableFuture<List<QuickPickItem>> 
showQuickPick(ShowQuickPickParams params) {
-                return 
CompletableFuture.completedFuture(params.getItems().size() > 2 ? 
params.getItems().subList(0, 2) : params.getItems());
+                List<QuickPickItem> selection = params.getItems().stream()
+                        .filter((i) -> i.getLabel().equals("f1.chars(): 
IntStream") || i.getLabel().equals("f1.codePoints(): IntStream"))
+                        .sorted((i1, i2) -> 
i1.getLabel().compareTo(i2.getLabel()))
+                        .collect(Collectors.toList());
+                assertEquals(2, selection.size());
+                return CompletableFuture.completedFuture(selection);

Review Comment:
   I don't think `List` strongly implies ordered (the non-javac 
`ElementUtilities` returns Iterable btw).
   
   We have to figure out what order it is supposed to be and then write it down 
in the doc so that nobody has to guess again :)
   
   Further if we decide that the order is important, we have to add a test for 
this. Its not good that one single high level test which is completely 
unrelated to the given utility methods fails, everything else is green - 
including a working IDE.
   
   If we decide that the order is not important, either the test has to be 
fixed as proposed here, or the LSP code has to sort things somewhere to make 
the test work.
   
   would be good to have input from @jlahoda for this but I completely 
understand if he can't since he is busy with language JEPs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to