diff --git a/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs b/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs index 6ef1a2be69..a013e8cc74 100644 --- a/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs +++ b/src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs @@ -133,6 +133,8 @@ namespace ICSharpCode.UnitTesting /// protected void TestsFinished() { + WorkbenchSingleton.AssertMainThread(); + // Read the rest of the file just in case. testResultsMonitor.Stop(); testResultsMonitor.Read(); diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index ce721d3ce2..02290ffaa8 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -83,6 +83,7 @@ + diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs index f88a17160b..3ac559545c 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs @@ -10,7 +10,6 @@ using System.Collections; using System.IO; using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; namespace ICSharpCode.SharpDevelop.Editor { @@ -180,7 +179,7 @@ namespace ICSharpCode.SharpDevelop.Editor break; case '[': if (enableIndexerInsight && CodeCompletionOptions.InsightEnabled) { - editor.ShowInsightWindow(new IndexerInsightDataProvider()); + editor.ShowInsightWindow(new IndexerInsightProvider().ProvideInsight(editor)); return CodeCompletionKeyPressResult.Completed; } break; diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/IndexerInsightProvider.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/IndexerInsightProvider.cs new file mode 100644 index 0000000000..99b45c0130 --- /dev/null +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/IndexerInsightProvider.cs @@ -0,0 +1,32 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Linq; +using ICSharpCode.SharpDevelop.Dom; + +namespace ICSharpCode.SharpDevelop.Editor +{ + /// + /// Produces MethodInsightItem instances for showing the insight window on indexer calls. + /// + public class IndexerInsightProvider : MethodInsightProvider + { + public override IInsightItem[] ProvideInsight(ExpressionResult expressionResult, ResolveResult result) + { + if (result == null) + return null; + IReturnType type = result.ResolvedType; + if (type == null) + return null; + return (from p in type.GetProperties() + where p.IsIndexer + select new MethodInsightItem(p) + ).ToArray(); + } + } +} diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs index 68e643b6c3..18347a1540 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs @@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Dom; namespace ICSharpCode.SharpDevelop.Editor { /// - /// Description of MethodInsightProvider. + /// Produces MethodInsightItem instances for showing the insight window on method calls. /// public class MethodInsightProvider { diff --git a/src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs b/src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs index d89a865aa2..645e0dd0e8 100644 --- a/src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs +++ b/src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs @@ -194,7 +194,7 @@ namespace ICSharpCode.SharpDevelop.Editor protected void ShowInsight(ITextEditor editor, IList insightItems, ICollection parameters, char charTyped) { int paramCount = parameters.Count; - if (insightItems.Count == 0) + if (insightItems == null || insightItems.Count == 0) return; bool overloadIsSure; int defaultIndex;