remove project
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace SharpIDE.Application.Features.Analysis.Razor;
|
||||
|
||||
public record struct SharpIdeRazorClassifiedSpan(SharpIdeRazorSourceSpan Span, SharpIdeRazorSpanKind Kind, string? CodeClassificationType = null, string? VsSemanticRangeType = null);
|
||||
|
||||
public enum SharpIdeRazorSpanKind
|
||||
{
|
||||
Transition,
|
||||
MetaCode,
|
||||
Comment,
|
||||
Code,
|
||||
Markup,
|
||||
None,
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace SharpIDE.Application.Features.Analysis.Razor;
|
||||
|
||||
public sealed class SharpIdeRazorSourceMapping(
|
||||
SharpIdeRazorSourceSpan originalSpan,
|
||||
SharpIdeRazorSourceSpan generatedSpan)
|
||||
: IEquatable<SharpIdeRazorSourceMapping>
|
||||
{
|
||||
public SharpIdeRazorSourceSpan OriginalSpan { get; } = originalSpan;
|
||||
|
||||
public SharpIdeRazorSourceSpan GeneratedSpan { get; } = generatedSpan;
|
||||
|
||||
public override bool Equals(object? obj) => Equals(obj as SourceMapping);
|
||||
|
||||
public bool Equals(SharpIdeRazorSourceMapping? other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
var sourceSpan = OriginalSpan;
|
||||
if (!sourceSpan.Equals(other.OriginalSpan))
|
||||
return false;
|
||||
sourceSpan = GeneratedSpan;
|
||||
return sourceSpan.Equals(other.GeneratedSpan);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
HashCodeCombiner hashCode = HashCodeCombiner.Start();
|
||||
hashCode.Add(OriginalSpan);
|
||||
hashCode.Add(GeneratedSpan);
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, "{0} -> {1}", OriginalSpan, GeneratedSpan);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SharpIdeRazorSourceMappingExtensions
|
||||
{
|
||||
public static SharpIdeRazorSourceMapping ToSharpIdeSourceMapping(this SourceMapping mapping)
|
||||
{
|
||||
return new SharpIdeRazorSourceMapping(mapping.OriginalSpan.ToSharpIdeSourceSpan(), mapping.GeneratedSpan.ToSharpIdeSourceSpan());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.CodeAnalysis.Text;
|
||||
using Microsoft.Extensions.Internal;
|
||||
|
||||
namespace SharpIDE.Application.Features.Analysis.Razor;
|
||||
|
||||
public readonly struct SharpIdeRazorSourceSpan(
|
||||
string filePath,
|
||||
int absoluteIndex,
|
||||
int lineIndex,
|
||||
int characterIndex,
|
||||
int length,
|
||||
int lineCount,
|
||||
int endCharacterIndex)
|
||||
: IEquatable<SharpIdeRazorSourceSpan>
|
||||
{
|
||||
public int Length { get; } = length;
|
||||
public int AbsoluteIndex { get; } = absoluteIndex;
|
||||
public int LineIndex { get; } = lineIndex;
|
||||
public int CharacterIndex { get; } = characterIndex;
|
||||
public int LineCount { get; } = lineCount;
|
||||
public int EndCharacterIndex { get; } = endCharacterIndex;
|
||||
|
||||
public string FilePath { get; } = filePath;
|
||||
|
||||
public bool Equals(SharpIdeRazorSourceSpan other)
|
||||
{
|
||||
return string.Equals(FilePath, other.FilePath, StringComparison.Ordinal) && this.AbsoluteIndex == other.AbsoluteIndex && this.LineIndex == other.LineIndex && this.CharacterIndex == other.CharacterIndex && this.Length == other.Length;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj) => obj is SharpIdeRazorSourceSpan other && Equals(other);
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
var hashCode = HashCodeCombiner.Start();
|
||||
hashCode.Add(FilePath, StringComparer.Ordinal);
|
||||
hashCode.Add(AbsoluteIndex);
|
||||
hashCode.Add(LineIndex);
|
||||
hashCode.Add(CharacterIndex);
|
||||
hashCode.Add(Length);
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
"({0}:{1},{2} [{3}] {4})",
|
||||
this.AbsoluteIndex,
|
||||
this.LineIndex,
|
||||
this.CharacterIndex,
|
||||
this.Length,
|
||||
this.FilePath
|
||||
);
|
||||
}
|
||||
public static bool operator ==(SharpIdeRazorSourceSpan left, SharpIdeRazorSourceSpan right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(SharpIdeRazorSourceSpan left, SharpIdeRazorSourceSpan right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SharpIdeRazorSourceSpanExtensions
|
||||
{
|
||||
public static TextSpan AsTextSpan(this SharpIdeRazorSourceSpan sourceSpan)
|
||||
{
|
||||
return new TextSpan(sourceSpan.AbsoluteIndex, sourceSpan.Length);
|
||||
}
|
||||
public static SharpIdeRazorSourceSpan ToSharpIdeSourceSpan(this SourceSpan span)
|
||||
=> new SharpIdeRazorSourceSpan(
|
||||
span.FilePath,
|
||||
span.AbsoluteIndex,
|
||||
span.LineIndex,
|
||||
span.CharacterIndex,
|
||||
span.Length,
|
||||
span.LineCount,
|
||||
span.EndCharacterIndex);
|
||||
}
|
||||
@@ -32,7 +32,6 @@ using SharpIDE.Application.Features.Analysis.Razor;
|
||||
using SharpIDE.Application.Features.Build;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
using SharpIDE.RazorAccess;
|
||||
using CodeAction = Microsoft.CodeAnalysis.CodeActions.CodeAction;
|
||||
using CompletionItem = Microsoft.CodeAnalysis.Completion.CompletionItem;
|
||||
using CompletionList = Microsoft.CodeAnalysis.Completion.CompletionList;
|
||||
|
||||
Reference in New Issue
Block a user