Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unfiltered types don't show up in completion #108

Open
2 tasks done
mickaelistria opened this issue Nov 14, 2023 · 2 comments
Open
2 tasks done

Unfiltered types don't show up in completion #108

mickaelistria opened this issue Nov 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mickaelistria
Copy link
Collaborator

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

Steps to reproduce

From a fresh installation and clean workspace:

  • create a basic Java project
  • in build path, make it modular, and edit the modular settings in the Details tab so it adds for example --add-exports jdk.compiler/com.sun.source.tree
  • In Preferences > Java > Appearance > Type Filters; make sure com.sun.* is not filtered (uncheck it)
  • Add somewhere in file com.sun.source.tree.CompilationUnitTr
  • Try to complete it in JDT editor, CompilationUnitTree is suggested
  • Open in generic editor with JDT-LS working

I tried

  • completion

I expected: CompilationUnitTree

But got: nothing

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

Tested under this environment:

  • OS & version: Fedora 38
  • Eclipse IDE/Platform version: Latest I-Build
  • ...

Community

  • I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
@mickaelistria mickaelistria added the bug Something isn't working label Nov 14, 2023
@mickaelistria
Copy link
Collaborator Author

@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
Copy link

snjeza commented Nov 14, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants