Skip to content

Commit 1f5271c

Browse files
committed
Fix issue where the analysis would not report the first issue.
The first chunk starts with an empty line.
1 parent a6ca365 commit 1f5271c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/src/commands/dead_code_analysis.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ let dceTextToDiagnostics = (
8989
// +use is never used
9090
// <-- line 2
9191
// @dead("+use") let use = (initialState: 'a, handleEvent: ('a, 'b) => 'a) => {
92+
9293
dceText.split("\n\n").forEach((chunk) => {
94+
let lines = chunk.split("\n").filter((line) => line != "");
9395
let [
9496
_title,
9597
fileInfo,
@@ -99,7 +101,7 @@ let dceTextToDiagnostics = (
99101
// line that reanalyze might suggest.
100102
lineNumToReplace,
101103
lineContentToReplace,
102-
] = chunk.split("\n");
104+
] = lines;
103105

104106
let processedFileInfo = extractFileInfo(fileInfo);
105107

0 commit comments

Comments
 (0)