postcss / sugarss

Indent-based CSS syntax for PostCSS
MIT License
707 stars 39 forks source link

Indent dependent block comments #3

Closed Grawl closed 8 years ago

Grawl commented 8 years ago

I would prefer to comment by indent.

.foo
    //.bar
        color: red
    .baz
        color: navy

What will be equal to:

.foo {
    /*
    .bar {
        color: red
    }
    */
    .baz {
        color: navy
    }
}

It works in that way in Jade and I very like this way to comment out whole trees.

ai commented 8 years ago

I think it is too tricky, when line can be hidden in comment by some symbol in some lines above. Comments should be explicit.

Especially because every text editor have hot key (like Cmd + /) to add // to all selected lines.

However, I am open for thoughts and maybe you can convince me, that this feature is very important.

Grawl commented 8 years ago

Maybe you're about some .one//two selectors or content: '//'? You can limit block comments only by the start of line after all spaces, like

.foo//
    color: red

will not work, but

//.foo
    color: red

will.

TrySound commented 8 years ago

@Grawl Look at github highlighting. How should I guess that whole block is commented? I agree it's too tricky. Syntax should be intuitive.

Grawl commented 8 years ago

@TrySound it's Sass highlighting.

Here's Jade highlighting:

div
    //-span
        span
TrySound commented 8 years ago

Still unintuitive.

corysimmons commented 8 years ago

Did I comment on this and it got deleted or am I crazy?

Anyway, I originally agreed with @ai but syntax highlighting fixes this and actually looks pretty nice. Might be too complicated for the payoff right now though.

ai commented 8 years ago

@corysimmons this question was in other issue :). I think you answer it there before @Grawl separate question to 2 issues.

Grawl commented 8 years ago

Using block comments in Jade and not thinking that it's “unintuitive” or something.

If I add a class .hidden up in DOM tree I'm ready to get hidden subtree.

If I delete one of my folders in a system I'm ready to not get access to it's content.

It's tree structure.

It's intuitive to work with tree, not with small chunks of code.

corysimmons commented 8 years ago

:+1: <- helpful

ai commented 8 years ago

@Grawl show me any benefits of this commenting style compare to Ctrl+/

corysimmons commented 8 years ago
natemoo-re commented 8 years ago

+1 It's not super difficult to Ctrl+/ out multiple lines, but I really like the way Jade handles this. It's a minor convenience, but I think it is worth implementing (eventually.)

jamen commented 8 years ago

Against this... Hinders readability in my opinion. Uncommented code that acts like it is commented? Seems silly and like an anti-feature... I don't mind dragging my cursor (or merely shift-clicking) a few extra lines so I can press Ctrl+/ in my editor, if that distinctively shows what code is commented and what is not.

corysimmons commented 8 years ago

Moot point. Editors with syntax highlighting for SSS will display it as commented out.

whaaaley commented 8 years ago

:+1: Indent block commenting. It's just nice when you want to comment a whole er... block. I use it often in Jade/Pug as well. Click and dragging to comment/uncomment multiple times while testing is a bit much when you compare it to just comment/uncomment a single parent.

If clicking a "only a few more times" was ever a good reason to not add a feature we wouldn't have multiple cursors in our editors either. :grin:

Although it's not the end of the world if this doesn't get added.

ai commented 8 years ago

I saw that both ways has own fans. But I decide to not implement it. You can always fork project and add it to them :).