Skip to content
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

offset is missing from node.source #105

Closed
romainmenke opened this issue Nov 11, 2024 · 4 comments
Closed

offset is missing from node.source #105

romainmenke opened this issue Nov 11, 2024 · 4 comments

Comments

@romainmenke
Copy link

romainmenke commented Nov 11, 2024

For example:

end: { column: last[5], line: last[4] },

While the default PostCSS parser for example has:
https://github.com/postcss/postcss/blob/77420d62919b4d53921a113bbc939ad5e5b49fe6/lib/parser.js#L361

  getPosition(offset) {
    let pos = this.input.fromOffset(offset)
    return {
      column: pos.col,
      line: pos.line,
      offset
    }
  }

offset was likely added later in PostCSS and wasn't backported to this syntax.

This is not trivial to fix because the tokenizer also doesn't record the offset values in tokens.
I think this issue is fairly minor, but maybe someone is willing to volunteer their time :) (I don't use sugarss myself)

@ai
Copy link
Member

ai commented Nov 11, 2024

I will also fix sugarss by adding offset

@ai
Copy link
Member

ai commented Nov 20, 2024

Fixed by #108

@ai ai closed this as completed Nov 20, 2024
@ai
Copy link
Member

ai commented Nov 20, 2024

The fix was released in 5.0.

@romainmenke
Copy link
Author

Thank you @ai and @RamazanIttiev 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants