-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Multiline Expressions in Indented Syntax #216
Comments
I also think sass should support this, and not just in mixins. It's a serious deficiency in the indented syntax. |
+1 Haml allows multi-line statements if lines end with a comma. |
@pengwynn I like that approach. It's nicer than the way I was thinking, which was adding a \ to the end of line like in Python. |
Just ran into this myself. It's a real problem. box-shadow statements can be really long. |
+1 |
+1
and currently invalid for SASS, but much more readable:
|
I've faced a similar issue yesterday when defining a This feature would have the potential to increase legibility substantially. Is anyone here familiar enough with how Sass parses lines to have a vague idea how to go about implementing this, or if it's even worth the effort? |
+1 |
Can we at least have JavaScript like multi-line with a background-image: radial-gradient($color, $color $thickness/2, transparent $thickness/2),\
radial-gradient($color, $color $thickness/2, transparent $thickness/2) |
Just stumbled onto the super-long line and the first thing I tried was |
👍 |
👍 It would be very nice for nested lists, too.
|
Agreed. Multi-line would be a very welcome addition for mixins and lists. The whitespace-aware/inferred nature of the indented syntax is the primary reason I chose it over SCSS (and, I assume, it's existence). As mentioned by others, the readability of box-shadows, text-shadows, @font-faces and lists would benefit hugely from this. |
Selectors too. Sometimes they can be very long. It's a pity that Sass can't do multiline expressions. The funny thing is that Haml does allow breaking the line after a comma. |
@lolmaus Here is a sample of my HAML code, and I don't really like it, am I doing it wrong? AFAIK Haml doesn't allow you to simply end a line with comma.
|
@firedev Does it work when formatted like this? = text_field :inquiry, :customer, placeholder: 'Customer',
id: 'suggest_customer',
value: (params[:inquiry][:customer] if params.fetch(:inquiry, false)),
data: { action: suggest_customer_supervise_or_manage_users_path,
email: 'q[name_or_email_cont]' } A shorter way: = text_field :inquiry,
:customer,
placeholder: 'Customer',
id: 'suggest_customer',
value: (params[:inquiry][:customer] if params.fetch(:inquiry, false)),
data: { action: suggest_customer_supervise_or_manage_users_path,
email: 'q[name_or_email_cont]' } I didn't test it, but i format my Haml code similarly and it works. TL/DR: You don't need a pipe in the end of a line of Haml code if the line ends with a comma. |
I'll be damned! It does, what is the trick here? I tried it before and always had to pipe it up. Guess the problem was caused by me trying to have curly braces on new lines for data:
|
+1 |
Is there any progress on this? I’m running into similar issues when trying to use maps in Sass 3.3.5. While when using the scss syntax everything works perfectly like so $susy: (
columns: 12,
gutters: 1/3,
gutter-position: after,
math: fluid,
output: float,
flow: ltr,
global-box-sizing: border-box
) something like (using
doesn’t, because |
I agree with mxlje. The .sass syntax is beautiful but maps really tear things up. |
Found this thread from http://stackoverflow.com/q/23429137/174034 - I'm having similar problems |
+1 |
1 similar comment
+1 |
+1, maybe we should start a bounty for this everlasting issue ? |
Only now find out about this issue. +1 |
Feels like it's time to get this solved 😉 You can try it from https://github.com/alromh87/dart-sass/tree/multiline
You can use this file as reference, I tested the examples I found here |
@alromh87 |
@ngdangtu-vn while possible it would be more complicated and I wasn't aware that all this has to go over the language proposal process, so for now I will wait to see what comes out from this process. I didn't expect this fix to be that complex 😅 |
@alromh87 Well, it can be help. I think if your PR got approved, it involves to a lot developers. And one it got publish, there will be no way to turn back. So let's way for it got approved. Anyway, thank you for your PR. I do hope it will pass soon 'cause I truly need it. |
A comma would be confusing, list and maps are separeted by commas. |
Can it do both? I don't understand why should we concern about it. |
It would be possible to avoid using any extra character (aka: detecting the coma) but since the parser works on a char level it would need to keep state when it should treat newline as single line. For that it would be needed to specify where this behaviour should thake place. Would someone be willing to analyze and integrate one single list? Again I feel it make it more complex and probably will delay more the integration. I sent proposal as implemented, lets wait an see the result, hopefully won't thake that long since it is allready a very long awaited feature (2011). In the meantime you can follow the procedure detailed before to use it if you strongly need it now. Let me know if you have questions. Also if someone would be willing contribute to the bounty to support development, I would appreciate it. One more thing: once upon a time there was an implementation of this functionality for ruby sass that never landed due to unfortunate circumstances, this implementation also used backslash "\", so should not be too hard to syncronize ruby version as well. I hope unfortunate circumstances dont arrise again, and this issue can be finally closed. Good vibes 🤙 |
Hello, do any of you have any idea how this should be written? |
Just to add another use case to this, this would be very helpful when using
While this wouldn't be my first choice of syntax, as noted by other people, many other languages support this by using backslashes:
|
What are the objective benefits of using SASS vs SCSS again, despite of this awkward yaml-style tabulation? +1 |
It is more consice, and compact, easier to read, IMO. |
Not trying to be rude, but is there a reason why this still hasn't arrived yet..? It has been so many years since this was first opened |
@EzraWolf "Intended Sass" isn't actively being worked on or expanded– it's hardly known at all outside of the Ruby community who got used to it with the original design of Sass wayyy back over 16 years ago when that was the original style. Over a decade ago we decided to pivot hard to using a 'css-compatible' style of Sass, and have made that the primary syntax ever since and has contributed to the expansion of the language. In fact, I think it's kinda wild that Natalie has still kept the indented syntax functional after all these years of new features. I'm not sure if @nex3 has officially commented on this ticket– so many comments to wade through– but I'd guess that she isn't really against it, but likely it's just not even anywhere near a priority with the usage that indented-syntax gets. Honestly, it causes so much confusion and double-work (this ticket being an example) that I'm not sure how much longer it's even a good idea to keep it around! |
@HamptonMakes We love the indented syntax, I use it for all my projects (non Ruby or RoR projects but Vite apps and pure Vue SPA's), so please keep it around, we don't care about this multiline issue :) |
To be clear: we have no plans to get rid of the indented syntax. I would definitely like to add multiline expressions—note that this issue is marked as "planned"—but it'll take a substantial design effort to ensure we get this right and the Sass team is stretched very thin. |
What she said then! ^^ |
Sass syntax works very well with Tailwind CSS, this is giving developers a fresh perspective of whether to support indented syntax. Tailwind sass syntax (syntax highlighter only) for VS Code has had 37,086 installs at time of writing, and while not a huge amount, there is an obvious desire for the combo. |
Edited by @nex3 to change the title.
[cross-posted from http://stackoverflow.com/questions/8248976/sass-indented-syntax-on-multiple-lines]
I love indented syntax, I think it's much cleaner.
There's one issue I have with it. If I have a really long mixin declaration, there's no way to split it into multiple lines (obeying the 80 character limit, for example)
Take this example, first written in SCSS.
I'm able to split up one long declaration in to multiple lines. With the indented syntax, I don't think there's a way. I have to put the declaration on one line, which is way less readable.
Is there some way I don't know of? And if not, can there be one? :)
The text was updated successfully, but these errors were encountered: