You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[html] intellisense should be more context aware #375
Currently HTML intellisense will present special attributes that are only related to tags but that's about as smart as it gets. Here are some improvements that could be made:
Don't suggest attributes that aren't valid on a particular tag (eg. aria widget attributes on a non-widget element)
Don't suggest tags that are not valid within the parent tag (eg. <li> is the only tag valid within <ol> and <ul>)
Reacted by Wang Zishi, Abdurrahman Rajab, Leland Clemmons and Srijan Mukherjee
Something else to add to this. <picture> element has a <source> element child. For <video> and <audio> only src and type are valid. For <picture> there is also srcset (but not src), sizes, and media. I didn't want to add those to the <source> auto-complete as it'd be confusing, but currently there is no way to add them only if only picture, and not audio or video are the parent.
There is SVG specific elements only being valid if inside an svg element if we add those, but that could be covered by point two if done generally enough.
To cover aria, point 1 would have to also depend on the value of an attribute. i.e. if role="foo" then the aria-bar attribute is valid.
This is probably beyond this particular issue as it related to CSS, not HTML, but there are CSS descriptors, which are like properties but used within at-rules. Think src, which is used in font-face but isn't a generic CSS property that can be used outside. There are a number of these; some that overlap with regular properties (e.g. font-family descriptor) and some that don't (aforementioned src, plus various descriptors used in Viewport, counter-style, etc). The ones that overlap may have different meaning. for example the zoom property is different to the zoom descriptor used by Viewport.
It would be great to be able to move out any descriptors left in the property list and either put them in their own section with which at-rule they belong to, or make them children of entry inside the atDirectives elements.
Activity
dstorey commentedon Nov 25, 2015
Something else to add to this. <picture> element has a <source> element child. For <video> and <audio> only src and type are valid. For <picture> there is also srcset (but not src), sizes, and media. I didn't want to add those to the <source> auto-complete as it'd be confusing, but currently there is no way to add them only if only picture, and not audio or video are the parent.
Tyriar commentedon Nov 25, 2015
So there are these cases:
Any other ones you can think of?
dstorey commentedon Nov 25, 2015
There is SVG specific elements only being valid if inside an svg element if we add those, but that could be covered by point two if done generally enough.
To cover aria, point 1 would have to also depend on the value of an attribute. i.e. if role="foo" then the aria-bar attribute is valid.
dstorey commentedon Dec 14, 2015
This is probably beyond this particular issue as it related to CSS, not HTML, but there are CSS descriptors, which are like properties but used within at-rules. Think src, which is used in font-face but isn't a generic CSS property that can be used outside. There are a number of these; some that overlap with regular properties (e.g. font-family descriptor) and some that don't (aforementioned src, plus various descriptors used in Viewport, counter-style, etc). The ones that overlap may have different meaning. for example the zoom property is different to the zoom descriptor used by Viewport.
It would be great to be able to move out any descriptors left in the property list and either put them in their own section with which at-rule they belong to, or make them children of entry inside the atDirectives elements.
egamma commentedon Dec 14, 2015
Martin Aeschlimann (@aeschli) fyi
[-]HTML intellisense should be more context aware[/-][+][html] intellisense should be more context aware[/+]