|
From: <caw...@us...> - 2007-04-13 20:15:36
|
Revision: 2315
http://svn.sourceforge.net/rubyeclipse/?rev=2315&view=rev
Author: cawilliams
Date: 2007-04-13 13:15:32 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
don't ask for every constant/global/type and the check prefix afterwards. bake the prefix right into the search pattern!
Modified Paths:
--------------
branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
Modified: branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-04-13 20:10:32 UTC (rev 2314)
+++ branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-04-13 20:15:32 UTC (rev 2315)
@@ -157,14 +157,12 @@
}
private void suggestTypeNames() {
- SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
+ SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, fContext.getPartialPrefix() + "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
IRubySearchScope scope = BasicSearchEngine.createRubySearchScope(new IRubyElement[] {fContext.getScript().getRubyProject()});
List<SearchMatch> results = search(pattern, scope);
for (SearchMatch match: results) {
IRubyElement element = (IRubyElement) match.getElement();
String name = element.getElementName();
- if (!fContext.prefixStartsWith(name))
- continue;
CompletionProposal proposal = createProposal(fContext.getReplaceStart(), CompletionProposal.TYPE_REF, name);
proposal.setType(name);
fRequestor.accept(proposal);
@@ -191,15 +189,12 @@
}
private void suggestConstantNames() {
- // TODO Do a regexp search for anything starting with an uppercase?
- SearchPattern pattern = SearchPattern.createPattern(IRubyElement.CONSTANT, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
+ SearchPattern pattern = SearchPattern.createPattern(IRubyElement.CONSTANT, fContext.getPartialPrefix() + "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
IRubySearchScope scope = BasicSearchEngine.createRubySearchScope(new IRubyElement[] {fContext.getScript()});
List<SearchMatch> results = search(pattern, scope);
for (SearchMatch match: results) {
IRubyElement element = (IRubyElement) match.getElement();
String name = element.getElementName();
- if (!fContext.prefixStartsWith(name))
- continue;
CompletionProposal proposal = createProposal(fContext.getReplaceStart(), CompletionProposal.FIELD_REF, name);
proposal.setType(name);
fRequestor.accept(proposal);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|