-
Notifications
You must be signed in to change notification settings - Fork 51
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
Would we add pos
to ast source property
#251
Comments
Why you need this on |
I write css code in js via template string, like const style = css`
.foo { color: red; }
`
style.foo
// ^---- click foo will jump to `.foo` selector the interface LanguageService {
getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
} I need comput position base on template string node, css rule and selector. So I hope selector parser can provide {
source: {
start: { offset: 0, line: 1, column: 1 }
}
} |
But you can calculate them |
sure, but I think it can implement when parse, or any api provide like |
hm, do you need offset, because we have https://github.com/postcss/postcss-selector-parser/blob/master/src/parser.js#L49 |
yes, I fork the code then add TOKEN.START_POS to getSource function and do some update with getTokenSource, looks fine for me. |
PR welcome |
Hi, I write a vsc extension want to implement
go to definition
, it require position info. I see that token already haspos
property, would we also add tonode.source
filed?The text was updated successfully, but these errors were encountered: