From 5904dcd9aa8e8163ba1d4e1bd1f76936bd5ab017 Mon Sep 17 00:00:00 2001 From: Sarthak Shastri <122080718+sarvalabs-sarthak@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:30:58 +0530 Subject: [PATCH] fixes mutable func validation bug (#7) - fixes error where the stateful flags were not being reset appropriately --- server/src/modules/validation.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/modules/validation.ts b/server/src/modules/validation.ts index 0b309e0..4bb76b3 100644 --- a/server/src/modules/validation.ts +++ b/server/src/modules/validation.ts @@ -23,6 +23,11 @@ export const statefulValidation = (text: String, diagnostics: Diagnostic[]) => { // Check for 'mutate' keyword after the endpoint/func declaration for (let bodyLineIndex = lineIndex + 1; bodyLineIndex < lines.length; bodyLineIndex++) { const bodyLine = lines[bodyLineIndex]; + + if(/^(?!\s*$)[^\t ]/.test(bodyLine)){ + break; + } + if (!(/^\s*$/.test(bodyLine))) { // Skip empty lines if (bodyLine.match(mutatePattern)) { hasMutateKeyword = true;