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,6 +142,9 @@ public class DOMCompletionContributor implements ICompletionContributor {
|
||||||
}
|
}
|
||||||
dispargs.append(" ..."); //$NON-NLS-1$
|
dispargs.append(" ..."); //$NON-NLS-1$
|
||||||
idargs.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();
|
IType returnType = function.getType().getReturnType();
|
||||||
|
|
|
@ -129,29 +129,31 @@ public class SearchCompletionContributor implements ICompletionContributor {
|
||||||
if (params != null)
|
if (params != null)
|
||||||
for (int i = 0; i < params.length; ++i) {
|
for (int i = 0; i < params.length; ++i) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
args.append(", "); //$NON-NLS-1$
|
args.append(',');
|
||||||
args.append(params[i]);
|
args.append(params[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
String returnType = match.getReturnType();
|
String returnType = match.getReturnType();
|
||||||
String argString = args.toString();
|
String argString = args.toString();
|
||||||
|
|
||||||
StringBuffer descStringBuff = new StringBuffer(repStringBuff.toString());
|
StringBuffer dispStringBuff = new StringBuffer(repStringBuff.toString());
|
||||||
descStringBuff.append(argString);
|
dispStringBuff.append(argString);
|
||||||
descStringBuff.append(')');
|
dispStringBuff.append(')');
|
||||||
|
|
||||||
if (returnType != null) {
|
|
||||||
descStringBuff.append(' ');
|
|
||||||
descStringBuff.append(returnType);
|
|
||||||
}
|
|
||||||
|
|
||||||
repStringBuff.append(')');
|
repStringBuff.append(')');
|
||||||
String repString = repStringBuff.toString();
|
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 repLength = prefix.length();
|
||||||
int repOffset = offset - repLength;
|
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);
|
proposal.setCursorPosition(repString.length() - 1);
|
||||||
|
|
||||||
if (argString.length() > 0) {
|
if (argString.length() > 0) {
|
||||||
|
@ -159,6 +161,7 @@ public class SearchCompletionContributor implements ICompletionContributor {
|
||||||
info.setContextInformationPosition(offset);
|
info.setContextInformationPosition(offset);
|
||||||
proposal.setContextInformation(info);
|
proposal.setContextInformation(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
proposals.add(proposal);
|
proposals.add(proposal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,12 +66,10 @@ public class TemplateEngine implements ICompletionContributor {
|
||||||
super(template, context, region, image, 90);
|
super(template, context, region, image, 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /* (non-Javadoc)
|
public String getIdString() {
|
||||||
// * @see org.eclipse.cdt.ui.text.ICCompletionProposal#getRelevance()
|
return getDisplayString();
|
||||||
// */
|
}
|
||||||
// public int getRelevance() {
|
|
||||||
// return 90;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates the template engine for a particular context type.
|
* Creates the template engine for a particular context type.
|
||||||
|
|
|
@ -24,5 +24,13 @@ public interface ICCompletionProposal extends ICompletionProposal {
|
||||||
*/
|
*/
|
||||||
int getRelevance();
|
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