mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Bug 98881 - Added lots of goodies to the search completion to make it more usable. Put the void back in the DOM indexer/no params case. Really trying to remove duplicates more than anything which is 98765.
This commit is contained in:
parent
46807db5b9
commit
e653b13ea5
4 changed files with 32 additions and 20 deletions
|
@ -142,7 +142,10 @@ public class DOMCompletionContributor implements ICompletionContributor {
|
|||
}
|
||||
dispargs.append(" ..."); //$NON-NLS-1$
|
||||
idargs.append(" ..."); //$NON-NLS-1$
|
||||
}
|
||||
} else if (params.length == 0) { // force the void in
|
||||
dispargs.append("void"); //$NON-NLS-1$
|
||||
idargs.append("void"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
IType returnType = function.getType().getReturnType();
|
||||
if (returnType != null)
|
||||
|
|
|
@ -129,29 +129,31 @@ public class SearchCompletionContributor implements ICompletionContributor {
|
|||
if (params != null)
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
if (i > 0)
|
||||
args.append(", "); //$NON-NLS-1$
|
||||
args.append(',');
|
||||
args.append(params[i]);
|
||||
}
|
||||
|
||||
String returnType = match.getReturnType();
|
||||
String argString = args.toString();
|
||||
|
||||
StringBuffer descStringBuff = new StringBuffer(repStringBuff.toString());
|
||||
descStringBuff.append(argString);
|
||||
descStringBuff.append(')');
|
||||
|
||||
if (returnType != null) {
|
||||
descStringBuff.append(' ');
|
||||
descStringBuff.append(returnType);
|
||||
}
|
||||
StringBuffer dispStringBuff = new StringBuffer(repStringBuff.toString());
|
||||
dispStringBuff.append(argString);
|
||||
dispStringBuff.append(')');
|
||||
|
||||
repStringBuff.append(')');
|
||||
String repString = repStringBuff.toString();
|
||||
String descString = descStringBuff.toString();
|
||||
|
||||
String idString = null;
|
||||
if (returnType != null) {
|
||||
idString = dispStringBuff.toString();
|
||||
dispStringBuff.append(' ');
|
||||
dispStringBuff.append(returnType);
|
||||
}
|
||||
String dispString = dispStringBuff.toString();
|
||||
|
||||
int repLength = prefix.length();
|
||||
int repOffset = offset - repLength;
|
||||
CCompletionProposal proposal = new CCompletionProposal(repString, repOffset, repLength, image, descString, 1, viewer);
|
||||
CCompletionProposal proposal = new CCompletionProposal(repString, repOffset, repLength, image, dispString, idString, 1, viewer);
|
||||
proposal.setCursorPosition(repString.length() - 1);
|
||||
|
||||
if (argString.length() > 0) {
|
||||
|
@ -159,6 +161,7 @@ public class SearchCompletionContributor implements ICompletionContributor {
|
|||
info.setContextInformationPosition(offset);
|
||||
proposal.setContextInformation(info);
|
||||
}
|
||||
|
||||
proposals.add(proposal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,12 +66,10 @@ public class TemplateEngine implements ICompletionContributor {
|
|||
super(template, context, region, image, 90);
|
||||
}
|
||||
|
||||
// /* (non-Javadoc)
|
||||
// * @see org.eclipse.cdt.ui.text.ICCompletionProposal#getRelevance()
|
||||
// */
|
||||
// public int getRelevance() {
|
||||
// return 90;
|
||||
// }
|
||||
public String getIdString() {
|
||||
return getDisplayString();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Creates the template engine for a particular context type.
|
||||
|
|
|
@ -24,5 +24,13 @@ public interface ICCompletionProposal extends ICompletionProposal {
|
|||
*/
|
||||
int getRelevance();
|
||||
|
||||
/**
|
||||
* Returns an id string that uniquely identifies this proposal. For most things this is the
|
||||
* same as the display name. For functions, this strips off the parameter names and the
|
||||
* return type.
|
||||
*
|
||||
* @return the string that uniquely identifies this proposal
|
||||
*/
|
||||
String getIdString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue