Java Code Examples for com.intellij.psi.codeStyle.NameUtil#nameToWords()
The following examples show how to use
com.intellij.psi.codeStyle.NameUtil#nameToWords() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CSharpCompletionSorting.java From consulo-csharp with Apache License 2.0 | 6 votes |
private static int calcMatch(final String expectedName, final List<String> words, int max) { if(expectedName == null) { return max; } String[] expectedWords = NameUtil.nameToWords(expectedName); int limit = Math.min(words.size(), expectedWords.length); for(int i = 0; i < limit; i++) { String word = words.get(words.size() - i - 1); String expectedWord = expectedWords[expectedWords.length - i - 1]; if(word.equalsIgnoreCase(expectedWord)) { max = Math.max(max, i + 1); } else { break; } } return max; }
Example 2
Source File: CapitalizeAndUnderscoreMacro.java From consulo with Apache License 2.0 | 6 votes |
@Override protected Result calculateResult(@Nonnull Expression[] params, ExpressionContext context, boolean quick) { String text = getTextResult(params, context, true); if (text != null && text.length() > 0) { final String[] words = NameUtil.nameToWords(text); boolean insertUnderscore = false; final StringBuffer buf = new StringBuffer(); for (String word : words) { if (insertUnderscore) { buf.append("_"); } else { insertUnderscore = true; } buf.append(StringUtil.toUpperCase(word)); } return new TextResult(buf.toString()); } return null; }
Example 3
Source File: CSharpCompletionSorting.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override @RequiredReadAction public Comparable weigh(@Nonnull LookupElement element) { final String name = getName(element); if(name != null && getNameEndMatchingDegree(name, myExpectedTypes) != 0) { return NameUtil.nameToWords(name).length - 1000; } return 0; }