Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix off-by-one error in RangeFormatting #19124

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Feb 9, 2025

fixes #19123.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 9, 2025
@jyn514
Copy link
Member Author

jyn514 commented Feb 9, 2025

the test doesn't actually verify that rust-analyzer applies the range returned from rustfmt correctly, but i tested locally that it does.

oh, i was confused. RA never does IO. the editor takes the returned JSON and applies it to the file. so this is testing everything it should, just a little indirectly.

@jyn514 jyn514 force-pushed the range-fmt-off-by-one branch from e7fe148 to 85d4823 Compare February 9, 2025 20:13
@jyn514 jyn514 force-pushed the range-fmt-off-by-one branch from 85d4823 to 56dd8d1 Compare February 9, 2025 20:24
@jyn514 jyn514 force-pushed the range-fmt-off-by-one branch from 56dd8d1 to 66253b6 Compare February 9, 2025 21:34
jyn514 added a commit to jyn514/dotfiles that referenced this pull request Feb 9, 2025
- fix indent detection
- keybinding for triggering completion
- fix false error running remote-git-url
- show line/column in statusbar
- show blame for current line
- add keybinding to format whole file
- enable range formatting on nightly
	- note this won't work until
	  rust-lang/rust-analyzer#19124 is
	  merged
@Veykril
Copy link
Member

Veykril commented Feb 10, 2025

Thanks!

@Veykril Veykril added this pull request to the merge queue Feb 10, 2025
Merged via the queue into rust-lang:master with commit f5e7172 Feb 10, 2025
9 checks passed
@jyn514 jyn514 deleted the range-fmt-off-by-one branch February 13, 2025 01:49
@lnicola lnicola changed the title Fix off-by-one error in RangeFormatting fix: Fix off-by-one error in RangeFormatting Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ranges for textDocument/rangeFormatting are wrong
3 participants