本文整理汇总了Java中com.intellij.codeInsight.completion.PrefixMatcher.cloneWithPrefix方法的典型用法代码示例。如果您正苦于以下问题:Java PrefixMatcher.cloneWithPrefix方法的具体用法?Java PrefixMatcher.cloneWithPrefix怎么用?Java PrefixMatcher.cloneWithPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.completion.PrefixMatcher
的用法示例。
在下文中一共展示了PrefixMatcher.cloneWithPrefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: completeTillTypedCharOccurrence
import com.intellij.codeInsight.completion.PrefixMatcher; //导入方法依赖的package包/类
private static boolean completeTillTypedCharOccurrence(char charTyped, LookupImpl lookup, LookupElement item) {
PrefixMatcher matcher = lookup.itemMatcher(item);
final String oldPrefix = matcher.getPrefix() + lookup.getAdditionalPrefix();
PrefixMatcher expanded = matcher.cloneWithPrefix(oldPrefix + charTyped);
if (expanded.prefixMatches(item)) {
for (String s : item.getAllLookupStrings()) {
if (matcher.prefixMatches(s)) {
int i = -1;
while (true) {
i = s.indexOf(charTyped, i + 1);
if (i < 0) break;
final String newPrefix = s.substring(0, i + 1);
if (expanded.prefixMatches(newPrefix)) {
lookup.replacePrefix(oldPrefix, newPrefix);
return true;
}
}
}
}
}
return false;
}
示例2: prefixMatches
import com.intellij.codeInsight.completion.PrefixMatcher; //导入方法依赖的package包/类
private boolean prefixMatches(LookupImpl lookup, LookupElement item) {
PrefixMatcher matcher = lookup.itemMatcherNullable(item);
if (matcher == null) {
return false;
}
if (!myAdditionalPrefix.isEmpty()) {
matcher = matcher.cloneWithPrefix(matcher.getPrefix() + myAdditionalPrefix);
}
return matcher.prefixMatches(item);
}
示例3: prefixMatches
import com.intellij.codeInsight.completion.PrefixMatcher; //导入方法依赖的package包/类
private boolean prefixMatches(LookupElement item) {
PrefixMatcher matcher = itemMatcher(item);
if (!myAdditionalPrefix.isEmpty()) {
matcher = matcher.cloneWithPrefix(matcher.getPrefix() + myAdditionalPrefix);
}
return matcher.prefixMatches(item);
}