postcss-selector-parser icon indicating copy to clipboard operation
postcss-selector-parser copied to clipboard

`sourceIndex` on `Selector` nodes

Open romainmenke opened this issue 2 years ago • 2 comments

see : https://github.com/postcss/postcss-selector-parser/issues/36

I think this was previously also missing, was added and then removed again? Not entirely sure how to read that change and a lot of time has passed since then.

The TypeScript typings suggest that sourceIndex should exist on all nodes and should never be undefined.

Was there a specific reason why sourceIndex is missing, or should we just add it?

romainmenke avatar Jan 24 '24 17:01 romainmenke

I’ll answer honestly - I don’t remember :smile: Anyway if you found a bug, feel free to send a PR

alexander-akait avatar Jan 26 '24 11:01 alexander-akait

Cool!

I am currently working around it by doing selector.first.sourceIndex but that is a bit flaky and only works if the first node wasn't removed or altered.

I'll send a PR when I find some time 🙇

romainmenke avatar Jan 26 '24 11:01 romainmenke