Browse Source

Allow CodeCompletionDataProvider to specify the chars that are allowed to be entered while the code completion window is opened.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1105 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
8c8f945005
  1. 11
      src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj
  2. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs
  3. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionDataProvider.cs
  4. 8
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs
  5. 11
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CachedCompletionDataProvider.cs
  6. 5
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs

11
src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj

@ -15,7 +15,6 @@ @@ -15,7 +15,6 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Resources\ICSharpCode.TextEditor.snk</AssemblyOriginatorKeyFile>
<RootNamespace>ICSharpCode.TextEditor</RootNamespace>
<DebugType>None</DebugType>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>134217728</BaseAddress>
@ -23,7 +22,6 @@ @@ -23,7 +22,6 @@
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>False</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
@ -32,13 +30,20 @@ @@ -32,13 +30,20 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs

@ -151,7 +151,7 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow @@ -151,7 +151,7 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow
public override bool ProcessKeyEvent(char ch)
{
if (!Char.IsLetterOrDigit(ch) && ch != '_') {
if (dataProvider.IsInsertionKey(ch)) {
if (ch == ' ' && dataProvider.InsertSpace) {
// increment start + end and process as normal space
++startOffset;

4
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionDataProvider.cs

@ -36,6 +36,10 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow @@ -36,6 +36,10 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow
get;
set;
}
/// <summary>
/// Gets if pressing 'key' should trigger the insertion of the currently selected element.
/// </summary>
bool IsInsertionKey(char key);
/// <summary>
/// Generates the completion data. This method is called by the text editor control.

8
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs

@ -62,6 +62,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -62,6 +62,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
/// <summary>
/// Gets if pressing 'key' should trigger the insertion of the currently selected element.
/// </summary>
public virtual bool IsInsertionKey(char key)
{
return !char.IsLetterOrDigit(key) && key != '_';
}
/// <summary>
/// Generates the completion data. This method is called by the text editor control.
/// </summary>

11
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CachedCompletionDataProvider.cs

@ -38,6 +38,17 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -38,6 +38,17 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
public override ImageList ImageList {
get {
return baseProvider.ImageList;
}
}
public override bool IsInsertionKey(char key)
{
return baseProvider.IsInsertionKey(key);
}
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
if (completionData == null) {

5
src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs

@ -244,6 +244,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -244,6 +244,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (codeCompletionWindow.ProcessKeyEvent(ch)) {
return true;
}
if (codeCompletionWindow != null && !codeCompletionWindow.IsDisposed) {
// code-completion window is still opened but did not want to handle
// the keypress -> don't try to restart code-completion
return false;
}
}
try {

Loading…
Cancel
Save