mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Bug 98881 - Added lots of goodies to the search completion to make it more usable. Also fixed up the DOM indexer to record varargs.
This commit is contained in:
parent
4d55560528
commit
e8f0d1c55e
4 changed files with 7 additions and 6 deletions
|
@ -118,7 +118,7 @@ public class FunctionMethodPatternTests extends BaseSearchTest {
|
|||
|
||||
search( workspace, pattern, scope, resultCollector );
|
||||
matches = resultCollector.getSearchResults();
|
||||
assertEquals( 2, matches.size());
|
||||
assertEquals( 0, matches.size()); // The pattern must match the use of the void in the code
|
||||
|
||||
pattern = SearchEngine.createSearchPattern( "turnAgain()", METHOD, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -219,9 +219,8 @@ public class IndexVisitorUtil {
|
|||
IType paramType = parameters[i].getType();
|
||||
parameterList.add(ASTTypeUtil.getType(paramType).toCharArray());
|
||||
}
|
||||
if (parameterList.isEmpty()) {
|
||||
parameterList.add("void".toCharArray()); //$NON-NLS-1$
|
||||
}
|
||||
if (function.takesVarArgs())
|
||||
parameterList.add("...".toCharArray()); //$NON-NLS-1$
|
||||
}
|
||||
catch (DOMException e) {
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ public class DOMCompletionContributor implements ICompletionContributor {
|
|||
|
||||
args.append(ASTTypeUtil.getType(paramType));
|
||||
String paramName = params[i].getName();
|
||||
if (paramName != null) {
|
||||
if (paramName != null && paramName.length() > 0) {
|
||||
args.append(' ');
|
||||
args.append(paramName);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
|
@ -40,6 +39,9 @@ public class SearchCompletionContributor implements ICompletionContributor {
|
|||
{
|
||||
if (!validContext(completionNode))
|
||||
return;
|
||||
|
||||
if (prefix == null || prefix.length() == 0)
|
||||
return;
|
||||
|
||||
// Create search engine
|
||||
SearchEngine searchEngine = new SearchEngine();
|
||||
|
|
Loading…
Add table
Reference in a new issue