-
-
Notifications
You must be signed in to change notification settings - Fork 688
refactor(language_server): improve file watching for different tools #14645
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
refactor(language_server): improve file watching for different tools #14645
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. |
fb75940
to
61a7ade
Compare
55fd06f
to
b4880dc
Compare
ae1f3d7
to
eb0a9e2
Compare
eb0a9e2
to
82cfd20
Compare
b4880dc
to
65faf92
Compare
7e6b7af
to
ea19c06
Compare
…#14509) The server now sends a request to the client, to watch for `.oxfmtrc.json` or custom configurable `fmt.configPath` file content changes. The client will send a `workspace/didChangeWatchedFiles` notification to the server. The client can also send `workspace/didChangeConfiguration`, for now the server will restart both tools. This will be optimized by looking at which tool is responsible for the file in #14645
ea19c06
to
c4ce08f
Compare
65faf92
to
8b322d4
Compare
c4ce08f
to
43b72c8
Compare
118fab8
to
011f186
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 refactors the file watching system in the language server to provide more granular control over different tools (linter and formatter) by implementing separate watch patterns and registration/unregistration mechanisms.
- Moves from a single workspace watcher to tool-specific watchers with unique IDs
- Implements individual registration and unregistration of file watchers
- Adds new methods to generate watch patterns for linter and formatter tools
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
crates/oxc_language_server/src/worker.rs | Refactors watcher initialization and configuration changes to use tool-specific patterns and registrations |
crates/oxc_language_server/src/linter/server_linter.rs | Adds methods to generate and compare watch patterns for linter configuration files |
crates/oxc_language_server/src/formatter/server_formatter.rs | Adds methods to generate and compare watch patterns for formatter configuration files |
crates/oxc_language_server/src/backend.rs | Updates configuration change handling to use new registration/unregistration system |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
59f8947
to
18626c3
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
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
18626c3
to
e07da87
Compare
e07da87
to
74ad10b
Compare
Merge activity
|
…14645) Now the worker is responsible to provide the dynamic registration with `Registration` and `Unregistration`. The worker will use the provided tools to detect the needed watcher changes. Before this PR, the server/Backend created the `Registration` struct for each worker, this was not great because we needed to register the watchers for the other tools too. Now every tool has its own `Registration.id` which can be unregistered. https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#client_registerCapability https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#client_unregisterCapability
74ad10b
to
699c91c
Compare
Now the worker is responsible to provide the dynamic registration with
Registration
andUnregistration
.The worker will use the provided tools to detect the needed watcher changes.
Before this PR, the server/Backend created the
Registration
struct for each worker, this was not great because we needed to register the watchers for the other tools too.Now every tool has its own
Registration.id
which can be unregistered.https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#client_registerCapability
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#client_unregisterCapability