Skip to content

Conversation

Sysix
Copy link
Member

@Sysix Sysix commented Oct 15, 2025

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

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 15, 2025
Copy link
Member Author

Sysix commented Oct 15, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch 2 times, most recently from fb75940 to 61a7ade Compare October 16, 2025 19:52
@Sysix Sysix force-pushed the 10-15-feat_editor_support_oxc.fmt.configpath_configuration branch from 55fd06f to b4880dc Compare October 16, 2025 19:57
@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch 2 times, most recently from ae1f3d7 to eb0a9e2 Compare October 16, 2025 20:00
@Sysix Sysix changed the base branch from 10-15-feat_editor_support_oxc.fmt.configpath_configuration to graphite-base/14645 October 16, 2025 20:04
@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from eb0a9e2 to 82cfd20 Compare October 16, 2025 20:47
@Sysix Sysix force-pushed the graphite-base/14645 branch from b4880dc to 65faf92 Compare October 16, 2025 20:47
@Sysix Sysix changed the base branch from graphite-base/14645 to 10-15-feat_editor_support_oxc.fmt.configpath_configuration October 16, 2025 20:47
@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch 2 times, most recently from 7e6b7af to ea19c06 Compare October 17, 2025 10:12
graphite-app bot pushed a commit that referenced this pull request Oct 17, 2025
…#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
@graphite-app graphite-app bot changed the base branch from 10-15-feat_editor_support_oxc.fmt.configpath_configuration to graphite-base/14645 October 17, 2025 11:05
@graphite-app graphite-app bot force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from ea19c06 to c4ce08f Compare October 17, 2025 11:10
@graphite-app graphite-app bot force-pushed the graphite-base/14645 branch from 65faf92 to 8b322d4 Compare October 17, 2025 11:10
@graphite-app graphite-app bot changed the base branch from graphite-base/14645 to main October 17, 2025 11:10
@graphite-app graphite-app bot force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from c4ce08f to 43b72c8 Compare October 17, 2025 11:11
@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch 2 times, most recently from 118fab8 to 011f186 Compare October 17, 2025 12:52
@Sysix Sysix requested a review from Copilot October 17, 2025 12:55
Copy link
Contributor

@Copilot Copilot AI left a 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.

@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch 2 times, most recently from 59f8947 to 18626c3 Compare October 17, 2025 16:49
@Sysix Sysix requested a review from Copilot October 17, 2025 16:52
Copy link
Contributor

@Copilot Copilot AI left a 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.

@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from 18626c3 to e07da87 Compare October 17, 2025 16:56
@Sysix Sysix marked this pull request as ready for review October 17, 2025 17:04
@Sysix Sysix requested a review from camc314 as a code owner October 17, 2025 17:04
@Sysix Sysix force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from e07da87 to 74ad10b Compare October 18, 2025 09:13
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Oct 18, 2025
Copy link
Contributor

camc314 commented Oct 18, 2025

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
@graphite-app graphite-app bot force-pushed the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch from 74ad10b to 699c91c Compare October 18, 2025 10:50
@graphite-app graphite-app bot merged commit 699c91c into main Oct 18, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 10-15-refactor_language_server_improve_file_watching_for_different_tools branch October 18, 2025 10:55
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants