From 002cea08bd4d29295b4c708d0359423d8e578153 Mon Sep 17 00:00:00 2001 From: Laura Warr Date: Fri, 15 Sep 2023 15:50:28 -0400 Subject: [PATCH] fix: Don't include lines less than 1 in the code snippet buffer --- src/utils/parsers/BaseParser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/parsers/BaseParser.ts b/src/utils/parsers/BaseParser.ts index d51818289..21dc72fd2 100644 --- a/src/utils/parsers/BaseParser.ts +++ b/src/utils/parsers/BaseParser.ts @@ -311,7 +311,7 @@ export abstract class BaseParser { end: matchingLines[matchingLines.length - 1].ln } - const bufferedStart = Math.max(range.start - buffer, 0) + const bufferedStart = Math.max(range.start - buffer, 1) const bufferedEnd = Math.min(range.end + buffer, file.lines.length) const bufferedContent = file.lines .filter((line) => range.start - buffer <= line.ln && range.end + buffer >= line.ln)