Navigation
Synopsis Allows a list of proposals to be filtered based on a given prefix string.
Function list[CompletionProposal] filterPrefix(list[CompletionProposal] proposals, str prefix)
Usage import util::ContentCompletion;
Description Allows a list of proposals to be filtered based on a given prefix string. A list of proposals will be returned that contain the prefix string anywhere in the proposals' newText property. If the prefix string is empty, the complete list will be returned as-is.
Examples
rascal>import util::ContentCompletion;
ok
rascal>list[CompletionProposal] proposals = [sourceProposal("apple"), sourceProposal("pineapple"), sourceProposal("banana")];
list[CompletionProposal]: [
  sourceProposal("apple"),
  sourceProposal("pineapple"),
  sourceProposal("banana")
]
rascal>filterPrefix(proposals, "apple");
list[CompletionProposal]: [
  sourceProposal("apple"),
  sourceProposal("pineapple")
]
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.