Skip to content

Ensure selection start is retained when range formatting - #2993

Merged
jwortmann merged 2 commits into
sublimelsp:mainfrom
jwortmann:fix-formatting-selection
Jul 18, 2026
Merged

jwortmann merged 2 commits into
sublimelsp:mainfrom
jwortmann:fix-formatting-selection

Conversation

@jwortmann

Copy link
Copy Markdown
Member

Fixes #2986

Workaround for what I would call a bug in the Ruff formatter, which modifies content outside of the range to format.

@rwols

rwols commented Jul 16, 2026

Copy link
Copy Markdown
Member

What effect does this have on other formatters? Have you test-driven a few?

@jwortmann

Copy link
Copy Markdown
Member Author

No, I have only tested with Ruff. But unless I missed anything important, I think it should be pretty safe, given that the selection is only modified here if its start point does not match the expected start point anymore.

@rwols

rwols commented Jul 16, 2026

Copy link
Copy Markdown
Member

Let me try with clangd, jdtls, and Roslyn first

@jwortmann
jwortmann merged commit 46eed35 into sublimelsp:main Jul 18, 2026
9 checks passed
@jwortmann
jwortmann deleted the fix-formatting-selection branch July 18, 2026 11:33
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

Successfully merging this pull request may close these issues.

lsp_format_document_range selection is broken after formating

2 participants