Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public final class CompletionProposalRequestor extends CompletionRequestor {
CompletionItemKind.Text);
// @formatter:on

private static boolean isFilterFailed = false;

/**
* Constructor.
* @param typeRoot ITypeRoot
Expand Down Expand Up @@ -321,7 +323,7 @@ private boolean isFiltered(CompletionProposal proposal) {
case CompletionProposal.JAVADOC_TYPE_REF:
case CompletionProposal.TYPE_REF: {
char[] declaringType = getDeclaringType(proposal);
return declaringType != null && org.eclipse.jdt.ls.core.internal.contentassist.TypeFilter.isFiltered(declaringType);
return declaringType != null && isFiltered(declaringType);
}
default: // do nothing
}
Expand All @@ -332,6 +334,22 @@ private boolean isFiltered(CompletionProposal proposal) {
return false;
}

// Temp workaround for the completion error https://github.com/microsoft/java-debug/issues/534
private static boolean isFiltered(char[] fullTypeName) {
if (isFilterFailed) {
return false;
}

try {
return JavaLanguageServerPlugin.getInstance().getTypeFilter().filter(new String(fullTypeName));
} catch (NoSuchMethodError ex) {
isFilterFailed = true;
JavaLanguageServerPlugin.logException("isFiltered for the completion failed.", ex);
}

return false;
}

/**
* copied from
* org.eclipse.jdt.ui.text.java.CompletionProposalCollector.getDeclaringType(CompletionProposal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
<unit id="org.eclipse.equinox.p2.core.feature.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jdt.source.feature.group" version="0.0.0"/>
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.jdt.apt.pluggable.core" version="0.0.0"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.31-I-builds/I20240130-1800/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2023-12/"/>
</location>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<properties>
<base.name>Java Debug Server for Visual Studio Code</base.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>4.0.3</tycho-version>
<tycho-version>4.0.5</tycho-version>
<checkstyleDir>${basedir}</checkstyleDir>
</properties>

Expand Down