Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Implemented #85 - case-insensitive autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Dec 12, 2014
1 parent 5d49c8c commit 7043d9d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions documentation/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### DDT 0.10.4
* Fixed #88: Semantic operations (code complete, etc.) involving DUB packages with subpackages would always cause the `dub describe` to run and thus incur a significant unnecessary slowdown.
* Fixed: added loop detection for all known loop scenarios during semantic engine analysis.
* Implemented #85: Support case-insensitive autocompletion.


### DDT 0.10.3
* Added build console preference page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public CompletionScopeLookup(IModuleElement refOriginModule, int refOffset, ISem

@Override
public boolean matchesName(String defName) {
return defName.startsWith(searchOptions.searchPrefix);
if(searchOptions.searchPrefix.length() > defName.length()) {
return false;
}
String defNamePrefix = defName.substring(0, searchOptions.searchPrefix.length());
return defNamePrefix.equalsIgnoreCase(searchOptions.searchPrefix);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ protected CompletionSearchResult doOperation(Path filePath, int offset) throws E
concat(PRIMITIVE_TYPES, COMPLETION_TEST_MEMBERS)
);


// Boundary condition, offset = 0 && offset = length
testFindDefinition(MODULE_FilePath, 0, 0,
concat(PRIMITIVE_TYPES, COMPLETION_TEST_MEMBERS)
Expand Down Expand Up @@ -147,4 +148,18 @@ protected void testFindDefinition(Path modulePath, int offset,
checker.checkResults(expectedResults);
}


@Test
public void testNameMatching() throws Exception { testNameMatching$(); }
public void testNameMatching$() throws Exception {
// Test case insensitive matching
testFindDefinition(MODULE_FilePath, indexOf(MODULE_Contents, "/*CC1-b*/"), 0,
"abc1", "abc2"
);
testFindDefinition(MODULE_FilePath, indexOf(MODULE_Contents, "/*CC1-c*/"), 0,
"abc1", "abc2"
);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ int bar;
void _dummy()
{
auto _dummy = abc/*CC1*/;
auto _dummy = aBc/*CC1-b*/; // Test case insensitive
auto _dummy = ABC/*CC1-c*/; // Test case insensitive

Foo.xx/*CC2*/;

Expand Down

0 comments on commit 7043d9d

Please sign in to comment.