Repository navigation
invalid/non stable ast for combinator with comment #189
Description
Activity
alexander-akait commented
on Mar 15, 2019 CollaboratorAuthorMore actions/cc @ai what do you think about this
Why it will change AST?
alexander-akait commented
on Mar 16, 2019 CollaboratorAuthorMore actions@ai new
commentnode appears in ast(before it was inraws), just want to clarify should we release this as patch or major?Technically it should be major
Reacted by Alexander Akaitalexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actionsSame problem for
[ /*t*/ title /*t*/ = /*t*/ "Something" /*t*/ ], comments should be part of ast notrawalexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actions/cc @ai i ahve some questions about spaces too
Example:[ href = "test" i ] { } ^ ^ ^ ^ ^What node(s) should store spaces in this case (inside
raws?)? Because now logic in parser is very misleading and I can't understand whether we do it right or not. We haveattribute,value,insensitivevalues.To be honest, I am not sure that I know the best answer.
But I think in selector parser we should work with spaces in a different way, compare to PostCSS core. In main CSS syntax, whitespaces don’t mean anything. In selector, whitespace can have a lot of meanings.
So, I think it could be better to have a special token for spaces.
alexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actions@ai yep, we already have special token for
space, my questions about where we should store meta information about space (raws). Let's see on example above:- First spaces should be stored in
raws.beforeorraws.attribute.before? - Second space should be stored in
raws.attribute.beforeorraws.operatore.before? - Third space should be stored in
raws.operator.afterorraws.value.before - Four space should be stored in
raws.value.afterorraws.insensitive.before(insensitivewill be renamed inflagin next major) - Five space should be stored in
raws.insensitive.afterorraws.after(insensitivewill be renamed inflagin next major)
- First spaces should be stored in
Why do we need a
rawsfor whitespaces when we havespacetoken?alexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actions@ai hm can you provide example/PoC of ast with
spacetoken (based on example above)? We need this spaces for linting/printing instylelintandprettiera b>{ type: "word", value: "a" }, { type: "space", value: " " }, { type: "word", value: "b" }alexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actions@ai in example above
spaceisdescendant selector, we already providecombinatoras separate node, but in my example spaces mean nothing so we omit them from astI am not sure that we should omit them from AST.
alexander-akait commented
on Mar 19, 2019 CollaboratorAuthorMore actions@ai I do not see their meaning as they really do not carry here any semantic load, also we do this right now, we can plan this on next major, but will be great solve problems with spaces using
rawsfor next releaseYeap. This discussion is on you. Sorry, that I can't help right now.
Reacted by Alexander Akaitalexander-akait commented
on Mar 20, 2019 CollaboratorAuthorMore actions@ai Maybe not related to issue, but what is blocker integrate selector parser in postcss? Non standard syntax? Or nobody send a PR?
@evilebottnawi I am afraid that we will freeze API which will not be the best.
alexander-akait commented
on Mar 21, 2019 CollaboratorAuthorMore actions@ai we can afraid this forever 😄 To be honestly ast of
postcssis not enough for prettier/stylelint nowadays (prettier breaks code in many cases and i recommended don't use this for css/scss/less/etc). I think we should start integrationselector/value/mediaparsers otherwise we will need do fork postcss and continue development 😞alexander-akait commented
on Mar 21, 2019 CollaboratorAuthorMore actionsAlso we can release this under flag/option and as experimental (adding information to readme about non stable)
We have big tests code base in stylelint and prettier and webpack so i think we catch all problems very fast
RIght now our main focus is visitor API postcss/postcss#1245
alexander-akait commented
on Mar 21, 2019 CollaboratorAuthorMore actionsGreat feature 👍 Already look on this.
@ai Is there any sense send a PR or better fork postcss and starting own development for prettier? Because i don't want to waste my time on something what will be never merged.
@evilebottnawi I have a better plan. Let’s release new AST in
postcss-selector-parserand if nobody will complain about it, we can move it to PostCSSalexander-akait commented
on Mar 21, 2019 CollaboratorAuthorMore actions@ai okay 👍 i will ping you before release or when i have some questions
Input:
It is do impossible analyzes comments, also adopt new version to
stylelintandprettier. For me it is bug, but fixing this change ast.