search set line position of selected file
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace SharpIDE.Application.Features.Analysis;
|
||||
|
||||
public struct SharpIdeFileLinePosition
|
||||
{
|
||||
public required int Line { get; set; }
|
||||
public required int Column { get; set; }
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public static class AsyncEventExtensions
|
||||
{
|
||||
public static void InvokeParallelFireAndForget(this MulticastDelegate @event) => FireAndForget(() => @event.InvokeParallelAsync());
|
||||
public static void InvokeParallelFireAndForget<T>(this MulticastDelegate @event, T arg) => FireAndForget(() => @event.InvokeParallelAsync(arg));
|
||||
public static void InvokeParallelFireAndForget<T, U>(this MulticastDelegate @event, T arg, U arg2) => FireAndForget(() => @event.InvokeParallelAsync(arg, arg2));
|
||||
|
||||
private static async void FireAndForget(Func<Task> action)
|
||||
{
|
||||
@@ -53,6 +54,10 @@ public static class AsyncEventExtensions
|
||||
{
|
||||
return InvokeDelegatesAsync(@event.GetInvocationList(), del => ((Func<T, Task>)del)(arg));
|
||||
}
|
||||
public static Task InvokeParallelAsync<T, U>(this MulticastDelegate @event, T arg, U arg2)
|
||||
{
|
||||
return InvokeDelegatesAsync(@event.GetInvocationList(), del => ((Func<T, U, Task>)del)(arg, arg2));
|
||||
}
|
||||
|
||||
private static async Task InvokeDelegatesAsync(IEnumerable<Delegate> invocationList, Func<Delegate, Task> delegateExecutorDelegate)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace SharpIDE.Application.Features.Search;
|
||||
public class SearchResult
|
||||
{
|
||||
public required SharpIdeFile File { get; set; }
|
||||
public required int LineNumber { get; set; }
|
||||
public required int Line { get; set; }
|
||||
public required int StartColumn { get; set; }
|
||||
public required string LineText { get; set; }
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ public static class SearchService
|
||||
results.Add(new SearchResult
|
||||
{
|
||||
File = file,
|
||||
LineNumber = index + 1,
|
||||
Line = index + 1,
|
||||
StartColumn = line.IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase) + 1,
|
||||
LineText = line.Trim()
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user