Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracoft's avatar
Level 27

Change pint behavior

  1. VSCode has the a folding feature of using #region Name and #endregion Name
  2. However, pint likes to convert them to // region ...
  3. I have no preferences and prefer to use tools out of the box and avoid any configuration, but this is a bit too nice to sacrifice
  4. Is there a way to get pint to ignore lines that start with #region and #endregion?
  5. And no, VSCode does not recognize // #region ...
0 likes
1 reply
Braunson's avatar

You can configure Pint to preserve your #region comments by customizing the single_line_comment_style rule. Create or modify your pint.json file:

{
    "rules": {
        "single_line_comment_style": {
            "comment_types": ["asterisk"]
        }
    }
}

This tells Pint to only convert /* */ style comments to //, leaving # comments untouched.

Alternative approach (more targeted): If you want to keep most of Pint's comment formatting but just preserve regions:

{
    "rules": {
        "single_line_comment_style": false
    }
}

This disables the rule entirely, so all your comment styles stay as-is.

Quick test:

#region Test Region
public function someMethod() 
{
    // This comment might still get formatted
    /* This one too */
}
#endregion

The first option is probably what you want - it's minimal configuration that solves your specific use case while keeping Pint's other formatting benefits.

Please or to participate in this conversation.