sql-formatter-org / sql-formatter-org/sql-formatter
Feature Request: get new cursor position after formatting
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
Describe the Feature
We're using sql-formatter in a text box but after formatting the cursor is moved to the beginning. I would like to be able to pass the cursor's current position (as either an integer index or a line, column pair) before formatting and get the formatted query along with the cursor's new position after formatting so that the cursor stays in the logical place in the formatted code.
Supporting multiple cursors would be a bonus.
Why do you want this feature?
It's annoying when you have to move your cursor back after formatting, especially when your SQL query is very long. This would be useful for the VS Code extension.
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 reviewing the formatter API and the VS Code extension integration mentioned in the request, then determine where the current cursor position can be accepted and returned. Done means formatting preserves the cursor's logical position, with integer or line-and-column input supported; multiple cursors are optional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100