Skip to content

Feature Request: get new cursor position after formatting #249

Open
@verhovsky

Description

@verhovsky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurevscodeRelated to the VSCode Extension

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions