From 6250ad3de788e392f73b7e43a26a1bd46ecb4b7b Mon Sep 17 00:00:00 2001 From: lvjiaxuan <471501748@qq.com> Date: Sat, 29 Oct 2022 17:28:56 +0800 Subject: [PATCH] fix: ignore lines without problems --- src/extension.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 58dc8b5..b9487a9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -102,6 +102,11 @@ const disposes = [ activeTextEditor.selections.forEach(selection => { + if (!Object.keys(lineRuleIdsMap).some(problemLine => + selection.start.line + 1 <= +problemLine && +problemLine <= selection.end.line + 1)) { + log('No problem rules found on selected lines.', true, 'OK') + return + } const text = getTextBylines(selection.start.line, selection.end.line) if (!text?.replace(/\n|\r/g, '')) {