IDEA-89061 Prefix match should be preferred over middle match when suggesting variable names

This commit is contained in:
peter
2012-07-20 11:07:12 +02:00
parent ebac476f2b
commit 9174f21059
4 changed files with 136 additions and 106 deletions
@@ -0,0 +1,11 @@
import java.util.*;
class BarGoo {}
class Foo {
{
Map<BarGoo, StringBuilder> goos;
<caret>
}
}
@@ -167,6 +167,16 @@ public class LiveTemplateTest extends LightCodeInsightFixtureTestCase {
checkResult();
}
public void testPreferStartMatchesInLookups() throws Throwable {
configure();
startTemplate("iter", "iterations")
myFixture.type('ese\n') //for entrySet
assert myFixture.lookupElementStrings == ['barGooStringBuilderEntry', 'gooStringBuilderEntry', 'stringBuilderEntry', 'builderEntry', 'entry']
myFixture.type('e')
assert myFixture.lookupElementStrings == ['entry', 'barGooStringBuilderEntry', 'gooStringBuilderEntry', 'stringBuilderEntry', 'builderEntry']
assert LookupManager.getActiveLookup(editor).currentItem.lookupString == 'entry'
}
private TemplateState getState() {
TemplateManagerImpl.getTemplateState(getEditor())
}