-
Notifications
You must be signed in to change notification settings - Fork 280
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
Handle "textDocument/rangeFormatting" and "textDocument/onTypeFormatting" #1805
Comments
Synced to Apple’s issue tracker as rdar://139287738 |
@ahoppen How would you like I quite like the Xcode formatting behavior, so not sure if any of your colleagues working on Xcode can provide some tips about this. What I did for the vknabel formatter extensions was to perform a format of the whole file after hitting "return" on non-empty lines. But that formatted the whole file, not just some certain lines (this was before the selection-formatting PR being merged into swift-format). I guess we could start with that "perform a format of the whole file after hitting "return" on non-empty lines" although I'd like to leverage the selection-formatting capabilities. |
What do you think of running swift-format on the line that we receive the Anyway, I think we would need to get a feel for this, so I’d implement it behind an experimental feature and then use it for a while to see how it feels and if we have improvement ideas. |
@ahoppen why the reopen? Curious 🙂 |
Because it’s gated behind the experimental feature and thus not generally available. |
Description
Now that swift-format has some support for range formatting, sourcekit-lsp can implement handling these requests as well.
This will elevate the VSCode formatting experience since the VSCode extension is calling through to sourcekit-lsp for formatting.
sourcekit-lsp seems to already have some support for these. Just the logic isn't implemented.
For example there are some existing
DocumentRangeFormattingRequest
andDocumentOnTypeFormattingRequest
types.The text was updated successfully, but these errors were encountered: