...
This commit is contained in:
@@ -1,9 +1,26 @@
|
||||
using NubLang.Ast;
|
||||
using NubLang.Syntax;
|
||||
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
|
||||
using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range;
|
||||
|
||||
namespace NubLang.LSP;
|
||||
|
||||
public static class AstExtensions
|
||||
{
|
||||
public static Location ToLocation(this Node node)
|
||||
{
|
||||
if (node.Tokens.Count == 0)
|
||||
{
|
||||
return new Location();
|
||||
}
|
||||
|
||||
return new Location
|
||||
{
|
||||
Uri = node.Tokens.First().Span.FilePath,
|
||||
Range = new Range(node.Tokens.First().Span.Start.Line - 1, node.Tokens.First().Span.Start.Column - 1, node.Tokens.Last().Span.End.Line - 1, node.Tokens.Last().Span.End.Column - 1)
|
||||
};
|
||||
}
|
||||
|
||||
public static bool ContainsPosition(this Node node, int line, int character)
|
||||
{
|
||||
if (node.Tokens.Count == 0)
|
||||
|
||||
Reference in New Issue
Block a user