22 changed files with 485 additions and 281 deletions
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
|
||||
namespace ICSharpCode.PythonBinding |
||||
{ |
||||
public class PythonCodeCompletionItemProvider : CodeCompletionItemProvider |
||||
{ |
||||
protected override DefaultCompletionItemList CreateCompletionItemList() |
||||
{ |
||||
return new PythonCompletionItemList(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
|
||||
namespace ICSharpCode.PythonBinding |
||||
{ |
||||
public class PythonCompletionItemList : DefaultCompletionItemList |
||||
{ |
||||
public override CompletionItemListKeyResult ProcessInput(char key) |
||||
{ |
||||
if (key == '*') { |
||||
return ProcessAsterisk(); |
||||
} |
||||
return base.ProcessInput(key); |
||||
} |
||||
|
||||
CompletionItemListKeyResult ProcessAsterisk() |
||||
{ |
||||
InsertSpace = false; |
||||
return CompletionItemListKeyResult.NormalKey; |
||||
} |
||||
} |
||||
} |
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests.Utils; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the From keyword is correctly identified as a
|
||||
/// importable code completion keyword.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class FromImportCompletionTestFixture |
||||
{ |
||||
DerivedPythonCodeCompletionBinding codeCompletionBinding; |
||||
bool handlesImportKeyword; |
||||
AvalonEditTextEditorAdapter textEditor; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
if (!PropertyService.Initialized) { |
||||
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty); |
||||
} |
||||
textEditor = new AvalonEditTextEditorAdapter(new ICSharpCode.AvalonEdit.TextEditor()); |
||||
codeCompletionBinding = new DerivedPythonCodeCompletionBinding(); |
||||
handlesImportKeyword = codeCompletionBinding.HandleKeyword(textEditor, "from"); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandlesImportKeyWord() |
||||
{ |
||||
Assert.IsTrue(handlesImportKeyword); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.Scripting.Tests.Utils; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests.Utils; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the From keyword is correctly identified as a
|
||||
/// importable code completion keyword.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class CodeCompletionBindingFromImportCompletionTests |
||||
{ |
||||
MockTextEditor fakeTextEditor; |
||||
TestablePythonCodeCompletionBinding codeCompletionBinding; |
||||
|
||||
void CreatePythonCodeCompletionBinding() |
||||
{ |
||||
fakeTextEditor = new MockTextEditor(); |
||||
codeCompletionBinding = new TestablePythonCodeCompletionBinding(); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsFrom_ReturnsTrue() |
||||
{ |
||||
CreatePythonCodeCompletionBinding(); |
||||
bool handled = codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); |
||||
Assert.IsTrue(handled); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsFrom_PythonDotCodeCompletionItemProviderUsedToShowCompletionWindow() |
||||
{ |
||||
CreatePythonCodeCompletionBinding(); |
||||
codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); |
||||
ITextEditor textEditor = codeCompletionBinding.TextEditorPassedToShowCompletionWindow; |
||||
|
||||
Assert.AreEqual(fakeTextEditor, textEditor); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsFrom_PythonCodeCompletionItemProviderCreated() |
||||
{ |
||||
CreatePythonCodeCompletionBinding(); |
||||
codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); |
||||
|
||||
PythonCodeCompletionItemProvider provider = codeCompletionBinding.KeywordCompletionItemProviderCreated as PythonCodeCompletionItemProvider; |
||||
|
||||
Assert.IsNotNull(provider); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsFrom_PythonCodeCompletionItemProviderPassedToShowCompletionWindow() |
||||
{ |
||||
CreatePythonCodeCompletionBinding(); |
||||
codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); |
||||
|
||||
AbstractCompletionItemProvider provider = codeCompletionBinding.CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow; |
||||
|
||||
Assert.AreSame(codeCompletionBinding.KeywordCompletionItemProviderCreated, provider); |
||||
} |
||||
} |
||||
} |
@ -1,89 +0,0 @@
@@ -1,89 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests.Utils; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the code completion after an "import" statement.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class CodeCompletionBindingImportCompletionTestFixture |
||||
{ |
||||
DerivedPythonCodeCompletionBinding codeCompletionBinding; |
||||
bool handlesImportKeyword; |
||||
AvalonEditTextEditorAdapter textEditor; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
if (!PropertyService.Initialized) { |
||||
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty); |
||||
} |
||||
textEditor = new AvalonEditTextEditorAdapter(new ICSharpCode.AvalonEdit.TextEditor()); |
||||
codeCompletionBinding = new DerivedPythonCodeCompletionBinding(); |
||||
handlesImportKeyword = codeCompletionBinding.HandleKeyword(textEditor, "import"); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandlesImportKeyWord() |
||||
{ |
||||
Assert.IsTrue(handlesImportKeyword); |
||||
} |
||||
|
||||
[Test] |
||||
public void UnknownKeywordNotHandled() |
||||
{ |
||||
Assert.IsFalse(codeCompletionBinding.HandleKeyword(textEditor, "Unknown")); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandlesUppercaseImportKeyword() |
||||
{ |
||||
Assert.IsTrue(codeCompletionBinding.HandleKeyword(textEditor, "IMPORT")); |
||||
} |
||||
|
||||
[Test] |
||||
public void NullKeyword() |
||||
{ |
||||
Assert.IsFalse(codeCompletionBinding.HandleKeyword(textEditor, null)); |
||||
} |
||||
|
||||
[Test] |
||||
public void CompletionDataProviderCreated() |
||||
{ |
||||
Assert.IsTrue(codeCompletionBinding.IsCompletionDataProviderCreated); |
||||
} |
||||
|
||||
[Test] |
||||
public void CodeCompletionWindowDisplayed() |
||||
{ |
||||
Assert.IsTrue(codeCompletionBinding.IsCodeCompletionWindowDisplayed); |
||||
} |
||||
|
||||
[Test] |
||||
public void TextAreaControlUsedToDisplayCodeCompletionWindow() |
||||
{ |
||||
Assert.AreSame(textEditor, codeCompletionBinding.TextEditorUsedToShowCompletionWindow); |
||||
} |
||||
|
||||
[Test] |
||||
public void CompletionProviderUsedWhenDisplayingCodeCompletionWindow() |
||||
{ |
||||
Assert.AreSame(codeCompletionBinding.CompletionDataProvider, codeCompletionBinding.CompletionProviderUsedWhenDisplayingCodeCompletionWindow); |
||||
} |
||||
|
||||
[Test] |
||||
public void CompletionCharacterIsSpace() |
||||
{ |
||||
Assert.AreEqual(' ', codeCompletionBinding.CompletionCharacter); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,101 @@
@@ -0,0 +1,101 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Scripting.Tests.Utils; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests.Utils; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the code completion after an "import" statement.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class CodeCompletionBindingImportCompletionTests |
||||
{ |
||||
TestablePythonCodeCompletionBinding codeCompletionBinding; |
||||
MockTextEditor textEditor; |
||||
bool handled; |
||||
|
||||
public void CreateCompletionBinding() |
||||
{ |
||||
textEditor = new MockTextEditor(); |
||||
codeCompletionBinding = new TestablePythonCodeCompletionBinding(); |
||||
} |
||||
|
||||
public void HandlesImportKeyword() |
||||
{ |
||||
CreateCompletionBinding(); |
||||
handled = codeCompletionBinding.HandleKeyword(textEditor, "import"); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImport_ReturnsTrue() |
||||
{ |
||||
HandlesImportKeyword(); |
||||
Assert.IsTrue(handled); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_UnknownKeyword_ReturnsFalse() |
||||
{ |
||||
bool handled = codeCompletionBinding.HandleKeyword(textEditor, "Unknown"); |
||||
Assert.IsFalse(handled); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImportInUpperCase_ReturnsTrue() |
||||
{ |
||||
bool handled = codeCompletionBinding.HandleKeyword(textEditor, "IMPORT"); |
||||
Assert.IsTrue(handled); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsNull_ReturnsFalse() |
||||
{ |
||||
bool handled = codeCompletionBinding.HandleKeyword(textEditor, null); |
||||
Assert.IsFalse(handled); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImport_CodeCompletionWindowDisplayed() |
||||
{ |
||||
HandlesImportKeyword(); |
||||
Assert.IsTrue(codeCompletionBinding.IsCodeCompletionWindowDisplayed); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImport_TextEditorPassedToShowCompletionWindowMethod() |
||||
{ |
||||
HandlesImportKeyword(); |
||||
Assert.AreSame(textEditor, codeCompletionBinding.TextEditorPassedToShowCompletionWindow); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImport_CompletionProviderUsedWhenDisplayingCodeCompletionWindow() |
||||
{ |
||||
HandlesImportKeyword(); |
||||
Assert.AreSame(codeCompletionBinding.KeywordCompletionItemProviderCreated, codeCompletionBinding.CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow); |
||||
} |
||||
|
||||
[Test] |
||||
public void HandleKeyword_KeywordIsImport_KeywordCompletionDataProviderIsCodeCompletionItemProvider() |
||||
{ |
||||
HandlesImportKeyword(); |
||||
CodeCompletionItemProvider provider = codeCompletionBinding.KeywordCompletionItemProviderCreated as CodeCompletionItemProvider; |
||||
Assert.IsNotNull(provider); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowCompletionWindow_FakeCompletionItemProviderAndTextEditorPassed_asdf() |
||||
{ |
||||
CreateCompletionBinding(); |
||||
FakeCompletionItemProvider provider = new FakeCompletionItemProvider(); |
||||
codeCompletionBinding.CallBaseShowCodeCompletionWindow(provider, textEditor); |
||||
|
||||
Assert.AreEqual(textEditor, provider.TextEditorPassedToShowCompletion); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using NUnit.Framework; |
||||
using PythonBinding.Tests.Utils; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
[TestFixture] |
||||
public class PythonCodeCompletionItemProviderTests |
||||
{ |
||||
[Test] |
||||
public void CreateCompletionItemList_OverriddenInPythonCodeCompletionItemProvider_ReturnsPythonCompletionItemList() |
||||
{ |
||||
TestablePythonCodeCompletionItemProvider provider = new TestablePythonCodeCompletionItemProvider(); |
||||
PythonCompletionItemList list = provider.CallBaseCreateCompletionItemList() as PythonCompletionItemList; |
||||
|
||||
Assert.IsNotNull(list); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using NUnit.Framework; |
||||
|
||||
namespace PythonBinding.Tests.Completion |
||||
{ |
||||
[TestFixture] |
||||
public class PythonCompletionItemListTests |
||||
{ |
||||
PythonCompletionItemList completionItemList; |
||||
|
||||
void CreatePythonCompletionItemList() |
||||
{ |
||||
completionItemList = new PythonCompletionItemList(); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProcessInput_KeyIsAsterisk_ReturnsNormalKey() |
||||
{ |
||||
CreatePythonCompletionItemList(); |
||||
CompletionItemListKeyResult result = completionItemList.ProcessInput('*'); |
||||
CompletionItemListKeyResult expectedResult = CompletionItemListKeyResult.NormalKey; |
||||
|
||||
Assert.AreEqual(expectedResult, result); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProcessInput_KeyIsAsterisk_InsertSpaceSetToFalseAfterMethodCalled() |
||||
{ |
||||
CreatePythonCompletionItemList(); |
||||
completionItemList.InsertSpace = true; |
||||
completionItemList.ProcessInput('*'); |
||||
|
||||
Assert.IsFalse(completionItemList.InsertSpace); |
||||
} |
||||
} |
||||
} |
@ -1,94 +0,0 @@
@@ -1,94 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace PythonBinding.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Derived PythonCodeCompletion class that gives us access to
|
||||
/// various protected methods for testing.
|
||||
/// </summary>
|
||||
public class DerivedPythonCodeCompletionBinding : PythonCodeCompletionBinding |
||||
{ |
||||
bool completionDataProviderCreated; |
||||
bool codeCompletionWindowDisplayed; |
||||
ICSharpCode.SharpDevelop.Editor.ITextEditor textEditorUsedToShowCompletionWindow; |
||||
AbstractCompletionItemProvider completionProviderUsedWhenDisplayingCodeCompletionWindow; |
||||
AbstractCompletionItemProvider completionDataProvider; |
||||
char completionCharacter = '\0'; |
||||
|
||||
public DerivedPythonCodeCompletionBinding() |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the data provider was created by the
|
||||
/// base class PythonCodeCompletionBinding.
|
||||
/// </summary>
|
||||
public bool IsCompletionDataProviderCreated { |
||||
get { return completionDataProviderCreated; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the base class PythonCodeCompletionBinding
|
||||
/// displayed the code completion window.
|
||||
/// </summary>
|
||||
public bool IsCodeCompletionWindowDisplayed { |
||||
get { return codeCompletionWindowDisplayed; } |
||||
} |
||||
|
||||
public ICSharpCode.SharpDevelop.Editor.ITextEditor TextEditorUsedToShowCompletionWindow { |
||||
get { return textEditorUsedToShowCompletionWindow; } |
||||
} |
||||
|
||||
public AbstractCompletionItemProvider CompletionProviderUsedWhenDisplayingCodeCompletionWindow { |
||||
get { return completionProviderUsedWhenDisplayingCodeCompletionWindow; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the CompletionDataProvider created via the
|
||||
/// CreateCompletionDataProvider method.
|
||||
/// </summary>
|
||||
public AbstractCompletionItemProvider CompletionDataProvider { |
||||
get { return completionDataProvider; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the character used when calling the TextAreaControl's
|
||||
/// ShowCompletionWindow method.
|
||||
/// </summary>
|
||||
public char CompletionCharacter { |
||||
get { return completionCharacter; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Overrides the completion data provider creation to make sure
|
||||
/// it is called at the correct time.
|
||||
/// </summary>
|
||||
protected override AbstractCompletionItemProvider CreateCompletionDataProvider() |
||||
{ |
||||
completionDataProviderCreated = true; |
||||
completionDataProvider = base.CreateCompletionDataProvider(); |
||||
return completionDataProvider; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Overrides the base class method so a code completion window is
|
||||
/// not displayed but the fact that this method is called is
|
||||
/// recorded.
|
||||
/// </summary>
|
||||
protected override void ShowCodeCompletionWindow(ICSharpCode.SharpDevelop.Editor.ITextEditor textEditor, AbstractCompletionItemProvider completionDataProvider, char ch) |
||||
{ |
||||
textEditorUsedToShowCompletionWindow = textEditor; |
||||
codeCompletionWindowDisplayed = true; |
||||
completionCharacter = ch; |
||||
completionProviderUsedWhenDisplayingCodeCompletionWindow = completionDataProvider; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
|
||||
namespace PythonBinding.Tests.Utils |
||||
{ |
||||
public class FakeCompletionItemProvider : AbstractCompletionItemProvider |
||||
{ |
||||
public ITextEditor TextEditorPassedToShowCompletion; |
||||
|
||||
public override void ShowCompletion(ITextEditor editor) |
||||
{ |
||||
TextEditorPassedToShowCompletion = editor; |
||||
} |
||||
|
||||
public override ICompletionItemList GenerateCompletionList(ITextEditor editor) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
|
||||
namespace PythonBinding.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Derived PythonCodeCompletion class that gives us access to
|
||||
/// various protected methods for testing.
|
||||
/// </summary>
|
||||
public class TestablePythonCodeCompletionBinding : PythonCodeCompletionBinding |
||||
{ |
||||
public bool IsCodeCompletionWindowDisplayed; |
||||
public ITextEditor TextEditorPassedToShowCompletionWindow; |
||||
public AbstractCompletionItemProvider CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow; |
||||
public AbstractCompletionItemProvider KeywordCompletionItemProviderCreated; |
||||
|
||||
/// <summary>
|
||||
/// Overrides the completion data provider creation to make sure
|
||||
/// it is called at the correct time.
|
||||
/// </summary>
|
||||
protected override AbstractCompletionItemProvider CreateKeywordCompletionItemProvider() |
||||
{ |
||||
KeywordCompletionItemProviderCreated = base.CreateKeywordCompletionItemProvider(); |
||||
return KeywordCompletionItemProviderCreated; |
||||
} |
||||
|
||||
public void CallBaseShowCodeCompletionWindow(AbstractCompletionItemProvider completionItemProvider, ITextEditor textEditor) |
||||
{ |
||||
base.ShowCodeCompletionWindow(completionItemProvider, textEditor); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Overrides the base class method so a code completion window is
|
||||
/// not displayed but the fact that this method is called is
|
||||
/// recorded.
|
||||
/// </summary>
|
||||
protected override void ShowCodeCompletionWindow(AbstractCompletionItemProvider completionItemProvider, ITextEditor textEditor) |
||||
{ |
||||
TextEditorPassedToShowCompletionWindow = textEditor; |
||||
IsCodeCompletionWindowDisplayed = true; |
||||
CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow = completionItemProvider; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PythonBinding; |
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
|
||||
namespace PythonBinding.Tests.Utils |
||||
{ |
||||
public class TestablePythonCodeCompletionItemProvider : PythonCodeCompletionItemProvider |
||||
{ |
||||
public DefaultCompletionItemList CallBaseCreateCompletionItemList() |
||||
{ |
||||
return base.CreateCompletionItemList(); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue