js-beautify icon indicating copy to clipboard operation
js-beautify copied to clipboard

[scss] grid-template-areas not formatting as expected

Open UTGuy opened this issue 2 years ago • 3 comments

Description

Formatting seems to break when using a SCSS variable in grid-template-areas.

Input

The code looked like this before beautification:

.foo-bar {
    $courseLibrarySearch-content-row1: "search search search . toggleFilters";
    grid-template-areas:
        $courseLibrarySearch-content-row1;

    .foo--showFilters & {
        grid-template-areas:
            $courseLibrarySearch-content-row1 
            "assetTypeFilter languageFilter . . .";
    }
}

Expected Output

The code should have looked like this after beautification:

.foo-bar {
    $courseLibrarySearch-content-row1: "search search search . toggleFilters";
    grid-template-areas:
        $courseLibrarySearch-content-row1;

    .foo--showFilters & {
        grid-template-areas:
            $courseLibrarySearch-content-row1 
            "assetTypeFilter languageFilter . . .";
    }
}

Actual Output

The code actually looked like this after beautification:

.foo-bar {
    $courseLibrarySearch-content-row1: "search search search . toggleFilters";
    grid-template-areas:
        $courseLibrarySearch-content-row1;

    .foo--showFilters & {
        grid-template-areas:
            $courseLibrarySearch-content-row1 "assetTypeFilter languageFilter . . ."; // <--  why does this happen
    }
}

Steps to Reproduce

Format the code

Environment

OS: any

Settings

default settings in VSCode

UTGuy avatar Jul 19 '22 15:07 UTGuy

I'm not sure why it is happening. Is it actually breaking functionality or is it simply less then ideal formatting?

bitwiseman avatar Aug 07 '22 07:08 bitwiseman

It's definitely not ideal to have "rows" showing side-by-side like that

UTGuy avatar Aug 07 '22 13:08 UTGuy

Agreed, I was just trying to understand the severity of the problem. Preserve newlines should work in this area, but it apparently has a bug.

bitwiseman avatar Aug 08 '22 16:08 bitwiseman