Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Added PostCSS Support [fixes #37] #80

Merged
merged 5 commits into from Jul 17, 2017
Merged

Added PostCSS Support [fixes #37] #80

merged 5 commits into from Jul 17, 2017

Conversation

lordgiotto
Copy link
Contributor

@lordgiotto lordgiotto commented Jan 28, 2017

Requirements

  • ✓ Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • ✓ All new code requires tests to ensure against regressions

Description of the Change

I added PostCSS scope checks to provider, in order to enable language-postcss to be autocompleted through this provider.

Alternate Designs

The alternative could be use language-css while using PostCSS, but the programming experience would be really awful.

Benefits

Enables language-postcss to be completed trough autocomplete-css provider. Everybody who use postcss can take advantages of both postcss syntax highlight and autocompletition.
Fixes #37.

Possible Drawbacks

PostCSS is not a real syntax, but a collection of plugins: it's impossible to anticipate the exact configuration of the user, so the PostCSS support should be improved gradually to cover most of the possible scenarios.

Applicable Issues

There is room for improvement: a better veriables support, prevents display: var(--b) to be autocompleted in display: var(--block) (now it's a general problem, the same happens with display: $b -> display: $block)

@pixxx
Copy link

pixxx commented Feb 25, 2017

This works for me, just saying! And thanks!!!

@eseQ
Copy link

eseQ commented Feb 26, 2017

Ok, and how long we need wait for release?

Copy link

@pixxx pixxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still works for me after updating 0.15.1. No more travis.yml file the rest is the same.

@50Wliu
Copy link
Contributor

50Wliu commented Mar 6, 2017

This is on my TODO list. Have some other things I'd like to get to first though.

@lordgiotto
Copy link
Contributor Author

Please let me know if a rebase (or some modifications) is eventually needed when you will decide to merge :)


isAtBeginScopePunctuation = hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.css') or
hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.scss') or
hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.postcss') or
hasScope(scopes, 'punctuation.section.property-list.begin.postcss') or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does PostCSS really use both punctuation variants?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I don't remember, I developer it long time ago, but if I did so, surely it's there for a reason: i'll check and figure it out. In your opinion it's not needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot a rebase conflict here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i figured it out: yes, it's needed. Otherwise it fails two tests:

  • "does not autocomplete property names when preceding a {"
  • "does not autocomplete property names when immediately after a }"

I also attach a screenshot to prove it:

postcssscope

@@ -8,6 +8,9 @@ packagesToTest =
Less:
name: 'language-less'
file: 'test.less'
PostCSS:
name: 'language-postcss'
file: 'test.css'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be test.postcss.

Copy link

@eseQ eseQ May 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@50Wliu That confused moment, postcss can be usual *.css file and *.postcss to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know, but I'd like it to be explicit as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, i'll do it now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ;)


isAtBeginScopePunctuation = hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.css') or
hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.scss')
hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.scss') or
hasScope(scopes, 'punctuation.section.property-list.begin.bracket.curly.postcss') or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These scopes are not used by PostCSS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know, punctuation.section.property-list.begin.bracket.curly.postcss is not currently used by language-post css, but I thought that probably it's the scope it should use, so I left it to be future-proof. Also language-css used punctuation.section.property-list.begin. in the past before atom 1.15 and then deprecated it.

However I can remove it, let me know :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sorry for the delay, removed it! Let me know if I can do anything else.

isAtEndScopePunctuation = hasScope(scopes, 'punctuation.section.property-list.end.bracket.curly.css') or
hasScope(scopes, 'punctuation.section.property-list.end.bracket.curly.scss')
hasScope(scopes, 'punctuation.section.property-list.end.bracket.curly.scss') or
hasScope(scopes, 'punctuation.section.property-list.end.bracket.curly.postcss') or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@eseQ
Copy link

eseQ commented May 31, 2017

I tested it 2 days and did not see any bags. Only specific moment for postscss plugins, for example:
i have postcss-short and can use position: absolute 0 0 0 0, while i print something after position value whatever atom show me about 'absolute'. (sorry for my English, that heavy to explain)

Copy link

@eseQ eseQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it 2 days and did not see any bags

@lordgiotto
Copy link
Contributor Author

@50Wliu I made all requested changes (despite what github says) ;)
Can I do something else, or that's good to you?

@50Wliu
Copy link
Contributor

50Wliu commented Jun 2, 2017

Yep, I'm aware. I will be taking another look at this again shortly.

but I thought that probably it's the scope it should use, so I left it to be future-proof

You could submit a PR to language-postcss changing it 😉. We've been working on trying to standardize most of the CSS scopes lately, which is why there's lots of TODOs in autocomplete-css to remove old scopes.

Also, I just merged a PR, and it looks like there's conflicts again. Sorry about that!

@yzalvov
Copy link

yzalvov commented Jun 4, 2017

Hey guys. Sorry for a newby question. But how can I install this PR on my local version of Atom? So I could use and test it. Thank you very much in advance!
@lordgiotto and thank you very much!

@lordgiotto
Copy link
Contributor Author

lordgiotto commented Jun 4, 2017

@50Wliu Rebased 😉
@whynotthough You are welcome 😄 Simply clone my repo into ~/dev/packages/autocomplete-css and switch to postcss branch: then start atom in development mode withatom -d

@eseQ
Copy link

eseQ commented Jul 10, 2017

any updates?

@50Wliu
Copy link
Contributor

50Wliu commented Jul 10, 2017

No updates. Still on my radar.

@lordgiotto
Copy link
Contributor Author

@50Wliu Can I do something more? I noticed github erroneously displays that there's still one change to fulfill your review, but that's not true :)

@50Wliu
Copy link
Contributor

50Wliu commented Jul 12, 2017

Yeah, I hope to re-review this by the end of the week, at which point I'll update the "changes requested" status if necessary. Just got back from vacation and am still catching up on what happened while I was gone.

@50Wliu
Copy link
Contributor

50Wliu commented Jul 17, 2017

Looks pretty low-risk to me. Thanks @lordgiotto! However, please note that you'll probably still be responsible for the maintenance of this feature since the Atom team doesn't use or maintain language-postcss.

@50Wliu 50Wliu merged commit b34394e into atom:master Jul 17, 2017
@eseQ
Copy link

eseQ commented Jul 18, 2017

@lordgiotto, @50Wliu thanks for your work! My congratulations.

@Zalaski
Copy link

Zalaski commented Aug 13, 2017

Hi all,

I'm still having this issue; when PostCSS is my syntax, autocomplete is not functioning for properties. I understand a fix was implemented here, and I've updated to Atom 1.19.0 on MacOS, so maybe I've missed a step.

Autocomplete works again if I set the syntax to CSS, but then syntax for mixins are no longer highlighted.

I'm relatively new to web development, so please let me know what more information you would need from my end, as I'm not sure what to provide as of right now.

Any help would be greatly appreciated.

@50Wliu
Copy link
Contributor

50Wliu commented Aug 13, 2017

@Zalaski I believe PostCSS support is only on Atom 1.20.0 beta.

@Zalaski
Copy link

Zalaski commented Aug 13, 2017

@50Wliu Thanks for clarification, could you suggest how I can implement the changes on my end? I'm also new to Git, but I'm assuming Pull request/config changes, or would you advise that I just wait till 1.20.0 enters the Stable channel?

@50Wliu
Copy link
Contributor

50Wliu commented Aug 13, 2017

I'd advise just waiting.

@eseQ
Copy link

eseQ commented Aug 21, 2017

@Zalaski you can update autocomplete directly.

@50Wliu
Copy link
Contributor

50Wliu commented Aug 21, 2017

@dictory I wouldn't recommend that unless you know exactly what you're doing - that will override the bundled version, which commonly causes hard-to-diagnose bugs.

@eseQ
Copy link

eseQ commented Aug 22, 2017

@50Wliu yes, you are right. I just wanted say about that opportunity.

@jessy1092
Copy link

Works perfect on Atom 1.20. Thanks @50Wliu @lordgiotto 💯

@rodrigojcmello
Copy link

no sugarss support? 😢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need PostCSS support like SCSS and Less
8 participants