Изменено формирование деталировки: зависимость от строк, а не от родителя
All checks were successful
CI / build-test (push) Successful in 38s
Release / pack-and-publish (release) Successful in 35s

This commit is contained in:
FrigaT
2025-12-29 01:10:17 +03:00
parent 19c2357c04
commit 7fb11364c4
10 changed files with 37 additions and 16 deletions

View File

@@ -83,8 +83,12 @@ public abstract class BaseRuleVisitor : TSqlFragmentVisitor, IRule
return string.Format(this.Text, param);
}
private TSqlFragment? FindContextBlock(TSqlFragment node)
{
if (_parents == null) return null;
return node;
var current = node;
while (current != null)
@@ -139,7 +143,6 @@ public abstract class BaseRuleVisitor : TSqlFragmentVisitor, IRule
}
// Вспомогательные классы
public class ExtractedBlock
{
@@ -165,13 +168,13 @@ public abstract class BaseRuleVisitor : TSqlFragmentVisitor, IRule
protected ExtractedBlock? ExtractBlock(TSqlFragment? node, TSqlFragment errorNode)
{
if (node == null || node.ScriptTokenStream == null)
if (node == null || errorNode.ScriptTokenStream == null)
return null;
var endLine = node.ScriptTokenStream.Where(t => t.Offset < node.StartOffset + node.FragmentLength).Max(t => t.Line) + 2;
var endLine = errorNode.ScriptTokenStream.Where(t => t.Offset < node.StartOffset + node.FragmentLength).Max(t => t.Line) + 2;
// 1. Получаем токены для блока
var tokens = node.ScriptTokenStream
var tokens = errorNode.ScriptTokenStream
.Where(t => t.Line >= node.StartLine - 2 &&
t.Line <= endLine)
.ToList();