Skip to content

validator: Report missing required attribute diagnostic for block header (not whole body) #1444

Open
@radeksimko

Description

@radeksimko

Context

Currently, whenever there is a missing required attribute we attach a diagnostic to the body which expected the attribute. While this is semantically correct (from the perspective that required attributes are defined by the body), it is usually unhelpful to the user, because:

  1. bodies can be very long, so we end up underlining a lot of code which isn't necessarily causing the problem
  2. we may end up hiding diagnostics related to other declared attributes within the body (e.g. deprecation) due to ^
Screenshot 2023-10-04 at 09 49 54

Proposal

Associate the range for "missing required attribute" diagnostic with the header of the block, i.e. in the example above resource "aws_security_group_rule" "name", rather than the body (i.e. code between { and }).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions