jtulach commented on code in PR #9851:
URL: https://github.com/apache/netbeans/pull/9851#discussion_r4796256025
##########
java/java.lsp.server/test/unit/src/org/netbeans/modules/java/lsp/server/protocol/ServerTest.java:
##########
@@ -1445,6 +1446,78 @@ public void logMessage(MessageParams arg0) {
"\n");
}
+ /**
+ * A plain LSP client, not the NetBeans VS Code extension, sends
initialization
+ * options without the {@code nbcodeCapabilities} element. The server must
+ * initialize with the default NetBeans capabilities, report indexing
through
+ * the standard window/showMessage (no status bar message support) and
answer
+ * requests as usual.
+ */
+ public void testInitializeWithoutNbCodeCapabilities() throws Exception {
+ File src = new File(getWorkDir(), "Test.java");
+ src.getParentFile().mkdirs();
+ String code = """
+ /**
+ * Plain client Javadoc.
+ */
+ public class Test {
+ public static void main(String[] args) {
+ Test t = new Test();
+ }
+ }
+ """;
+ try (Writer w = new FileWriter(src)) {
+ w.write(code);
+ }
+ FileUtil.refreshFor(getWorkDir());
+ CountDownLatch indexingComplete = new CountDownLatch(1);
+ List<MessageParams> shownMessages = Collections.synchronizedList(new
ArrayList<>());
+ Launcher<LanguageServer> serverLauncher =
createClientLauncherWithLogging(new LspClient() {
+ @Override
+ public void showMessage(MessageParams params) {
+ shownMessages.add(params);
+ if (Server.INDEXING_COMPLETED.equals(params.getMessage())) {
+ indexingComplete.countDown();
+ }
+ }
+ }, client.getInputStream(), client.getOutputStream());
+ serverLauncher.startListening();
+ LanguageServer server = serverLauncher.getRemoteProxy();
+ InitializeParams initParams = new InitializeParams();
+ // options as another editor's client would send them: no
nbcodeCapabilities
+ initParams.setInitializationOptions(new JsonParser().parse(
Review Comment:
Addressed in 632023181b
--
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