Browse Source

Implemented Indexer Insight for AvalonEdit.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4080 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
551cbf9e4c
  1. 2
      src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs
  2. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 3
      src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs
  4. 32
      src/Main/Base/Project/Src/Editor/CodeCompletion/IndexerInsightProvider.cs
  5. 2
      src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs
  6. 2
      src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs

2
src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs

@ -133,6 +133,8 @@ namespace ICSharpCode.UnitTesting @@ -133,6 +133,8 @@ namespace ICSharpCode.UnitTesting
/// </summary>
protected void TestsFinished()
{
WorkbenchSingleton.AssertMainThread();
// Read the rest of the file just in case.
testResultsMonitor.Stop();
testResultsMonitor.Read();

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -83,6 +83,7 @@ @@ -83,6 +83,7 @@
<Compile Include="Src\Editor\CodeCompletion\ICompletionItemList.cs" />
<Compile Include="Src\Editor\CodeCompletion\IInsightItem.cs" />
<Compile Include="Src\Editor\CodeCompletion\IInsightWindow.cs" />
<Compile Include="Src\Editor\CodeCompletion\IndexerInsightProvider.cs" />
<Compile Include="Src\Editor\CodeCompletion\MethodInsightItem.cs" />
<Compile Include="Src\Editor\CodeCompletion\MethodInsightProvider.cs" />
<Compile Include="Src\Editor\CodeCompletion\NRefactoryCodeCompletionBinding.cs" />

3
src/Main/Base/Project/Src/Editor/CodeCompletion/CodeCompletionBinding.cs

@ -10,7 +10,6 @@ using System.Collections; @@ -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 @@ -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;

32
src/Main/Base/Project/Src/Editor/CodeCompletion/IndexerInsightProvider.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Linq;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Editor
{
/// <summary>
/// Produces MethodInsightItem instances for showing the insight window on indexer calls.
/// </summary>
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();
}
}
}

2
src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightProvider.cs

@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Dom; @@ -16,7 +16,7 @@ using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Editor
{
/// <summary>
/// Description of MethodInsightProvider.
/// Produces MethodInsightItem instances for showing the insight window on method calls.
/// </summary>
public class MethodInsightProvider
{

2
src/Main/Base/Project/Src/Editor/CodeCompletion/NRefactoryCodeCompletionBinding.cs

@ -194,7 +194,7 @@ namespace ICSharpCode.SharpDevelop.Editor @@ -194,7 +194,7 @@ namespace ICSharpCode.SharpDevelop.Editor
protected void ShowInsight(ITextEditor editor, IList<IInsightItem> insightItems, ICollection<ResolveResult> parameters, char charTyped)
{
int paramCount = parameters.Count;
if (insightItems.Count == 0)
if (insightItems == null || insightItems.Count == 0)
return;
bool overloadIsSure;
int defaultIndex;

Loading…
Cancel
Save