Skip to content

Commit

Permalink
fix: πŸ› json directive adds unexpected whitespace
Browse files Browse the repository at this point in the history
βœ… Closes: #334
  • Loading branch information
shufo committed Feb 12, 2022
1 parent 1c0dab5 commit 69aa499
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default class Formatter {
return _.replace(
content,
// eslint-disable-next-line max-len
/(?!\/\*.*?\*\/)(@php|@class|@button)(\s*?)\(((?:[^)(]+|\((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\)))*\)/gms,
new RegExp(`(?!\\/\\*.*?\\*\\/)(@php|@class|@button|@json)(\\s*?)${nestedParenthesisRegex}`, 'gms'),
(match: any) => this.storeInlinePhpDirective(match),
);
}
Expand Down Expand Up @@ -897,7 +897,7 @@ export default class Formatter {
return formatted;
}

return `${p1}${matched}`;
return `${p1}${util.formatRawStringAsPhp(matched).trimEnd()}`;
},
),
);
Expand Down

0 comments on commit 69aa499

Please sign in to comment.