388 changed files with 1309 additions and 1689 deletions
@ -1,3 +0,0 @@
@@ -1,3 +0,0 @@
|
||||
|
||||
bin/ |
||||
obj/ |
@ -1,74 +0,0 @@
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{F054A788-B591-4561-A8BA-AE745BBEB817}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.Editor</RootNamespace> |
||||
<AssemblyName>ICSharpCode.Editor</AssemblyName> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||
<SignAssembly>True</SignAssembly> |
||||
<DelaySign>False</DelaySign> |
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> |
||||
<DocumentationFile>bin\Debug\ICSharpCode.Editor.xml</DocumentationFile> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<AssemblyOriginatorKeyFile>..\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile> |
||||
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<OutputPath>bin\Debug\</OutputPath> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<StartAction>Project</StartAction> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<OutputPath>bin\Release\</OutputPath> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="IDocument.cs" /> |
||||
<Compile Include="IDocumentLine.cs" /> |
||||
<Compile Include="ISegment.cs" /> |
||||
<Compile Include="ITextEditor.cs" /> |
||||
<Compile Include="ITextSource.cs" /> |
||||
<Compile Include="LinkedElement.cs" /> |
||||
<Compile Include="ReadOnlyDocument.cs" /> |
||||
<Compile Include="StringTextSource.cs" /> |
||||
<Compile Include="TextLocation.cs" /> |
||||
<Compile Include="ITextAnchor.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
<Compile Include="TextChangeEventArgs.cs" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
</Project> |
@ -1,117 +0,0 @@
@@ -1,117 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
||||
|
||||
namespace ICSharpCode.Editor |
||||
{ |
||||
/* |
||||
/// <summary>
|
||||
/// Interface for text editors.
|
||||
/// </summary>
|
||||
public interface ITextEditor : IServiceProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Gets the document that is being edited.
|
||||
/// </summary>
|
||||
IDocument Document { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets an object that represents the caret inside this text editor.
|
||||
/// </summary>
|
||||
ITextEditorCaret Caret { get; } |
||||
|
||||
/// <summary>
|
||||
/// Sets the caret to the specified line/column and brings the caret into view.
|
||||
/// </summary>
|
||||
void JumpTo(int line, int column); |
||||
|
||||
/// <summary>
|
||||
/// Gets the start offset of the selection.
|
||||
/// </summary>
|
||||
int SelectionStart { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the length of the selection.
|
||||
/// </summary>
|
||||
int SelectionLength { get; } |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the selected text.
|
||||
/// </summary>
|
||||
string SelectedText { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Sets the selection.
|
||||
/// </summary>
|
||||
/// <param name="selectionStart">Start offset of the selection</param>
|
||||
/// <param name="selectionLength">Length of the selection</param>
|
||||
void Select(int selectionStart, int selectionLength); |
||||
|
||||
/// <summary>
|
||||
/// Shows the specified linked elements, and allows the user to edit them.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Returns true when the user has finished editing the elements and pressed Return;
|
||||
/// or false when editing is aborted for any reason.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// The user can also edit other parts of the document (or other documents) while in link mode.
|
||||
/// In case of success (true return value), this method will update the offsets of the linked elements
|
||||
/// to reflect the changes done by the user.
|
||||
/// If the text editor does not support link mode, it will immediately return false.
|
||||
/// </remarks>
|
||||
// Task<bool> ShowLinkedElements(IEnumerable<LinkedElement> linkedElements);
|
||||
} |
||||
*/ |
||||
|
||||
/// <summary>
|
||||
/// Represents the caret in a text editor.
|
||||
/// </summary>
|
||||
public interface ITextEditorCaret |
||||
{ |
||||
/// <summary>
|
||||
/// Gets/Sets the caret offset;
|
||||
/// </summary>
|
||||
int Offset { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the caret line number.
|
||||
/// Line numbers are counted starting from 1.
|
||||
/// </summary>
|
||||
int Line { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the caret column number.
|
||||
/// Column numbers are counted starting from 1.
|
||||
/// </summary>
|
||||
int Column { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets/sets the caret location.
|
||||
/// </summary>
|
||||
TextLocation Location { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Is raised whenever the location of the caret has changed.
|
||||
/// </summary>
|
||||
event EventHandler LocationChanged; |
||||
} |
||||
} |
@ -1,83 +0,0 @@
@@ -1,83 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.Editor |
||||
{ |
||||
// I'm not sure if we need this.
|
||||
// How about a method in the context - this method could wrap the internal representation.
|
||||
// public void StartTextLinkMode (int linkLength, IEnumerable<int> offsets)
|
||||
// and maybe then variations taking more than one link element ?
|
||||
|
||||
// /// <summary>
|
||||
// /// Represents an element in the text editor that is either editable, or bound to another editable element.
|
||||
// /// Used with <see cref="ITextEditor.ShowLinkedElements"/>
|
||||
// /// </summary>
|
||||
// public class LinkedElement
|
||||
// {
|
||||
// LinkedElement boundTo;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets/Sets the start offset of this linked element.
|
||||
// /// </summary>
|
||||
// public int StartOffset { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets/Sets the end offset of this linked element.
|
||||
// /// </summary>
|
||||
// public int EndOffset { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets the linked element to which this element is bound.
|
||||
// /// </summary>
|
||||
// public LinkedElement BoundTo {
|
||||
// get { return boundTo; }
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets whether this element is editable. Returns true if this element is not bound.
|
||||
// /// </summary>
|
||||
// public bool IsEditable {
|
||||
// get { return boundTo == null; }
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Creates a new editable element.
|
||||
// /// </summary>
|
||||
// public LinkedElement(int startOffset, int endOffset)
|
||||
// {
|
||||
// this.StartOffset = startOffset;
|
||||
// this.EndOffset = endOffset;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Creates a new element that is bound to <paramref name="boundTo"/>.
|
||||
// /// </summary>
|
||||
// public LinkedElement(int startOffset, int endOffset, LinkedElement boundTo)
|
||||
// {
|
||||
// if (boundTo == null)
|
||||
// throw new ArgumentNullException("boundTo");
|
||||
// this.StartOffset = startOffset;
|
||||
// this.EndOffset = endOffset;
|
||||
// while (boundTo.boundTo != null)
|
||||
// boundTo = boundTo.boundTo;
|
||||
// this.boundTo = boundTo;
|
||||
// }
|
||||
// }
|
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.PatternMatching; |
||||
|
||||
namespace ICSharpCode.NRefactory.CSharp |
||||
{ |
||||
/// <summary>
|
||||
/// Matches identifier expressions that have the same identifier as the referenced variable/type definition/method definition.
|
||||
/// </summary>
|
||||
public class IdentifierExpressionBackreference : Pattern |
||||
{ |
||||
readonly string referencedGroupName; |
||||
|
||||
public string ReferencedGroupName { |
||||
get { return referencedGroupName; } |
||||
} |
||||
|
||||
public IdentifierExpressionBackreference(string referencedGroupName) |
||||
{ |
||||
if (referencedGroupName == null) |
||||
throw new ArgumentNullException("referencedGroupName"); |
||||
this.referencedGroupName = referencedGroupName; |
||||
} |
||||
|
||||
public override bool DoMatch(INode other, Match match) |
||||
{ |
||||
CSharp.IdentifierExpression ident = other as CSharp.IdentifierExpression; |
||||
if (ident == null || ident.TypeArguments.Any()) |
||||
return false; |
||||
CSharp.AstNode referenced = (CSharp.AstNode)match.Get(referencedGroupName).Last(); |
||||
if (referenced == null) |
||||
return false; |
||||
return ident.Identifier == referenced.GetChildByRole(CSharp.AstNode.Roles.Identifier).Name; |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue