Skip to content

Commit

Permalink
🐛 Fix matching USE_LOGICAL_OPERATOR_SCENE
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmai-dev committed Jul 22, 2023
1 parent 0bab2d5 commit d6d39a0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## [Unreleased]

## [1.2.1] - 2023-07-19
## [1.2.1] - 2023-07-22

### Added

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void addCompletions(@NotNull CompletionParameters parameters, @NotNull

result = result.withPrefixMatcher(prefix);

if (StringUtils.containsAnyIgnoreCase(previous, Types.USE_LOGICAL_OPERATOR_SCENE.toArray(new CharSequence[]{}))) {
if (Strings.endsWithIgnoreCaseAny(previous, Types.USE_LOGICAL_OPERATOR_SCENE.toArray(new CharSequence[]{}))) {
for (String s : Types.LOGICAL_OPERATOR_EXPR) {
if (StringUtils.containsIgnoreCase(s, prefix)) {
result.addElement(LookupElementBuilder
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.github.maiqingqiang.goormhelper.utils;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

public class Strings {
Expand Down Expand Up @@ -66,4 +69,14 @@ public static String clearSingleQuotn(String s) {
return s;
}

public static boolean endsWithIgnoreCaseAny(CharSequence sequence, CharSequence... searchStrings) {
if (!StringUtils.isEmpty(sequence) && !ArrayUtils.isEmpty(searchStrings)) {
for (CharSequence searchString : searchStrings) {
if (StringUtils.endsWithIgnoreCase(sequence, searchString)) {
return true;
}
}
}
return false;
}
}

0 comments on commit d6d39a0

Please sign in to comment.