Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't select Linebreak with regexp #8

Closed
AgamlaRage opened this issue Jul 22, 2019 · 2 comments
Closed

Can't select Linebreak with regexp #8

AgamlaRage opened this issue Jul 22, 2019 · 2 comments

Comments

@AgamlaRage
Copy link

Hello,

first of all thank you so much for your extension.
I feel like I was waiting one line code folding since decades!

I'm trying to creates regexp for SCSS files.
But it looks like I can't select the linebreaks characters.

Regexp that is working and tested with Regexr.

    // settings.json
    "scss": [
      {
        "beginRegex": " {",
        "endRegex": "[\n| ]}",
         // "endRegex": "/[\n| ]}/g", // I also tryied this, but not working
      },
    ],

Explanation

  • [\n| ] get either linebreak or space
  • } get closing brace

Test code

#nav-menu-container {
  min-height: calc(100vh + 1px);
  padding-top: calc(#{$spacing} + #{$navbar-height});
  @include mbu(tablet) {
    padding: 10%;
    padding-top: calc(10% + #{$navbar-height});
    display: flex;
    align-items: center;
  }
}

With this I'm able to fold the nested block in 1 line, but not the parent element.
I think my regexp is all good except the linebreak part.

Could someone help me please ?

Thx

@daiyam
Copy link
Member

daiyam commented Jul 22, 2019

Hi @AgamlaRage,

I'm glad you like the extension.

I've not updated to the latest version of VSCode, but the default "editor.foldingStrategy": "auto" should fold as you like...

Maybe you can try:

{
  "beginRegex": " \\{\\s*$",
  "endRegex": "^\\s*\\}"
}

@AgamlaRage
Copy link
Author

AgamlaRage commented Jul 23, 2019

Hi @daiyam, your regexp seems to works for me! Thx

Before closing the issue, I want to propose something to you, maybe you already planed it or thought about it.
You could create a markdown table, referencing the good regexp that people shared to you.
Maybe that will prevent you from spending extra time telling others people like me the good regexp.

Example:

Language beginRegex endRegex
SCSS \{\s*$ ^\s*\}
Javascript
PHP

Thx again for your extension.
I'll let you know if I find regexp <3

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants