Implemented folding of #regions, usings and comments.
This commit is contained in:
Родитель
b739eb3daa
Коммит
dbefda9caf
|
@ -1,30 +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 System.Collections.Generic;
|
||||
using ICSharpCode.AvalonEdit.Document;
|
||||
|
||||
namespace ICSharpCode.AvalonEdit.Folding
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for folding strategies.
|
||||
/// </summary>
|
||||
public abstract class AbstractFoldingStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Create <see cref="NewFolding"/>s for the specified document and updates the folding manager with them.
|
||||
/// </summary>
|
||||
public void UpdateFoldings(FoldingManager manager, TextDocument document)
|
||||
{
|
||||
int firstErrorOffset;
|
||||
IEnumerable<NewFolding> foldings = CreateNewFoldings(document, out firstErrorOffset);
|
||||
manager.UpdateFoldings(foldings, firstErrorOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create <see cref="NewFolding"/>s for the specified document.
|
||||
/// </summary>
|
||||
public abstract IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset);
|
||||
}
|
||||
}
|
|
@ -31,6 +31,12 @@ namespace ICSharpCode.AvalonEdit.Folding
|
|||
/// </summary>
|
||||
public bool DefaultClosed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets whether the folding is considered to be a definition.
|
||||
/// This has an effect on the 'Show Definitions only' command.
|
||||
/// </summary>
|
||||
public bool IsDefinition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new NewFolding instance.
|
||||
/// </summary>
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ICSharpCode.AvalonEdit.Folding
|
|||
/// <summary>
|
||||
/// Determines folds for an xml string in the editor.
|
||||
/// </summary>
|
||||
public class XmlFoldingStrategy : AbstractFoldingStrategy
|
||||
public class XmlFoldingStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Flag indicating whether attributes should be displayed on folded
|
||||
|
@ -30,10 +30,20 @@ namespace ICSharpCode.AvalonEdit.Folding
|
|||
/// </summary>
|
||||
public bool ShowAttributesWhenFolded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create <see cref="NewFolding"/>s for the specified document and updates the folding manager with them.
|
||||
/// </summary>
|
||||
public void UpdateFoldings(FoldingManager manager, TextDocument document)
|
||||
{
|
||||
int firstErrorOffset;
|
||||
IEnumerable<NewFolding> foldings = CreateNewFoldings(document, out firstErrorOffset);
|
||||
manager.UpdateFoldings(foldings, firstErrorOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create <see cref="NewFolding"/>s for the specified document.
|
||||
/// </summary>
|
||||
public override IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
|
||||
public IEnumerable<NewFolding> CreateNewFoldings(TextDocument document, out int firstErrorOffset)
|
||||
{
|
||||
try {
|
||||
XmlTextReader reader = new XmlTextReader(document.CreateReader());
|
||||
|
|
|
@ -150,7 +150,6 @@
|
|||
<Compile Include="Editing\ImeNativeWrapper.cs" />
|
||||
<Compile Include="Editing\SelectionSegment.cs" />
|
||||
<Compile Include="Editing\ImeSupport.cs" />
|
||||
<Compile Include="Folding\AbstractFoldingStrategy.cs" />
|
||||
<Compile Include="Folding\FoldingElementGenerator.cs" />
|
||||
<Compile Include="Folding\FoldingManager.cs" />
|
||||
<Compile Include="Folding\FoldingMargin.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче