20 changed files with 150 additions and 111 deletions
@ -1,53 +1,53 @@
@@ -1,53 +1,53 @@
|
||||
// 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.NRefactory.Editor; |
||||
|
||||
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; |
||||
using ICSharpCode.NRefactory.Editor; |
||||
|
||||
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; |
||||
} |
||||
} |
||||
} |
@ -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 System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Editor |
||||
{ |
||||
/// <summary>
|
||||
/// Provides the BASE-version for a given file - the original unmodified
|
||||
/// copy from the last commit.
|
||||
/// This interface is implemented by the version control AddIns.
|
||||
/// </summary>
|
||||
public interface IDocumentVersionProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Provides the BASE-Version for a file. This can be either the file saved
|
||||
/// to disk or a base version provided by any VCS.
|
||||
/// </summary>
|
||||
Stream OpenBaseVersion(string fileName); |
||||
|
||||
/// <summary>
|
||||
/// Starts watching for changes to the BASE-version of the specified file.
|
||||
/// The callback delegate gets called whenever the BASE-version has changed.
|
||||
/// </summary>
|
||||
/// <returns>Returns a disposable that can be used to stop watching for changes.
|
||||
/// You must dispose the disposable to prevent a memory leak, the GC will
|
||||
/// not help out in this case!</returns>
|
||||
IDisposable WatchBaseVersionChanges(string fileName, EventHandler callback); |
||||
} |
||||
|
||||
public class VersioningServices |
||||
{ |
||||
public static readonly VersioningServices Instance = new VersioningServices(); |
||||
|
||||
List<IDocumentVersionProvider> baseVersionProviders; |
||||
|
||||
public List<IDocumentVersionProvider> DocumentVersionProviders { |
||||
get { |
||||
if (baseVersionProviders == null) |
||||
baseVersionProviders = AddInTree.BuildItems<IDocumentVersionProvider>("/Workspace/DocumentVersionProviders", this, false); |
||||
|
||||
return baseVersionProviders; |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue