redhat-developer / eclipseide-jdtls

A language server client for Eclipse using JDT-LS
MIT License
11 stars 5 forks source link

Unfiltered types don't show up in completion #108

Open mickaelistria opened 12 months ago

mickaelistria commented 12 months ago

Let's make sure issue is not already fixed in snapshots first.

Steps to reproduce

From a fresh installation and clean workspace:

I tried

I expected: CompilationUnitTree

But got: nothing

Here is some relevant log output form (<workspace>/.metadata/.log)

Tested under this environment:

Community

mickaelistria commented 12 months ago

@snjeza is there a way to configure JDT-LS to unfilter some types? Could we add a listener to JDT-UI prefs and send the right didChangeConfiguraiton ?

snjeza commented 12 months ago

@mickaelistria Java LS uses the java.completion.filteredTypes property. You can check the following patch

diff --git a/com.redhat.eclipseide.jdtlsclient/src/com/redhat/eclipseide/jdtlsclient/InProcessJDTLSConnectionProvider.java b/com.redhat.eclipseide.jdtlsclient/src/com/redhat/eclipseide/jdtlsclient/InProcessJDTLSConnectionProvider.java
index 3af627d..03dbe36 100644
--- a/com.redhat.eclipseide.jdtlsclient/src/com/redhat/eclipseide/jdtlsclient/InProcessJDTLSConnectionProvider.java
+++ b/com.redhat.eclipseide.jdtlsclient/src/com/redhat/eclipseide/jdtlsclient/InProcessJDTLSConnectionProvider.java
@@ -59,7 +59,7 @@ public class InProcessJDTLSConnectionProvider implements StreamConnectionProvide
        clientInputStream = Channels.newInputStream(serverOutputToClientInput.source());
        clientOutputStream = Channels.newOutputStream(clientOutputToServerInput.sink());
        listener = launcher.startListening();
-       server.connectClient((JavaLanguageClient)launcher.getRemoteProxy());
+       server.connectClient(launcher.getRemoteProxy());

        // Store the output streams so we can close them to clean up. The corresponding input
        // streams should automatically receive an EOF and close.
@@ -107,7 +107,9 @@ public class InProcessJDTLSConnectionProvider implements StreamConnectionProvide
                            "implementationsCodeLens", Map.of( //
                                "enabled", false), //
                            "referencesCodeLens", Map.of( //
-                               "enabled", false))),
+                               "enabled", false),
+                           "completion", Map.of( //
+                               "filteredTypes", List.of("java.awt.*")))),
                    "extendedClientCapabilities", Map.of(
                        "classFileContentsSupport", true, //
                        // We want JDT-LS to keep the IDocument intact on change, as they're