Skip to content

Commit fd6be5c

Browse files
committed
Include Description lines of current method
1 parent 6ef52db commit fd6be5c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/ourFileCoverage.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,20 @@ export class OurFileCoverage extends vscode.FileCoverage {
131131
serverSpec,
132132
{ apiVersion: 1, namespace, path: "/action/query" },
133133
{
134-
query: "SELECT element_key StartLine, LineToMethodMap Method FROM TestCoverage_Data.CodeUnit_LineToMethodMap WHERE CodeUnit = ? ORDER BY StartLine",
134+
query: `
135+
SELECT clm.element_key AS StartLine,
136+
clm.LineToMethodMap AS Method,
137+
CASE
138+
WHEN md.Description IS NULL THEN 0
139+
ELSE $LENGTH(md.Description, CHAR(13))
140+
END AS DescriptionLineCount
141+
FROM TestCoverage_Data.CodeUnit_LineToMethodMap clm
142+
JOIN TestCoverage_Data.CodeUnit cu ON clm.CodeUnit = cu.Hash
143+
LEFT JOIN %Dictionary.MethodDefinition md ON md.Name = clm.LineToMethodMap
144+
AND md.parent = cu.Name
145+
WHERE clm.CodeUnit = ?
146+
ORDER BY StartLine
147+
`,
135148
parameters: [this.codeUnit],
136149
},
137150
);
@@ -143,6 +156,7 @@ export class OurFileCoverage extends vscode.FileCoverage {
143156
response?.data?.result?.content?.forEach(element => {
144157
const currentMethod = element.Method;
145158
const currentStartLine = Number(element.StartLine);
159+
const descriptionLineCount = Number(element.DescriptionLineCount);
146160
if (previousMethod && previousStartLine) {
147161
const start = new vscode.Position(previousStartLine - 1 + startOffset, 0);
148162
const end = new vscode.Position(currentStartLine - 2 + endOffset, Number.MAX_VALUE);
@@ -151,7 +165,7 @@ export class OurFileCoverage extends vscode.FileCoverage {
151165
startOffset = endOffset;
152166
endOffset = (mapOffsets.get(currentMethod) || endOffset);
153167
previousMethod = currentMethod;
154-
previousStartLine = currentStartLine;
168+
previousStartLine = currentStartLine - descriptionLineCount;
155169
});
156170

157171
// Add the final method (if any)

0 commit comments

Comments
 (0)