Skip to content

Commit

Permalink
Improve regex expression
Browse files Browse the repository at this point in the history
Fixes bndtools#5281

Signed-off-by: BJ Hargrave <bj@hargrave.dev>
  • Loading branch information
bjhargrave committed Jun 14, 2022
1 parent 017248d commit 6e2f7d8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

public class BndCompletionProcessor implements IContentAssistProcessor {

private static final Pattern PREFIX_PATTERN = Pattern.compile("^(?:.*\\s)*(.*)$");
private static final Pattern PREFIX_PATTERN = Pattern.compile("(\\S+)$");

@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
try {
String pre = viewer.getDocument()
.get(0, offset);
Matcher matcher = PREFIX_PATTERN.matcher(pre);
if (matcher.matches()) {
if (matcher.find()) {
String prefix = matcher.group(1);
ICompletionProposal[] found = proposals(prefix, offset);
if (found.length == 1) {
Expand Down

0 comments on commit 6e2f7d8

Please sign in to comment.