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(),
|
return new Proposal(v, newQuery.toString(), false, newQuery.toString(),
|
||||||
start + v.length() + 1);
|
start + v.length() + 1);
|
||||||
}).map(p -> {
|
}).map(p -> {
|
||||||
|
int count = 0;
|
||||||
final int count = dataStore.count(p.getProposedQuery());
|
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);
|
return new Proposal(p, count > 0);
|
||||||
}).forEach(proposals::add);
|
}).forEach(proposals::add);
|
||||||
|
|
||||||
@@ -131,14 +137,16 @@ public class QueryCompletionPdbLangParser extends PdbLangParser {
|
|||||||
final int newCaretPosition = newQueryWithMarker.indexOf(CARET_MARKER);
|
final int newCaretPosition = newQueryWithMarker.indexOf(CARET_MARKER);
|
||||||
final String newQuery = newQueryWithMarker.replace(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);
|
newCaretPosition);
|
||||||
}).map(p -> {
|
})
|
||||||
|
// .map(p -> {
|
||||||
final String proposedQuery = p.getProposedQuery();
|
//
|
||||||
final int count = count(proposedQuery);
|
// final String proposedQuery = p.getProposedQuery();
|
||||||
return new Proposal(p, count > 0);
|
// final int count = count(proposedQuery);
|
||||||
}).forEach(proposals::add);
|
// return new Proposal(p, count > 0);
|
||||||
|
// })
|
||||||
|
.forEach(proposals::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int count(final String proposedQuery) {
|
private int count(final String proposedQuery) {
|
||||||
|
|||||||
Reference in New Issue
Block a user