The rangeStart and rangeEnd of prettier.format do not take work
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Environments:
- Prettier Version: 2.8.7
- Running Prettier via: Node.js API
- Runtime:Node.js v16.13.1
- Operating System: Windows
- Prettier plugins : prettier
Steps to reproduce:
- test text (index.less | scss | css)
.d42-visible {
display: block;
}
.d42-visible {
display: block;
}
.d42-visible {
display: block;
}
.d42-visible {
display: block;
}
- code
prettier.format(text, {
tabWidth: 2,
useTabs: false,
rangeStart: 76,
rangeEnd: 112,
parser: 'less'
})
Expected behavior:
Remove extra spaces in the third d42-visible
Actual behavior:
The text has not been entered with any changes
PS:(question)
- The following judgments are undefined.

2.Why can't rangeStart be equal to 0? The cursor position I obtained through codemirror can start at 0

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied LESS sample through the prettier.format Node.js API with rangeStart 76 and rangeEnd 112, then compare the output with the expected formatting of the third d42-visible block. Done means the selected range is formatted as expected and the documented behavior for a rangeStart of 0 is clarified or covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100