Skip to content

bug: new attr() syntax with <attr-datatype> emits a warning #75

@marchbox

Description

@marchbox

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-css

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

CSS' attr() function has an updated syntax, which allows developers to define the type when parsing the value of an attribute:

inline-size: attr(data-progress type(<percentage>), 0%);

https://developer.mozilla.org/en-US/docs/Web/CSS/attr

Currently, when tree-sitter-css parses a CSS file, the < and > in the following line cause a warning:

@supports (inline-size: attr(data-progress type(<percentage>), 0%)) {

Invalid CSS from line A column B to line X column Y

Steps To Reproduce/Bad Parse Tree

Parse the following code:

@supports (inline-size: attr(data-progress type(<percentage>), 0%)) {
  .progress-bar {
    inline-size: attr(data-progress type(<percentage>), 0%)
  }
}

Expected Behavior/Parse Tree

The parser should not emit a warning.

Repro

@supports (inline-size: attr(data-progress type(<percentage>), 0%)) {
  .progress-bar {
    inline-size: attr(data-progress type(<percentage>), 0%)
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions