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
[css] support /deep/ selector #7002
Comments
'/' is not a valid character in a selector, at least not in CSS3. |
Did |
By way of this some more detail. The issue currently arises in the context of some use cases when styling components in accordance with Angular 2 (RC1). Here a few snippets from the Angular documentation section, I linked in my initial comment:
...
Angular 2 supports the use of The Otherwise, the cross-references would lead to the shadow DOM as the note in Section 2.3 of W3C Shadow DOM and the more specific discussion in Deep Combinator W3C CSS Scoping. |
Thanks for the link, which led me to this: https://www.w3.org/TR/2013/WD-selectors4-20130502/#idref-combinators |
/deep/ no longer exists, so I don't think we should support it. >>> is the new version, which should probably be supported, but I don't know how stable it is right now. These kind of things usually get renamed a lot before being widely supported. |
Is there any workaround for this issue? Its breaking the syntax checking and syntax highlight. No matter its been deprecated in the future (who knows when, at least its valid at this point), or change to a new version (shouldn't we support both versions then?), it does supported by the parser (it works find if you ignored the vscode error), and has been recommended (or at lease been mentioned) in the Angular2 official doc. |
There's no workaround except disabling the syntax checking. |
Thanks! Disable syntax checking would be enough (transpiler will tell me the syntax error anyway). |
The settings is |
That is what I ended up doing in the interim. Toggling back and forth manually, when I actually change the css files and then screening the real issues out. Not ideal, but I understand your take. Thanks for all the amazing work on VS Code. |
does anyone know if an extension exists that supports this |
Not to my knowledge. Although, I would be more interested now than even before, since there were some recent changes on the Angular2 final (and the last couple of RCs before that), which made me have to use Until recently I could avoid it. |
using |
I hope you guys will change your mind or at least make possible to disable css validation locally in vscode. Thanks. |
use |
@aeschli yeap, I'm aware of it, thanks. But mentioning this in vscode settings file will disable css validation globally. I wold like to see something like:
it would be a good workaround. update:
But I believe it's off-topic here. Just thinking out loud. Now I ended up by disabling css encapsulation of my Angular 2 component instead of disabling css validation. |
Another workaround: instead of disabling css validation, just use |
@aboveyou00 can you please explain that syntax? |
It's basically just an "insert raw" command. You can use it to make variable contents part of a selector; this is the example that they give in the documentation.
A feature that doesn't seem to be documented is that you can just insert raw text there by wrapping it in a string. I'm not sure where I found out about it, but you can use it (for example) to prevent SCSS from collapsing expressions in
Without that it would set the width to either 20% or 20px, I don't remember which, but either is invalid. |
Some updates from my side: I ended up switching on again angular encapsulation and moving from standard linter to stylelint. It is more advanced and flexible. If you don't search compromises and use experimental things, I would definitely to stick with this. |
I added support for /deep/ and >>> to the cssParser. |
Has this being fixed on Linux platform? - I still have a syntax error in 1.11.2 Ubuntu |
Its fixed for the April release, which is 1.12.0. You can already try it in the insiders build |
Thanks very much. |
@aeschli is the cssParser support for ">>>" allready live? |
It should work in the insiders build. |
Thank you for this info! |
@aeschli I've downloaded right now the build 1.12.0 just released and |
@luchillo17 It should work for css, less and scss. |
I can confirm that it is still broken in 1.12.1 (updated today). Please view screenshots at #26004 |
When writing Angular 2 components using view encapsulation, it may be necessary to use CSS scoping, i.e. special selectors in accordance with:
Angular 2 Guide and the related reference CSS Scoping.
VS Code currently produces and error as follows:
Steps to Reproduce:
/deep/
.Thanks in advance.
The text was updated successfully, but these errors were encountered: