|
|
|
@ -30,9 +30,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int defaultIndex; |
|
|
|
|
|
|
|
|
|
|
|
public int DefaultIndex { |
|
|
|
public int DefaultIndex { |
|
|
|
get { |
|
|
|
get { |
|
|
|
return -1; |
|
|
|
return defaultIndex; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -85,42 +87,68 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
|
|
|
if (list == null) { |
|
|
|
if (list == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
System.Diagnostics.Debugger.Break(); |
|
|
|
completionData.Capacity += list.Count; |
|
|
|
completionData.Capacity += list.Count; |
|
|
|
|
|
|
|
CodeCompletionData suggestedData = null; |
|
|
|
foreach (object o in list) { |
|
|
|
foreach (object o in list) { |
|
|
|
if (context != null && !context.ShowEntry(o)) |
|
|
|
if (context != null && !context.ShowEntry(o)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
if (o is string) { |
|
|
|
CodeCompletionData ccd = CreateItem(o, context); |
|
|
|
completionData.Add(new CodeCompletionData(o.ToString(), ClassBrowserIconService.NamespaceIndex)); |
|
|
|
if (object.Equals(o, context.SuggestedItem)) |
|
|
|
} else if (o is IClass) { |
|
|
|
suggestedData = ccd; |
|
|
|
completionData.Add(new CodeCompletionData((IClass)o)); |
|
|
|
if (ccd != null) |
|
|
|
} else if (o is IProperty) { |
|
|
|
completionData.Add(ccd); |
|
|
|
IProperty property = (IProperty)o; |
|
|
|
} |
|
|
|
if (property.Name != null && insertedPropertiesElements[property.Name] == null) { |
|
|
|
if (context.SuggestedItem != null) { |
|
|
|
completionData.Add(new CodeCompletionData(property)); |
|
|
|
if (suggestedData == null) { |
|
|
|
insertedPropertiesElements[property.Name] = property; |
|
|
|
suggestedData = CreateItem(context.SuggestedItem, context); |
|
|
|
} |
|
|
|
if (suggestedData != null) { |
|
|
|
} else if (o is IMethod) { |
|
|
|
completionData.Add(suggestedData); |
|
|
|
IMethod method = (IMethod)o; |
|
|
|
|
|
|
|
if (method.Name != null &&!method.IsConstructor) { |
|
|
|
|
|
|
|
CodeCompletionData ccd = new CodeCompletionData(method); |
|
|
|
|
|
|
|
if (insertedElements[method.Name] == null) { |
|
|
|
|
|
|
|
completionData.Add(ccd); |
|
|
|
|
|
|
|
insertedElements[method.Name] = ccd; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
CodeCompletionData oldMethod = (CodeCompletionData)insertedElements[method.Name]; |
|
|
|
|
|
|
|
++oldMethod.Overloads; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else if (o is IField) { |
|
|
|
} |
|
|
|
completionData.Add(new CodeCompletionData((IField)o)); |
|
|
|
if (suggestedData != null) { |
|
|
|
} else if (o is IEvent) { |
|
|
|
completionData.Sort(); |
|
|
|
IEvent e = (IEvent)o; |
|
|
|
defaultIndex = completionData.IndexOf(suggestedData); |
|
|
|
if (e.Name != null && insertedEventElements[e.Name] == null) { |
|
|
|
} |
|
|
|
completionData.Add(new CodeCompletionData(e)); |
|
|
|
} |
|
|
|
insertedEventElements[e.Name] = e; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CodeCompletionData CreateItem(object o, ExpressionContext context) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (o is string) { |
|
|
|
|
|
|
|
return new CodeCompletionData(o.ToString(), ClassBrowserIconService.NamespaceIndex); |
|
|
|
|
|
|
|
} else if (o is IClass) { |
|
|
|
|
|
|
|
return new CodeCompletionData((IClass)o); |
|
|
|
|
|
|
|
} else if (o is IProperty) { |
|
|
|
|
|
|
|
IProperty property = (IProperty)o; |
|
|
|
|
|
|
|
if (property.Name != null && insertedPropertiesElements[property.Name] == null) { |
|
|
|
|
|
|
|
insertedPropertiesElements[property.Name] = property; |
|
|
|
|
|
|
|
return new CodeCompletionData(property); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (o is IMethod) { |
|
|
|
|
|
|
|
IMethod method = (IMethod)o; |
|
|
|
|
|
|
|
if (method.Name != null &&!method.IsConstructor) { |
|
|
|
|
|
|
|
CodeCompletionData ccd = new CodeCompletionData(method); |
|
|
|
|
|
|
|
if (insertedElements[method.Name] == null) { |
|
|
|
|
|
|
|
insertedElements[method.Name] = ccd; |
|
|
|
|
|
|
|
return ccd; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
CodeCompletionData oldMethod = (CodeCompletionData)insertedElements[method.Name]; |
|
|
|
|
|
|
|
++oldMethod.Overloads; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (o is IField) { |
|
|
|
|
|
|
|
return new CodeCompletionData((IField)o); |
|
|
|
|
|
|
|
} else if (o is IEvent) { |
|
|
|
|
|
|
|
IEvent e = (IEvent)o; |
|
|
|
|
|
|
|
if (e.Name != null && insertedEventElements[e.Name] == null) { |
|
|
|
|
|
|
|
insertedEventElements[e.Name] = e; |
|
|
|
|
|
|
|
return new CodeCompletionData(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
throw new ApplicationException("Unknown object: " + o); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void AddResolveResults(ResolveResult results, ExpressionContext context) |
|
|
|
protected void AddResolveResults(ResolveResult results, ExpressionContext context) |
|
|
|
|