diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b9113..286e54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ## [Unreleased] -## [1.2.1] - 2023-07-19 +## [1.2.1] - 2023-07-22 ### Added diff --git a/src/main/java/com/github/maiqingqiang/goormhelper/orm/ORMCompletionProvider.java b/src/main/java/com/github/maiqingqiang/goormhelper/orm/ORMCompletionProvider.java index 19f9e89..669f2b7 100644 --- a/src/main/java/com/github/maiqingqiang/goormhelper/orm/ORMCompletionProvider.java +++ b/src/main/java/com/github/maiqingqiang/goormhelper/orm/ORMCompletionProvider.java @@ -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 diff --git a/src/main/java/com/github/maiqingqiang/goormhelper/utils/Strings.java b/src/main/java/com/github/maiqingqiang/goormhelper/utils/Strings.java index 7cad84a..3480441 100644 --- a/src/main/java/com/github/maiqingqiang/goormhelper/utils/Strings.java +++ b/src/main/java/com/github/maiqingqiang/goormhelper/utils/Strings.java @@ -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 { @@ -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; + } }