Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Text format to return edited ranges instead of entire document#579

Merged
leecannon merged 4 commits intozigtools:masterfrom
jefftime:master
Aug 23, 2022
Merged

Text format to return edited ranges instead of entire document#579
leecannon merged 4 commits intozigtools:masterfrom
jefftime:master

Conversation

@jefftime
Copy link
Contributor

@jefftime jefftime commented Aug 13, 2022

This pull request addresses the current behavior of ZLS's text formatting. Currently, ZLS will return the result of zig fmt as the replacement text for the entire range of the document. This causes odd issues in certain text editors such as Helix which lose cursor position due to the whole document being changed

This pull request adds the ability to compare the input text and the zig fmt output in order to get proper text edit ranges. I am not an expert on the LSP specification by any means, but I believe this is more in mind with how text formatting is supposed to behave. In most cases it should allow for smaller messages between the client and server as well

@leecannon
Copy link
Member

You are going to need to rebase on master to get the CI passing.

@jefftime
Copy link
Contributor Author

@leecannon Done

Copy link
Member

@leecannon leecannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine in vscode, I'm not setup for testing in any other editor.

@leecannon leecannon merged commit 163409f into zigtools:master Aug 23, 2022
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.

2 participants