Open romainmenke opened 6 days ago
If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your repository rather than pasting code. Otherwise, please paste relevant short snippets below.
// abcd
const less = require('postcss-less'); const scss = require('postcss-scss'); const postcss = require('postcss'); const assert = require('assert'); const test = require('node:test'); test('css', async () => { await postcss([]).process(`/* a */`, { from: null }).then((result) => { result.root.walkComments((comment) => { assert.deepStrictEqual( comment.source.start, { column: 1, line: 1, offset: 0 } ) assert.deepStrictEqual( comment.source.end, { column: 7, line: 1, offset: 7 } ) }) }) }) test('scss', async () => { await postcss([]).process(`// abcd`, { syntax: scss, from: null }).then((result) => { result.root.walkComments((comment) => { assert.deepStrictEqual( comment.source.start, { column: 1, line: 1, offset: 0 } ) assert.deepStrictEqual( comment.source.end, { column: 7, line: 1, offset: 7 } ) }) }) }) test('less', async () => { await postcss([]).process(`// abcd`, { syntax: less, from: null }).then((result) => { result.root.walkComments((comment) => { assert.deepStrictEqual( comment.source.start, { column: 1, line: 1, offset: 0 } ) // errors here assert.deepStrictEqual( comment.source.end, { column: 7, line: 1, offset: 7 } ) }) }) })
✖ less (1.246167ms) AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected { + column: 4, - column: 7, line: 1, + offset: 3 - offset: 7 }
I expected postcss-less to have accurate source positioning for inline comments
postcss-less
postcss-less has incorrect positions
Run the code above. It is a minimal test showing the behavior in:
postcss-scss
Would be happy to have a contribution to resolve this issue. I don't have much time for maintenance these days.
If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your repository rather than pasting code. Otherwise, please paste relevant short snippets below.
LESS
JavaScript
Errors
Expected Behavior
I expected
postcss-less
to have accurate source positioning for inline commentsActual Behavior
postcss-less
has incorrect positionsHow can we reproduce the behavior?
Run the code above. It is a minimal test showing the behavior in:
postcss-scss
with the exact same inline commentpostcss-less
with the exact same inline comment