mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Content Assist fixes
This commit is contained in:
parent
5b20ba9b22
commit
8ee1c65946
4 changed files with 22 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-04-23 Hoda Amer
|
||||||
|
Fix for bug#59631 : Macros do not appear in the completion list when no prefix is provided
|
||||||
|
Fix for bug#59686 : [Content Assist] Class references are not completing
|
||||||
|
|
||||||
2004-04-22 Sean Evoy
|
2004-04-22 Sean Evoy
|
||||||
This is the first part of the patch supplied by Leo at Intel
|
This is the first part of the patch supplied by Leo at Intel
|
||||||
to add error parsers to a managed build project, and to manipulate
|
to add error parsers to a managed build project, and to manipulate
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.corext.refactoring.rename;
|
package org.eclipse.cdt.internal.corext.refactoring.rename;
|
||||||
|
|
||||||
|
import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,6 +32,15 @@ import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.IStructure;
|
import org.eclipse.cdt.core.model.IStructure;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IVariable;
|
import org.eclipse.cdt.core.model.IVariable;
|
||||||
|
import org.eclipse.cdt.core.parser.IQuickParseCallback;
|
||||||
|
import org.eclipse.cdt.core.parser.IScanner;
|
||||||
|
import org.eclipse.cdt.core.parser.IToken;
|
||||||
|
import org.eclipse.cdt.core.parser.NullLogService;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
|
import org.eclipse.cdt.core.parser.ScannerException;
|
||||||
|
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
@ -178,6 +188,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
|
Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
|
||||||
|
|
||||||
RefactoringStatus result= null;
|
RefactoringStatus result= null;
|
||||||
if (fCElement instanceof IStructure){
|
if (fCElement instanceof IStructure){
|
||||||
result= Checks.checkClassName(newName);
|
result= Checks.checkClassName(newName);
|
||||||
|
@ -553,5 +564,4 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,10 +331,6 @@ public class CCompletionProcessor implements IContentAssistProcessor {
|
||||||
int pos = offset -1;
|
int pos = offset -1;
|
||||||
if(pos >= 0){
|
if(pos >= 0){
|
||||||
try{
|
try{
|
||||||
//While we aren't on a space, then go back and look for :: or a ->
|
|
||||||
while ((pos >= 0) && (document.getChar(pos) == ' ')) {
|
|
||||||
pos--;
|
|
||||||
}
|
|
||||||
if ((document.getChar(pos) == ':') && (document.getChar(pos -1) != ':')) {
|
if ((document.getChar(pos) == ':') && (document.getChar(pos -1) != ':')) {
|
||||||
// ignore this request
|
// ignore this request
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -543,18 +543,15 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
// 1. Get the search scope node
|
// 1. Get the search scope node
|
||||||
// the search node is the code scope inwhich completion is requested
|
// the search node is the code scope inwhich completion is requested
|
||||||
IASTScope searchNode = completionNode.getCompletionScope();
|
IASTScope searchNode = completionNode.getCompletionScope();
|
||||||
|
String prefix = completionNode.getCompletionPrefix();
|
||||||
// here we have to look for any names that could be referenced within this scope
|
// here we have to look for any names that could be referenced within this scope
|
||||||
// 1. lookup all
|
// 1. lookup all
|
||||||
ILookupResult result = null;
|
ILookupResult result = null;
|
||||||
if (completionNode.getCompletionPrefix().length() > 0){
|
if (completionNode.getCompletionPrefix().length() > 0){
|
||||||
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
IASTNode.LookupKind[] kinds = new IASTNode.LookupKind[1];
|
||||||
kinds[0] = IASTNode.LookupKind.ALL;
|
kinds[0] = IASTNode.LookupKind.ALL;
|
||||||
String prefix = completionNode.getCompletionPrefix();
|
|
||||||
result = lookup(searchNode, prefix, kinds, completionNode.getCompletionContext());
|
result = lookup(searchNode, prefix, kinds, completionNode.getCompletionContext());
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
|
|
||||||
List macros = lookupMacros(completionNode.getCompletionPrefix());
|
|
||||||
addMacrosToCompletions(prefix, macros.iterator());
|
|
||||||
}
|
}
|
||||||
else // prefix is empty
|
else // prefix is empty
|
||||||
{
|
{
|
||||||
|
@ -584,6 +581,10 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
addToCompletions(result);
|
addToCompletions(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List macros = lookupMacros(completionNode.getCompletionPrefix());
|
||||||
|
addMacrosToCompletions(prefix, macros.iterator());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void completionOnClassReference(IASTCompletionNode completionNode){
|
private void completionOnClassReference(IASTCompletionNode completionNode){
|
||||||
|
@ -707,7 +708,7 @@ public class CompletionEngine implements RelevanceConstants {
|
||||||
log ("Offset = " + completionOffset); //$NON-NLS-1$
|
log ("Offset = " + completionOffset); //$NON-NLS-1$
|
||||||
logNode("Scope = " , completionNode.getCompletionScope()); //$NON-NLS-1$
|
logNode("Scope = " , completionNode.getCompletionScope()); //$NON-NLS-1$
|
||||||
logNode("Context = " , completionNode.getCompletionContext()); //$NON-NLS-1$
|
logNode("Context = " , completionNode.getCompletionContext()); //$NON-NLS-1$
|
||||||
logKind("Kind = ", completionNode.getCompletionKind()); //$NON-NLS-1$
|
logKind("Kind = " , completionNode.getCompletionKind()); //$NON-NLS-1$
|
||||||
log ("Prefix = " + completionNode.getCompletionPrefix()); //$NON-NLS-1$
|
log ("Prefix = " + completionNode.getCompletionPrefix()); //$NON-NLS-1$
|
||||||
|
|
||||||
if (completionNode.getCompletionScope() == null){
|
if (completionNode.getCompletionScope() == null){
|
||||||
|
|
Loading…
Add table
Reference in a new issue