Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Dec 4, 2025

This PR refactors the linter's fix message handling by removing the Option wrapper from FixedContent.message and prefilling messages earlier in the processing pipeline. The change simplifies code action generation by moving the fallback message logic from fix_content_to_code_action into message_to_lsp_diagnostic, where fix messages are now populated before being converted to FixedContent.

The goal in the next PR is that the alternative message (from diagnostic) is no longer be stored in memory. So the title should be updated beforehand.

@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 Dec 4, 2025
Copy link
Member Author

Sysix commented Dec 4, 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.

Copy link
Contributor

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 linter's fix message handling by removing the Option wrapper from FixedContent.message and prefilling messages earlier in the processing pipeline. The change simplifies code action generation by moving the fallback message logic from fix_content_to_code_action into message_to_lsp_diagnostic, where fix messages are now populated before being converted to FixedContent.

Key changes:

  • Changed FixedContent.message from Option<String> to String and prefill missing messages in message_to_lsp_diagnostic
  • Updated message_to_lsp_diagnostic to take ownership of Message to enable in-place fix modification
  • Optimized iterator usage by changing .iter() to .into_iter() when consuming owned collections

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/linter/server_linter.rs Removed alternative_message parameter from apply_fix_code_actions call
crates/oxc_language_server/src/linter/isolated_lint_handler.rs Changed .iter() to .into_iter() for owned Vec<Message> collections
crates/oxc_language_server/src/linter/error_with_position.rs Changed FixedContent.message to String, added message prefilling logic, and updated helper functions
crates/oxc_language_server/src/linter/code_actions.rs Simplified by removing alternative message parameter and fallback logic, updated debug assertions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app graphite-app bot force-pushed the 12-04-refactor_oxlint_lsp_store_option_vec_fixedcontent_for_diagnosticreport_code_action_part branch 2 times, most recently from 648a732 to c82b7b0 Compare December 4, 2025 20:07
@graphite-app graphite-app bot force-pushed the 12-04-refactor_oxlint_lsp_prefill_fixedcontent.message_and_remove_option_wrapper branch from a9c99e4 to f005b63 Compare December 4, 2025 20:07
@Sysix Sysix force-pushed the 12-04-refactor_oxlint_lsp_prefill_fixedcontent.message_and_remove_option_wrapper branch from f005b63 to 1372fde Compare December 4, 2025 20:36
@Sysix Sysix force-pushed the 12-04-refactor_oxlint_lsp_store_option_vec_fixedcontent_for_diagnosticreport_code_action_part branch from c82b7b0 to 058e234 Compare December 4, 2025 20:36
@Sysix Sysix marked this pull request as ready for review December 4, 2025 20:43
@Sysix Sysix requested a review from camc314 as a code owner December 4, 2025 20:43
@camc314 camc314 self-assigned this Dec 5, 2025
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 5, 2025
Copy link
Contributor

camc314 commented Dec 5, 2025

Merge activity

  • Dec 5, 1:47 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 5, 1:47 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Dec 5, 1:58 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 5, 1:58 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Dec 5, 2:09 PM UTC: Merged by the Graphite merge queue.

@graphite-app graphite-app bot force-pushed the 12-04-refactor_oxlint_lsp_store_option_vec_fixedcontent_for_diagnosticreport_code_action_part branch from 058e234 to 316ef44 Compare December 5, 2025 13:50
graphite-app bot pushed a commit that referenced this pull request Dec 5, 2025
…on` wrapper (#16515)

> This PR refactors the linter's fix message handling by removing the Option wrapper from FixedContent.message and prefilling messages earlier in the processing pipeline. The change simplifies code action generation by moving the fallback message logic from fix_content_to_code_action into message_to_lsp_diagnostic, where fix messages are now populated before being converted to FixedContent.

The goal in the next PR is that the alternative message (from diagnostic) is no longer be stored in memory. So the title should be updated beforehand.
@graphite-app graphite-app bot force-pushed the 12-04-refactor_oxlint_lsp_prefill_fixedcontent.message_and_remove_option_wrapper branch from 1372fde to fde0e2e Compare December 5, 2025 13:50
Base automatically changed from 12-04-refactor_oxlint_lsp_store_option_vec_fixedcontent_for_diagnosticreport_code_action_part to main December 5, 2025 13:55
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 5, 2025
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 5, 2025
…on` wrapper (#16515)

> This PR refactors the linter's fix message handling by removing the Option wrapper from FixedContent.message and prefilling messages earlier in the processing pipeline. The change simplifies code action generation by moving the fallback message logic from fix_content_to_code_action into message_to_lsp_diagnostic, where fix messages are now populated before being converted to FixedContent.

The goal in the next PR is that the alternative message (from diagnostic) is no longer be stored in memory. So the title should be updated beforehand.
@graphite-app graphite-app bot force-pushed the 12-04-refactor_oxlint_lsp_prefill_fixedcontent.message_and_remove_option_wrapper branch from fde0e2e to e887d24 Compare December 5, 2025 14:05
@graphite-app graphite-app bot merged commit e887d24 into main Dec 5, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 12-04-refactor_oxlint_lsp_prefill_fixedcontent.message_and_remove_option_wrapper branch December 5, 2025 14:09
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 5, 2025
taearls pushed a commit to taearls/oxc that referenced this pull request Dec 11, 2025
…on` wrapper (oxc-project#16515)

> This PR refactors the linter's fix message handling by removing the Option wrapper from FixedContent.message and prefilling messages earlier in the processing pipeline. The change simplifies code action generation by moving the fallback message logic from fix_content_to_code_action into message_to_lsp_diagnostic, where fix messages are now populated before being converted to FixedContent.

The goal in the next PR is that the alternative message (from diagnostic) is no longer be stored in memory. So the title should be updated beforehand.
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.

3 participants