-
-
Notifications
You must be signed in to change notification settings - Fork 655
feat(language_server): introduce ServerFormatter
#13700
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
feat(language_server): introduce ServerFormatter
#13700
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #13700 will not alter performanceComparing Summary
|
80c4f06
to
42a1b9b
Compare
ce97ea7
to
fc596f4
Compare
f4c7ef3
to
8ca332f
Compare
fc596f4
to
3798dad
Compare
3798dad
to
3b08bf6
Compare
df1a8d1
to
a2bf52e
Compare
ServerFormatter
ServerFormatter
a2bf52e
to
76c2729
Compare
3b08bf6
to
179e34f
Compare
76c2729
to
940f6f4
Compare
f391c08
to
b988882
Compare
940f6f4
to
f05a0f8
Compare
64fafe3
to
bdbd19b
Compare
f05a0f8
to
a6f11d8
Compare
bdbd19b
to
5bf9ca8
Compare
ddf7c62
to
5ad6d97
Compare
cb54a80
to
c1e00fd
Compare
dabd34c
to
4649c44
Compare
4649c44
to
dc700f5
Compare
c1e00fd
to
694413b
Compare
694413b
to
325422e
Compare
7854fef
to
e9ea470
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces experimental formatter support to the OXC language server, adding the ServerFormatter
struct and configuring it to be enabled via the fmt.experimental
configuration option. The formatter integration uses dynamic LSP capability registration to conditionally advertise formatting support to clients.
- Adds
ServerFormatter
withrun_single
method for formatting files - Introduces
fmt.experimental
configuration option for enabling the formatter - Implements dynamic capability registration for
textDocument/formatting
when formatter is enabled
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
worker.rs | Adds formatter state management and configuration handling to WorkspaceWorker |
main.rs | Implements LSP formatting endpoint and dynamic capability registration |
formatter/server_formatter.rs | Core formatter implementation with file processing logic |
formatter/options.rs | Configuration parsing for formatter experimental flag |
capabilities.rs | Enables dynamic formatting capability support |
options.rs | Adds test for new fmt.experimental configuration option |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
e9ea470
to
58926e6
Compare
Merge activity
|
First try on formatter integration. The server will only tell the client, that is supports `formatting` when `fmt.experimental` is `true`. It will respect the flag in `initialize`, `did_change_configuration` (changing configuration), or `did_change_workspace_folders`. It will not tell the client, it does not support formatting when the configuration is changed to `false`. This can be optimized but has no high priority, because the client needs to send the request and the `ServerFormatter` needs to be set. The last requirement is then false. Make `WorkspaceWorker.option` optional, so we the servers knows when the configuration in `initialize` or `initialized` (with `request_workspace_configuration`). Before the server knew it, by looking at the `WorkspaceWorker.server_linter` instance.
58926e6
to
a21ff54
Compare
First try on formatter integration.
The server will only tell the client, that is supports
formatting
whenfmt.experimental
istrue
.It will respect the flag in
initialize
,did_change_configuration
(changing configuration), ordid_change_workspace_folders
.It will not tell the client, it does not support formatting when the configuration is changed to
false
.This can be optimized but has no high priority, because the client needs to send the request and the
ServerFormatter
needs to be set. The last requirement is then false.Make
WorkspaceWorker.option
optional, so we the servers knows when the configuration ininitialize
orinitialized
(withrequest_workspace_configuration
). Before the server knew it, by looking at theWorkspaceWorker.server_linter
instance.