We should create a module that can take a predicate such as:
predicate problems(Element e, string msg, Placeholder p, string pString) {
e.meetsSomeCondition() and
p.meesSomeOtherCondition() and
e.isSomehowRelatedTo(p) and
msg = e.toString() + " is related to $@ somehow." and
pString = p.toString()
}
and produce results like "foo is related to bar", "baz is related to qux and baar", "lorem is related to ipsum, dolor, and sit", "lorem2 is related to ipsum, dolor, sit, and 80 more."
To do this, we'll have to essentially create the following:
module PlaceholderList<predicate problemInput> {
query predicate problems(Element e, string msg, Placeholder p1, string p1Str, Placeholder p2, string p2Str, Placeholder3, p3str, ...) {
/**
* When problemInput(e, m, p, ps) has one result for e, this should select [e, m, p, s, e, "", e, "", e, "" ....]
*
* When problemInput(e, m, p, ps) has two results p for e, then msg should be m.replace("$@", "$@ and $@") and
*. this should select [e, msg, p1, ps1, p2, ps2, e, "", e, "", ....]
*
* And this continues up to some maximum number of selections.
*/
}
}
Perhaps look at the QlFormat for inspiration, especially for empty placeholders though note that QlFormat is a much heavier solution than we want here. Additionally, consider looking at Qtil::Ordered.
Consider a signature module to support some additional configuration:
module MyConfig implements SomeConfigSig {
predicate problems(...) { ... }
int maxResults() { result = 3 }
string orderBy(Placeholder p) { ... }
}
import PloceholderList<MyConfig>
These helpers sech as maxResults, orderBy, can have "default" predicate implementations, e.g. default int maxResults() { ... }
We should create a module that can take a predicate such as:
and produce results like "foo is related to bar", "baz is related to qux and baar", "lorem is related to ipsum, dolor, and sit", "lorem2 is related to ipsum, dolor, sit, and 80 more."
To do this, we'll have to essentially create the following:
Perhaps look at the QlFormat for inspiration, especially for empty placeholders though note that QlFormat is a much heavier solution than we want here. Additionally, consider looking at
Qtil::Ordered.Consider a signature module to support some additional configuration:
These helpers sech as
maxResults,orderBy, can have "default" predicate implementations, e.g.default int maxResults() { ... }