Изменено формирование деталировки: зависимость от строк, а не от родителя
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user