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

🐛 handle when a default search will have invalid query #105

Merged
Merged
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 @@ -7,7 +7,6 @@
import java.util.List;
import java.util.regex.Pattern;

import io.konveyor.tackle.core.internal.query.AnnotationQuery;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
Expand All @@ -26,6 +25,8 @@
import org.eclipse.jdt.ls.core.internal.ResourceUtils;
import org.eclipse.lsp4j.SymbolInformation;

import io.konveyor.tackle.core.internal.query.AnnotationQuery;

public class SampleDelegateCommandHandler implements IDelegateCommandHandler {

public static final String COMMAND_ID = "io.konveyor.tackle.samplecommand";
Expand Down Expand Up @@ -96,15 +97,25 @@ private static SearchPattern mapLocationToSearchPatternLocation(int location, St
}

if (location == 0) {
logInfo("default query passed, searching everything");
logInfo("default query passed " + query + ", searching everything");
ArrayList<SearchPattern> l = new ArrayList<SearchPattern>();
// Searching for Type, Method, and Constructor's.
l.add(getPatternSingleQuery(10, query));
l.add(getPatternSingleQuery(2, query));
l.add(getPatternSingleQuery(3, query));

var p = getPatternSingleQuery(10, query);
if (p != null) {
l.add(p);
}
p = getPatternSingleQuery(2, query);
if (p != null) {
l.add(p);
}
p = getPatternSingleQuery(3, query);
if (p != null) {
l.add(p);
}
logInfo("list of p: " + p);

// Get the end pattern
SearchPattern p = l.subList(1, l.size()).stream().reduce(l.get(0), (SearchPattern::createOrPattern));
p = l.subList(1, l.size()).stream().reduce(l.get(0), (SearchPattern::createOrPattern));
return p;
}

Expand Down
Loading