Skip to content

[html] intellisense should be more context aware #375

Open

Description

@Tyriar

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>)

Activity

  1. added
    feature-request
    on Nov 23, 2015
  2. dstorey commented on Nov 25, 2015

    @dstorey
    Member

    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.

  3. Tyriar commented on Nov 25, 2015

    @Tyriar
    ContributorAuthor

    So there are these cases:

    • Some attributes aren't valid in certain tags
    • Some tags aren't valid in certain tags
    • Some tags have attributes that are only available given certain parent tags

    Any other ones you can think of?

  4. dstorey commented on Nov 25, 2015

    @dstorey
    Member

    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.

  5. dstorey commented on Dec 14, 2015

    @dstorey
    Member

    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.

  6. egamma commented on Dec 14, 2015

    @egamma
    Member
  7. changed the title [-]HTML intellisense should be more context aware[/-] [+][html] intellisense should be more context aware[/+] on Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requesthtml

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions