-
-
Notifications
You must be signed in to change notification settings - Fork 719
perf(language_server): pass file content as a referenced String
#15568
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
base: main
Are you sure you want to change the base?
perf(language_server): pass file content as a referenced String
#15568
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. |
StringString
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 optimizes performance by passing file content as a reference (&String) instead of by value (String) throughout the language server's diagnostic and formatting functions. This avoids unnecessary string clones when passing file content through the call chain.
Key changes:
- Updated trait method signatures in the
Tooltrait to acceptOption<&String>instead ofOption<String> - Modified all implementations and call sites to use referenced strings
- Added temporary variable handling in the formatter to manage lifetime requirements
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_language_server/src/worker.rs | Updated worker methods to pass content as references using .as_ref() |
| crates/oxc_language_server/src/tool.rs | Changed trait method signatures to accept Option<&String> instead of Option<String> |
| crates/oxc_language_server/src/linter/server_linter.rs | Updated linter implementations to accept referenced strings |
| crates/oxc_language_server/src/linter/isolated_lint_handler.rs | Modified to handle referenced strings with temporary lifetime management |
| crates/oxc_language_server/src/formatter/server_formatter.rs | Added temporary variable to manage string lifetimes when reading from filesystem |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
32d2937 to
c486039
Compare
camc314
left a comment
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.
why &String vs &str
c486039 to
de9fe05
Compare
|
@camc314 updated the code to use |
de9fe05 to
f0f0063
Compare
Uh oh!
There was an error while loading. Please reload this page.