Skip to content

Commit

Permalink
fix: allow space after :
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunSHamilton committed Dec 18, 2023
1 parent 3135fbb commit 0e8f12e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const getIsDeclaredAfter = (styleRule: CSSStyleRule) => (selector: string) => {
export module python {
export function getDef(code: string, functionName: string) {
const regex = new RegExp(
`^(?<function_indentation> *?)def +${functionName} *\\((?<function_parameters>[^\\)]*)\\)\\s*:\\n(?<function_body>.*?)(?=\\n\\k<function_indentation>[\\w#]|$)`,
`^(?<function_indentation> *?)def +${functionName} *\\((?<function_parameters>[^\\)]*)\\)\\s*:\\s*?\\n(?<function_body>.*?)(?=\\n\\k<function_indentation>[\\w#]|$)`,
"ms"
);

Expand Down Expand Up @@ -141,7 +141,7 @@ export module python {
: blockPattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

const regex = new RegExp(
`^(?<block_indentation> *?)(?<block_condition>${escapedBlockPattern})\\s*:\\n(?<block_body>.*?)(?=\\n\\k<block_indentation>[\\w#]|$)`,
`^(?<block_indentation> *?)(?<block_condition>${escapedBlockPattern})\\s*:\\s*?\\n(?<block_body>.*?)(?=\\n\\k<block_indentation>[\\w#]|$)`,
"ms"
);

Expand Down

0 comments on commit 0e8f12e

Please sign in to comment.