You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I write a vsc extension want to implement go to definition, it require position info. I see that token already has pos property, would we also add to node.source filed?
I'd like to add absolute offsets to parsed node source positions for #251, using the token positions already produced by the tokenizer. I will cover multiline and nested selectors, plus the public type declaration, before opening a draft PR.
Activity
alexander-akait commentedon Dec 14, 2021
Why you need this on
mode.sourceproperty? Can you show AST which you expected?HairyRabbit commentedon Dec 14, 2021
I write css code in js via template string, like
the
tss.getDefinitionAndBoundSpanrequire position info,I need comput position base on template string node, css rule and selector. So I hope selector parser can provide
offsetjust like postcss:alexander-akait commentedon Dec 14, 2021
But you can calculate them
HairyRabbit commentedon Dec 14, 2021
sure, but I think it can implement when parse, or any api provide like
ts.getPositionFromLineAndColumnalexander-akait commentedon Dec 14, 2021
hm, do you need offset, because we have https://github.com/postcss/postcss-selector-parser/blob/master/src/parser.js#L49
HairyRabbit commentedon Dec 14, 2021
yes, I fork the code then add TOKEN.START_POS to getSource function and do some update with getTokenSource, looks fine for me.
alexander-akait commentedon Dec 14, 2021
PR welcome
deepanshupal commentedon Sep 26, 2026
I'd like to add absolute offsets to parsed node source positions for #251, using the token positions already produced by the tokenizer. I will cover multiline and nested selectors, plus the public type declaration, before opening a draft PR.