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

[SCSS] Empty spaces are removed from function argument strings in string interpolation #9224

Open
pfeileon opened this issue Sep 17, 2020 · 6 comments
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program

Comments

@pfeileon
Copy link

pfeileon commented Sep 17, 2020

Prettier 2.0.5

Input:

$test: '#{string.index('this is a test', 'a test')}';

Output:

$test: '#{string.index('thisisatest', 'atest')}';

Expected Behavior:
Function arguments should not be altered because this breaks the code.

@alexander-akait alexander-akait added lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program labels Sep 17, 2020
@zweimach
Copy link
Contributor

I think this happens because the quotes are not properly closed:

$test: '#{string.index('this is a test', 'a test')}';

instead of

$test: "#{string.index('this is a test', 'a test')}";

Playground link

@alexander-akait
Copy link
Member

Yes, you are right, here problem with syntax, thanks!

@alexander-akait alexander-akait added scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency and removed type:bug Issues identifying ugly output, or a defect in the program labels Sep 17, 2020
@alexander-akait
Copy link
Member

parser should throw an error on invalid syntax, but we can't fix it on our side

@fisker
Copy link
Sponsor Member

fisker commented Sep 17, 2020

Isn't this the same as #9128?

@agamkrbit
Copy link
Contributor

Isn't this the same as #9128?

yes I think it is the same

@fisker
Copy link
Sponsor Member

fisker commented Sep 22, 2020

@evilebottnawi It seems it's valid syntax.

https://www.sassmeister.com/

@use "sass:string";

$test: '#{string.index('this is a test', 'a test')}';

a {content: $test;}

@alexander-akait alexander-akait added type:bug Issues identifying ugly output, or a defect in the program and removed scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency labels Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

5 participants