-
-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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)
tree-sitter 0.24.3 (bdfe32402e85673bbc693216f0a6ef72c98bb665)
Describe the bug
All attribute selectors in CSS are allowed to have class name selectors attached to it. For example, adding a :hover. But the parser fails with ERROR nodes.
It seems any selector after the attribute selector [a="b"] if it is within a pseudo_class_selector :host(....) fails. That should be pass.
This is needed to support HTML Web Components, where :host and :host-context are used to decorate the components. These two are missing from tree-sitter-css which accept selectors as parameters.
Steps To Reproduce/Bad Parse Tree
(stylesheet [0, 0] - [1, 1]
(rule_set [0, 0] - [1, 1]
(selectors [0, 0] - [0, 20]
(pseudo_class_selector [0, 0] - [0, 20]
(class_name [0, 1] - [0, 5])
(arguments [0, 5] - [0, 20]
(grid_value [0, 6] - [0, 13]
(plain_value [0, 7] - [0, 12]))
(ERROR [0, 13] - [0, 14])
(plain_value [0, 14] - [0, 19]))))
(block [0, 21] - [1, 1])))
Expected Behavior/Parse Tree
I expect a class_name to be attached after the attribute selector [a="b"].
(stylesheet [0, 0] - [5, 1]
(rule_set [0, 0] - [2, 1]
(selectors [0, 0] - [0, 14]
(pseudo_class_selector [0, 0] - [0, 14]
(class_name [0, 1] - [0, 5])
(arguments [0, 5] - [0, 14]
(grid_value [0, 6] - [0, 13]
(plain_value [0, 7] - [0, 12])))))
(class_name [3, 8] - [3, 13])))
Repro
:host([a="b"]:hover) {
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working