-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Report end indices for nodes #83
Conversation
Test results:
|
Thanks for you great work. We need this. The project doesn't seem to be active, let me make a friendly ping @alexander-akait. |
@TrySound Need you attention, thanks |
Maybe the owner is not still watching this project. |
@yoyo837 Let's wait today, ping me if we will not answer tomorrow, I will then take over the issue |
Okay, thank you. 💗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, looks good
Let's have a merge. @alexander-akait 🚀 |
Follow-up on #12, needed for stylelint/stylelint#5694
We're implementing range reporting in Stylelint, and as such, need ways to know not just the starting index of a node, but its end index. This isn't as straightforward as looking at the start of the next node, or even the end of the declaration value. Functions may or may not have closing parentheses, which affects where the end is. Nested nodes or functions make it difficult to know downstream precisely where the end of a nested node is.
This PR adds an end index to every token/node. To be as accurate as possible, instead of implementing the feature first, I went through each test case manually and set the expected end indices where they should be. Then, I implemented the feature such that it would make all the test cases pass. This was possible due to how comprehensive the tests are.