Browse Source

Hidden definitions v0.1

pull/15/head
Eusebiu Marcu 15 years ago
parent
commit
2dc3ec2efc
  1. 3
      data/resources/StringResources.resx
  2. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpBracketSearcher.cs
  3. 17
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetBracketSearcher.cs
  4. 473
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
  5. 10
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs
  6. 12
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionControl.xaml
  7. 27
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionControl.xaml.cs
  8. 91
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionRenderer.cs
  9. 13
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs
  10. 3
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml
  11. 111
      src/Main/Base/Project/Src/Editor/IBracketSearcher.cs

3
data/resources/StringResources.resx

@ -2841,6 +2841,9 @@ system. I don't think that it needs translation.</comment> @@ -2841,6 +2841,9 @@ system. I don't think that it needs translation.</comment>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.LineNumberCheckBox" xml:space="preserve">
<value>Show &amp;line numbers</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.ShowHiddenDefinitionsCheckBox" xml:space="preserve">
<value>Show &amp;hidden definitions (brackets only)</value>
</data>
<data name="Dialog.Options.IDEOptions.TextEditor.Markers.LineViewerStyle.FullRow" xml:space="preserve">
<value>Full Row</value>
</data>

16
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpBracketSearcher.cs

@ -22,16 +22,22 @@ namespace CSharpBinding @@ -22,16 +22,22 @@ namespace CSharpBinding
{
if (offset > 0) {
char c = document.GetCharAt(offset - 1);
int index = openingBrackets.IndexOf(c);
int otherOffset = -1;
if (index > -1)
int index = openingBrackets.IndexOf(c);
int otherOffset = -1; int ind = -1;
if (index > -1) {
otherOffset = SearchBracketForward(document, offset, openingBrackets[index], closingBrackets[index]);
ind = index;
}
index = closingBrackets.IndexOf(c);
if (index > -1)
if (index > -1) {
otherOffset = SearchBracketBackward(document, offset - 2, openingBrackets[index], closingBrackets[index]);
ind = index;
}
if (otherOffset > -1)
return new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1, Math.Max(offset - 1, otherOffset), 1);
return new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1,
Math.Max(offset - 1, otherOffset), 1,
openingBrackets[ind].ToString(), closingBrackets[ind].ToString());
}
return null;

17
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetBracketSearcher.cs

@ -23,15 +23,21 @@ namespace ICSharpCode.VBNetBinding @@ -23,15 +23,21 @@ namespace ICSharpCode.VBNetBinding
if (offset > 0) {
char c = document.GetCharAt(offset - 1);
int index = openingBrackets.IndexOf(c);
int otherOffset = -1;
if (index > -1)
int otherOffset = -1; int ind = -1;
if (index > -1) {
otherOffset = SearchBracketForward(document, offset, openingBrackets[index], closingBrackets[index]);
ind = index;
}
index = closingBrackets.IndexOf(c);
if (index > -1)
if (index > -1) {
otherOffset = SearchBracketBackward(document, offset - 2, openingBrackets[index], closingBrackets[index]);
ind = index;
}
if (otherOffset > -1)
return new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1, Math.Max(offset - 1, otherOffset), 1);
return new BracketSearchResult(Math.Min(offset - 1, otherOffset), 1,
Math.Max(offset - 1, otherOffset), 1,
openingBrackets[ind].ToString(), closingBrackets[ind].ToString());
int length;
VBStatement statement;
@ -49,7 +55,8 @@ namespace ICSharpCode.VBNetBinding @@ -49,7 +55,8 @@ namespace ICSharpCode.VBNetBinding
}
if (startIndex > -1 && endIndex > -1)
return new BracketSearchResult(startIndex, length, endIndex, statement.EndStatement.Length);
return new BracketSearchResult(startIndex, length, endIndex,
statement.EndStatement.Length);
}
return null;

473
src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj

@ -1,234 +1,241 @@ @@ -1,234 +1,241 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{0162E499-42D0-409B-AA25-EED21F75336B}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.AvalonEdit.AddIn</RootNamespace>
<AssemblyName>ICSharpCode.AvalonEdit.AddIn</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<OutputPath>..\..\..\..\AddIns\DisplayBindings\AvalonEdit\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Design#CA1014;-Microsoft.Design#CA2210</CodeAnalysisRules>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="ReachFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Printing">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsFormsIntegration">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="AvalonEdit.AddIn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AvalonEditDisplayBinding.cs" />
<Compile Include="Src\AvalonEditEditorUIService.cs" />
<Compile Include="Src\AvalonEditorControlService.cs" />
<Compile Include="Src\AvalonEditViewContent.cs" />
<Compile Include="Src\BracketHighlightRenderer.cs" />
<Compile Include="Src\CaretReferencesRenderer.cs" />
<Compile Include="Src\ChangeMarkerMargin.cs" />
<Compile Include="Src\ChooseEncodingDialog.xaml.cs">
<DependentUpon>ChooseEncodingDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\CodeCompletionEditorAdapter.cs" />
<Compile Include="Src\CodeEditor.cs" />
<Compile Include="Src\CodeEditorAdapter.cs" />
<Compile Include="Src\CodeEditorView.cs" />
<Compile Include="Src\ContextActionsRenderer.cs" />
<Compile Include="Src\DefaultChangeWatcher.cs" />
<Compile Include="Src\ExpressionHighlightRenderer.cs" />
<Compile Include="Src\CodeManipulation.cs" />
<Compile Include="Src\CaretHighlightAdorner.cs" />
<Compile Include="Src\LineChangeInfo.cs" />
<Compile Include="Src\MyersDiff\DocumentSequence.cs" />
<Compile Include="Src\MyersDiff\Edit.cs" />
<Compile Include="Src\MyersDiff\ISequence.cs" />
<Compile Include="Src\MyersDiff\MyersDiff.cs" />
<Compile Include="Src\MyersDiff\StringSequence.cs" />
<Compile Include="Src\MyersDiff\Utils.cs" />
<Compile Include="Src\NewLineConsistencyCheck.cs" />
<Compile Include="Src\SharpDevelopTextEditor.cs" />
<Compile Include="Src\Commands\FoldingCommands.cs" />
<Compile Include="Src\Commands\RunIncrementalSearch.cs" />
<Compile Include="Src\Commands\SaveFileWithEncoding.cs" />
<Compile Include="Src\Commands\SortOptionsDialog.xaml.cs">
<DependentUpon>SortOptionsDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Commands\SortSelectionCommand.cs" />
<Compile Include="Src\Commands\SurroundWithCommand.cs" />
<Compile Include="Src\CustomCommands.cs" />
<Compile Include="Src\CustomizableHighlightingColorizer.cs" />
<Compile Include="Src\CustomizedHighlightingColor.cs" />
<Compile Include="Src\DocumentPrinter.cs" />
<Compile Include="Src\IncrementalSearch.cs" />
<Compile Include="Src\InlineUIElementGenerator.cs" />
<Compile Include="Src\IconBarManager.cs" />
<Compile Include="Src\IconBarMargin.cs" />
<Compile Include="Src\Options\BehaviorOptions.xaml.cs">
<DependentUpon>BehaviorOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\Converters.cs" />
<Compile Include="Src\Options\CustomizedHighlightingItem.cs" />
<Compile Include="Src\Options\GeneralEditorOptions.xaml.cs">
<DependentUpon>GeneralEditorOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\CodeEditorOptions.cs" />
<Compile Include="Src\Options\HighlightingOptions.xaml.cs">
<DependentUpon>HighlightingOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\IHighlightingItem.cs" />
<Compile Include="Src\Options\NamedColorHighlightingItem.cs" />
<Compile Include="Src\Options\SimpleHighlightingItem.cs" />
<Compile Include="Src\Options\TextViewOptions.xaml.cs">
<DependentUpon>TextViewOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\PrintPreviewViewContent.cs" />
<Compile Include="Src\Snippets\AnchorSnippetElementProvider.cs" />
<Compile Include="Src\Snippets\CodeSnippet.cs" />
<Compile Include="Src\Snippets\CodeSnippetCompletionWindow.cs" />
<Compile Include="Src\Snippets\CodeSnippetGroup.cs" />
<Compile Include="Src\Snippets\DefaultSnippetElementProvider.cs" />
<Compile Include="Src\Snippets\SnippetCompletionItem.cs" />
<Compile Include="Src\Snippets\SnippetManager.cs" />
<Compile Include="Src\Snippets\SnippetOptionPanel.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\ParserFoldingStrategy.cs" />
<Compile Include="Src\QuickClassBrowser.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\SharpDevelopCompletionWindow.cs" />
<Compile Include="Src\SharpDevelopInsightWindow.cs">
</Compile>
<Compile Include="Src\StringToVisibilityConverter.cs" />
<Compile Include="Src\SyntaxModeDoozer.cs" />
<Compile Include="Src\TextMarkerService.cs" />
<EmbeddedResource Include="Resources\IncrementalSearchCursor.cur" />
<EmbeddedResource Include="Resources\ReverseIncrementalSearchCursor.cur" />
</ItemGroup>
<ItemGroup>
<Page Include="Src\SharpDevelopCompletionWindow.xaml">
<DependentUpon>SharpDevelopCompletionWindow.cs</DependentUpon>
</Page>
<Page Include="themes\generic.xaml" />
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<Page Include="Src\ChooseEncodingDialog.xaml" />
<Page Include="Src\Commands\SortOptionsDialog.xaml" />
<Page Include="Src\Options\BehaviorOptions.xaml" />
<Page Include="Src\Options\GeneralEditorOptions.xaml" />
<Page Include="Src\Options\HighlightingOptions.xaml" />
<Page Include="Src\Options\TextViewOptions.xaml" />
<Page Include="Src\Snippets\SnippetOptionPanel.xaml">
<DependentUpon>SnippetOptionPanel.cs</DependentUpon>
</Page>
<Page Include="Src\QuickClassBrowser.xaml">
<DependentUpon>QuickClassBrowser.cs</DependentUpon>
</Page>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Src\MyersDiff" />
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{0162E499-42D0-409B-AA25-EED21F75336B}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.AvalonEdit.AddIn</RootNamespace>
<AssemblyName>ICSharpCode.AvalonEdit.AddIn</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<OutputPath>..\..\..\..\AddIns\DisplayBindings\AvalonEdit\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunCodeAnalysis>False</RunCodeAnalysis>
<CodeAnalysisRules>-Microsoft.Design#CA1014;-Microsoft.Design#CA2210</CodeAnalysisRules>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="ReachFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Printing">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsFormsIntegration">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="AvalonEdit.AddIn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AvalonEditDisplayBinding.cs" />
<Compile Include="Src\AvalonEditEditorUIService.cs" />
<Compile Include="Src\AvalonEditorControlService.cs" />
<Compile Include="Src\AvalonEditViewContent.cs" />
<Compile Include="Src\BracketHighlightRenderer.cs" />
<Compile Include="Src\CaretReferencesRenderer.cs" />
<Compile Include="Src\ChangeMarkerMargin.cs" />
<Compile Include="Src\ChooseEncodingDialog.xaml.cs">
<DependentUpon>ChooseEncodingDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\CodeCompletionEditorAdapter.cs" />
<Compile Include="Src\CodeEditor.cs" />
<Compile Include="Src\CodeEditorAdapter.cs" />
<Compile Include="Src\CodeEditorView.cs" />
<Compile Include="Src\ContextActionsRenderer.cs" />
<Compile Include="Src\DefaultChangeWatcher.cs" />
<Compile Include="Src\ExpressionHighlightRenderer.cs" />
<Compile Include="Src\CodeManipulation.cs" />
<Compile Include="Src\CaretHighlightAdorner.cs" />
<Compile Include="Src\HiddenDefinition\HiddenDefinitionControl.xaml.cs">
<DependentUpon>HiddenDefinitionControl.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\HiddenDefinition\HiddenDefinitionRenderer.cs" />
<Compile Include="Src\LineChangeInfo.cs" />
<Compile Include="Src\MyersDiff\DocumentSequence.cs" />
<Compile Include="Src\MyersDiff\Edit.cs" />
<Compile Include="Src\MyersDiff\ISequence.cs" />
<Compile Include="Src\MyersDiff\MyersDiff.cs" />
<Compile Include="Src\MyersDiff\StringSequence.cs" />
<Compile Include="Src\MyersDiff\Utils.cs" />
<Compile Include="Src\NewLineConsistencyCheck.cs" />
<Compile Include="Src\SharpDevelopTextEditor.cs" />
<Compile Include="Src\Commands\FoldingCommands.cs" />
<Compile Include="Src\Commands\RunIncrementalSearch.cs" />
<Compile Include="Src\Commands\SaveFileWithEncoding.cs" />
<Compile Include="Src\Commands\SortOptionsDialog.xaml.cs">
<DependentUpon>SortOptionsDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Commands\SortSelectionCommand.cs" />
<Compile Include="Src\Commands\SurroundWithCommand.cs" />
<Compile Include="Src\CustomCommands.cs" />
<Compile Include="Src\CustomizableHighlightingColorizer.cs" />
<Compile Include="Src\CustomizedHighlightingColor.cs" />
<Compile Include="Src\DocumentPrinter.cs" />
<Compile Include="Src\IncrementalSearch.cs" />
<Compile Include="Src\InlineUIElementGenerator.cs" />
<Compile Include="Src\IconBarManager.cs" />
<Compile Include="Src\IconBarMargin.cs" />
<Compile Include="Src\Options\BehaviorOptions.xaml.cs">
<DependentUpon>BehaviorOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\Converters.cs" />
<Compile Include="Src\Options\CustomizedHighlightingItem.cs" />
<Compile Include="Src\Options\GeneralEditorOptions.xaml.cs">
<DependentUpon>GeneralEditorOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\CodeEditorOptions.cs" />
<Compile Include="Src\Options\HighlightingOptions.xaml.cs">
<DependentUpon>HighlightingOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Options\IHighlightingItem.cs" />
<Compile Include="Src\Options\NamedColorHighlightingItem.cs" />
<Compile Include="Src\Options\SimpleHighlightingItem.cs" />
<Compile Include="Src\Options\TextViewOptions.xaml.cs">
<DependentUpon>TextViewOptions.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\PrintPreviewViewContent.cs" />
<Compile Include="Src\Snippets\AnchorSnippetElementProvider.cs" />
<Compile Include="Src\Snippets\CodeSnippet.cs" />
<Compile Include="Src\Snippets\CodeSnippetCompletionWindow.cs" />
<Compile Include="Src\Snippets\CodeSnippetGroup.cs" />
<Compile Include="Src\Snippets\DefaultSnippetElementProvider.cs" />
<Compile Include="Src\Snippets\SnippetCompletionItem.cs" />
<Compile Include="Src\Snippets\SnippetManager.cs" />
<Compile Include="Src\Snippets\SnippetOptionPanel.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\ParserFoldingStrategy.cs" />
<Compile Include="Src\QuickClassBrowser.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\SharpDevelopCompletionWindow.cs" />
<Compile Include="Src\SharpDevelopInsightWindow.cs">
</Compile>
<Compile Include="Src\StringToVisibilityConverter.cs" />
<Compile Include="Src\SyntaxModeDoozer.cs" />
<Compile Include="Src\TextMarkerService.cs" />
<EmbeddedResource Include="Resources\IncrementalSearchCursor.cur" />
<EmbeddedResource Include="Resources\ReverseIncrementalSearchCursor.cur" />
</ItemGroup>
<ItemGroup>
<Page Include="Src\HiddenDefinition\HiddenDefinitionControl.xaml" />
<Page Include="Src\SharpDevelopCompletionWindow.xaml">
<DependentUpon>SharpDevelopCompletionWindow.cs</DependentUpon>
</Page>
<Page Include="themes\generic.xaml" />
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj">
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project>
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<Page Include="Src\ChooseEncodingDialog.xaml" />
<Page Include="Src\Commands\SortOptionsDialog.xaml" />
<Page Include="Src\Options\BehaviorOptions.xaml" />
<Page Include="Src\Options\GeneralEditorOptions.xaml" />
<Page Include="Src\Options\HighlightingOptions.xaml" />
<Page Include="Src\Options\TextViewOptions.xaml" />
<Page Include="Src\Snippets\SnippetOptionPanel.xaml">
<DependentUpon>SnippetOptionPanel.cs</DependentUpon>
</Page>
<Page Include="Src\QuickClassBrowser.xaml">
<DependentUpon>QuickClassBrowser.cs</DependentUpon>
</Page>
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Src\MyersDiff" />
<Folder Include="Src\HiddenDefinition" />
</ItemGroup>
</Project>

10
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -44,6 +44,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -44,6 +44,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
BracketHighlightRenderer bracketRenderer;
CaretReferencesRenderer caretReferencesRenderer;
ContextActionsRenderer contextActionsRenderer;
HiddenDefinition.HiddenDefinitionRenderer hiddenDefinitionRenderer;
public CodeEditorView()
{
@ -52,6 +53,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -52,6 +53,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
this.bracketRenderer = new BracketHighlightRenderer(this.TextArea.TextView);
this.caretReferencesRenderer = new CaretReferencesRenderer(this);
this.contextActionsRenderer = new ContextActionsRenderer(this);
this.hiddenDefinitionRenderer = new HiddenDefinition.HiddenDefinitionRenderer(this);
UpdateCustomizedHighlighting();
@ -75,6 +77,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -75,6 +77,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
public virtual void Dispose()
{
contextActionsRenderer.Dispose();
hiddenDefinitionRenderer.Dispose();
}
protected override string FileName {
@ -110,6 +113,13 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -110,6 +113,13 @@ namespace ICSharpCode.AvalonEdit.AddIn
if (this.Adapter.Language != null) {
var bracketSearchResult = this.Adapter.Language.BracketSearcher.SearchBracket(this.Adapter.Document, this.TextArea.Caret.Offset);
this.bracketRenderer.SetHighlight(bracketSearchResult);
if (CodeEditorOptions.Instance.ShowHiddenDefinitions) {
this.hiddenDefinitionRenderer.BracketSearchResult = bracketSearchResult;
this.hiddenDefinitionRenderer.Show();
} else {
this.hiddenDefinitionRenderer.ClosePopup();
}
}
} else {
this.bracketRenderer.SetHighlight(null);

12
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionControl.xaml

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="ICSharpCode.AvalonEdit.AddIn.HiddenDefinition.HiddenDefinitionControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.Options"
Background="#FFFFE7">
<Border BorderBrush="Black"
BorderThickness="1"
Background="Transparent">
<StackPanel Background="Transparent">
<TextBlock x:Name="DefinitionTextBlock"/>
</StackPanel>
</Border>
</UserControl>

27
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionControl.xaml.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
// 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 System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.AddIn.Options;
namespace ICSharpCode.AvalonEdit.AddIn.HiddenDefinition
{
public partial class HiddenDefinitionControl : UserControl
{
public HiddenDefinitionControl()
{
InitializeComponent();
DefinitionTextBlock.FontFamily = new FontFamily(CodeEditorOptions.Instance.FontFamily);
DefinitionTextBlock.FontSize = CodeEditorOptions.Instance.FontSize;
}
public string DefinitionText {
get { return this.DefinitionTextBlock.Text; }
set { this.DefinitionTextBlock.Text = value; }
}
}
}

91
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/HiddenDefinition/HiddenDefinitionRenderer.cs

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
// 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 System.ComponentModel.Design;
using System.Linq;
using System.Windows.Controls.Primitives;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.Core.Presentation;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.AvalonEdit.AddIn.HiddenDefinition
{
public class HiddenDefinitionRenderer : IDisposable
{
private CodeEditorView editor;
private ExtendedPopup popup = new ExtendedPopup();
private HiddenDefinitionControl control;
public HiddenDefinitionRenderer(CodeEditorView editorView)
{
this.editor = editorView;
control = new HiddenDefinitionControl();
WorkbenchSingleton.Workbench.ActiveContentChanged += WorkbenchSingleton_Workbench_ActiveContentChanged;
}
public BracketSearchResult BracketSearchResult { get; set; }
public void Dispose()
{
WorkbenchSingleton.Workbench.ActiveContentChanged -= WorkbenchSingleton_Workbench_ActiveContentChanged;
ClosePopup();
popup = null;
}
public void ClosePopup()
{
if (popup.IsOpen)
popup.IsOpen = false;
}
public void Show()
{
ClosePopup();
if (BracketSearchResult == null || BracketSearchResult.OpeningBracket != "{") return;
var line = GetLineText(BracketSearchResult.OpeningBracketOffset);
if(line == null) return;
control.DefinitionText = line;
popup.Child = control;
popup.HorizontalOffset = 70;
popup.Placement = PlacementMode.Relative;
popup.PlacementTarget = editor.TextArea;
popup.IsOpen = true;
}
private string GetLineText(int offset)
{
// get folding manager
var container = this.editor.Adapter.GetService(typeof(IServiceContainer)) as IServiceContainer;
if (container == null) return null;
var folding = container.GetService(typeof(ParserFoldingStrategy)) as ParserFoldingStrategy;
if (folding == null) return null;
// get folding
var f = folding.FoldingManager.GetFoldingsContaining(offset).LastOrDefault();
if (f == null) return null;
// get line
var line = editor.Document.GetLineByOffset(f.StartOffset);
if (line == null || line.IsDeleted) return null;
// check whether the line is visible
int off = line.Offset;
if (editor.TextArea.TextView.VisualLines[0].StartOffset > off) {
return this.editor.TextArea.TextView.Document.GetText(off, line.Length);
}
return null;
}
private void WorkbenchSingleton_Workbench_ActiveContentChanged(object sender, EventArgs e)
{
ClosePopup();
}
}
}

13
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/CodeEditorOptions.cs

@ -196,6 +196,19 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options @@ -196,6 +196,19 @@ namespace ICSharpCode.AvalonEdit.AddIn.Options
}
}
bool showHiddenDefinitions = false;
[DefaultValue(false)]
public bool ShowHiddenDefinitions {
get { return showHiddenDefinitions; }
set {
if (showHiddenDefinitions != value) {
showHiddenDefinitions = value;
OnPropertyChanged("ShowHiddenDefinitions");
}
}
}
public void BindToTextEditor(TextEditor editor)
{
editor.Options = this;

3
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/Options/GeneralEditorOptions.xaml

@ -23,6 +23,9 @@ @@ -23,6 +23,9 @@
<CheckBox
IsChecked="{core:OptionBinding local:CodeEditorOptions.ShowLineNumbers}"
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.LineNumberCheckBox}" />
<CheckBox
IsChecked="{core:OptionBinding local:CodeEditorOptions.ShowHiddenDefinitions}"
Content="{core:Localize Dialog.Options.IDEOptions.TextEditor.Markers.ShowHiddenDefinitionsCheckBox}" />
</widgets:StackPanelWithSpacing>
</GroupBox>
</StackPanel>

111
src/Main/Base/Project/Src/Editor/IBracketSearcher.cs

@ -1,52 +1,59 @@ @@ -1,52 +1,59 @@
// 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;
namespace ICSharpCode.SharpDevelop.Editor
{
/// <summary>
/// Allows language specific search for matching brackets.
/// </summary>
public interface IBracketSearcher
{
/// <summary>
/// Searches for a matching bracket from the given offset to the start of the document.
/// </summary>
/// <returns>A BracketSearchResult that contains the positions and lengths of the brackets. Return null if there is nothing to highlight.</returns>
BracketSearchResult SearchBracket(IDocument document, int offset);
}
public class DefaultBracketSearcher : IBracketSearcher
{
public static readonly DefaultBracketSearcher DefaultInstance = new DefaultBracketSearcher();
public BracketSearchResult SearchBracket(IDocument document, int offset)
{
return null;
}
}
/// <summary>
/// Describes a pair of matching brackets found by IBracketSearcher.
/// </summary>
public class BracketSearchResult
{
public int OpeningBracketOffset { get; private set; }
public int OpeningBracketLength { get; private set; }
public int ClosingBracketOffset { get; private set; }
public int ClosingBracketLength { get; private set; }
public BracketSearchResult(int openingBracketOffset, int openingBracketLength,
int closingBracketOffset, int closingBracketLength)
{
this.OpeningBracketOffset = openingBracketOffset;
this.OpeningBracketLength = openingBracketLength;
this.ClosingBracketOffset = closingBracketOffset;
this.ClosingBracketLength = closingBracketLength;
}
}
}
// 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;
namespace ICSharpCode.SharpDevelop.Editor
{
/// <summary>
/// Allows language specific search for matching brackets.
/// </summary>
public interface IBracketSearcher
{
/// <summary>
/// Searches for a matching bracket from the given offset to the start of the document.
/// </summary>
/// <returns>A BracketSearchResult that contains the positions and lengths of the brackets. Return null if there is nothing to highlight.</returns>
BracketSearchResult SearchBracket(IDocument document, int offset);
}
public class DefaultBracketSearcher : IBracketSearcher
{
public static readonly DefaultBracketSearcher DefaultInstance = new DefaultBracketSearcher();
public BracketSearchResult SearchBracket(IDocument document, int offset)
{
return null;
}
}
/// <summary>
/// Describes a pair of matching brackets found by IBracketSearcher.
/// </summary>
public class BracketSearchResult
{
public int OpeningBracketOffset { get; private set; }
public int OpeningBracketLength { get; private set; }
public int ClosingBracketOffset { get; private set; }
public int ClosingBracketLength { get; private set; }
public string OpeningBracket { get; private set; }
public string ClosingBracket { get; private set; }
public BracketSearchResult(int openingBracketOffset, int openingBracketLength,
int closingBracketOffset, int closingBracketLength,
string openingBracket = null, string closingBracket = null)
{
this.OpeningBracketOffset = openingBracketOffset;
this.OpeningBracketLength = openingBracketLength;
this.ClosingBracketOffset = closingBracketOffset;
this.ClosingBracketLength = closingBracketLength;
this.OpeningBracket = openingBracket;
this.ClosingBracket = closingBracket;
}
}
}

Loading…
Cancel
Save