do not check if we can find values when proposing keys
Counting the available values is quite expensive and there are only a few corner cases where this makes sense. One of them is when the query is for a method that is not project specific and therefore no project values can be found.
This commit is contained in:
@@ -69,8 +69,14 @@ public class QueryCompletionPdbLangParser extends PdbLangParser {
|
||||
return new Proposal(v, newQuery.toString(), false, newQuery.toString(),
|
||||
start + v.length() + 1);
|
||||
}).map(p -> {
|
||||
|
||||
final int count = dataStore.count(p.getProposedQuery());
|
||||
int count = 0;
|
||||
try {
|
||||
count = dataStore.count(p.getProposedQuery());
|
||||
}
|
||||
catch(SyntaxException e)
|
||||
{
|
||||
// ignore: if the query is not valid, then it does not find any results
|
||||
}
|
||||
return new Proposal(p, count > 0);
|
||||
}).forEach(proposals::add);
|
||||
|
||||
@@ -131,14 +137,16 @@ public class QueryCompletionPdbLangParser extends PdbLangParser {
|
||||
final int newCaretPosition = newQueryWithMarker.indexOf(CARET_MARKER);
|
||||
final String newQuery = newQueryWithMarker.replace(CARET_MARKER, "");
|
||||
|
||||
return new Proposal(key, String.format(newQueryPattern, key + "=* "), false, newQuery,
|
||||
return new Proposal(key, String.format(newQueryPattern, key + "=* "), true, newQuery,
|
||||
newCaretPosition);
|
||||
}).map(p -> {
|
||||
|
||||
final String proposedQuery = p.getProposedQuery();
|
||||
final int count = count(proposedQuery);
|
||||
return new Proposal(p, count > 0);
|
||||
}).forEach(proposals::add);
|
||||
})
|
||||
// .map(p -> {
|
||||
//
|
||||
// final String proposedQuery = p.getProposedQuery();
|
||||
// final int count = count(proposedQuery);
|
||||
// return new Proposal(p, count > 0);
|
||||
// })
|
||||
.forEach(proposals::add);
|
||||
}
|
||||
|
||||
private int count(final String proposedQuery) {
|
||||
|
||||
Reference in New Issue
Block a user