From 0e8f12eba0c2c1b8f2a0083c71450bd259569bac Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Mon, 18 Dec 2023 18:00:22 +0200 Subject: [PATCH] fix: allow space after : --- lib/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 15699d2..53b2052 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -99,7 +99,7 @@ const getIsDeclaredAfter = (styleRule: CSSStyleRule) => (selector: string) => { export module python { export function getDef(code: string, functionName: string) { const regex = new RegExp( - `^(? *?)def +${functionName} *\\((?[^\\)]*)\\)\\s*:\\n(?.*?)(?=\\n\\k[\\w#]|$)`, + `^(? *?)def +${functionName} *\\((?[^\\)]*)\\)\\s*:\\s*?\\n(?.*?)(?=\\n\\k[\\w#]|$)`, "ms" ); @@ -141,7 +141,7 @@ export module python { : blockPattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); const regex = new RegExp( - `^(? *?)(?${escapedBlockPattern})\\s*:\\n(?.*?)(?=\\n\\k[\\w#]|$)`, + `^(? *?)(?${escapedBlockPattern})\\s*:\\s*?\\n(?.*?)(?=\\n\\k[\\w#]|$)`, "ms" );