feat: Report end indices for nodes#83
Merged
Merged
Conversation
Contributor
Author
|
Test results: |
7 tasks
|
Thanks for you great work. We need this. The project doesn't seem to be active, let me make a friendly ping @alexander-akait. |
Collaborator
|
@TrySound Need you attention, thanks |
|
Maybe the owner is not still watching this project. |
Collaborator
|
@yoyo837 Let's wait today, ping me if we will not answer tomorrow, I will then take over the issue |
Okay, thank you. 💗 |
alexander-akait
approved these changes
Nov 26, 2021
alexander-akait
left a comment
Collaborator
There was a problem hiding this comment.
Anyway, looks good
|
Let's have a merge. @alexander-akait 🚀 |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.