Skip to content

Commit 845de65

Browse files
committed
修改诊断描述和范围
1 parent 6c54895 commit 845de65

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

CodeService/src/FormatElement/AlignmentElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ void AlignmentElement::Diagnosis(DiagnosisContext& ctx, int position, FormatElem
3333
if (character != _alignmentPosition)
3434
{
3535
ctx.PushDiagnosis(format("'=' should align to character {}", _alignmentPosition),
36-
TextRange(nextOffset, nextOffset));
36+
TextRange(nextOffset, nextOffset + 1));
3737
}
3838
}

CodeService/src/FormatElement/IndentElement.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ void IndentElement::Diagnosis(DiagnosisContext& ctx, int position, FormatElement
3535
auto character = ctx.GetColumn(range.StartOffset);
3636
if (character != static_cast<int>(ctx.GetCurrentIndent()))
3737
{
38-
ctx.PushDiagnosis(format("Incorrect indentation {}", character),
39-
TextRange(range.StartOffset, range.StartOffset));
38+
auto line = ctx.GetLine(range.StartOffset);
39+
ctx.PushDiagnosis(format("incorrect indentation {}, here need {} indent",
40+
character, ctx.GetCurrentIndent()),
41+
LuaDiagnosisPosition(line, 0),
42+
LuaDiagnosisPosition(line, character)
43+
);
4044
}
4145
}
4246

CodeService/src/FormatElement/KeepBlankElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void KeepBlankElement::Diagnosis(DiagnosisContext& ctx, int position, FormatElem
3434
{
3535
if (nextOffset - lastOffset - 1 != _blank)
3636
{
37-
ctx.PushDiagnosis(format("must keep {} space", _blank), TextRange(lastOffset, nextOffset));
37+
ctx.PushDiagnosis(format("here need keep {} space", _blank), TextRange(lastOffset, nextOffset));
3838
}
3939
}
4040
}

CodeService/src/FormatElement/KeepElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void KeepElement::Diagnosis(DiagnosisContext& ctx, int position, FormatElement&
5454
{
5555
if (nextOffset - lastOffset - 1 != _keepBlank)
5656
{
57-
ctx.PushDiagnosis(format("must keep {} space", _keepBlank), TextRange(lastOffset, nextOffset));
57+
ctx.PushDiagnosis(format("here need keep {} space", _keepBlank), TextRange(lastOffset, nextOffset));
5858
}
5959
}
6060
}

CodeService/src/FormatElement/KeepLineElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void KeepLineElement::Diagnosis(DiagnosisContext& ctx, int position, FormatEleme
5252

5353
if (_line != (nextElementLine - lastElementLine - 1))
5454
{
55-
ctx.PushDiagnosis(format("need {} line", _line), TextRange(lastElementOffset, nextElementOffset));
55+
ctx.PushDiagnosis(format("here need keep {} line", _line), TextRange(lastElementOffset, nextElementOffset));
5656
}
5757
}
5858
}

CodeService/src/FormatElement/MinLineElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ void MinLineElement::Diagnosis(DiagnosisContext& ctx, int position, FormatElemen
5757

5858
if (_line > (nextElementLine - lastElementLine - 1))
5959
{
60-
ctx.PushDiagnosis(format("need at least {} line", _line), TextRange(lastOffset, nextOffset));
60+
ctx.PushDiagnosis(format("here need at least {} line", _line), TextRange(lastOffset, nextOffset));
6161
}
6262
}

0 commit comments

Comments
 (0)