perf(lsp): avoid String cloning for fs.get_document#21040
perf(lsp): avoid String cloning for fs.get_document#21040graphite-app[bot] merged 1 commit intomainfrom
String cloning for fs.get_document#21040Conversation
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. |
There was a problem hiding this comment.
Pull request overview
This PR optimizes the language server’s in-memory document handling by switching document text storage from owned String cloning to shared Arc<str>, reducing allocations/copies when retrieving documents from the LSP file system.
Changes:
- Change
TextDocument.textfromOption<String>toOption<Arc<str>>. - Store file contents in
LSPFileSystemasArc<str>and clone viaArc::cloneinget_document. - Update affected tests to construct document text using
Arc::from(...).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_language_server/src/lib.rs | Updates TextDocument API to use Option<Arc<str>> to enable cheap clones of document text. |
| crates/oxc_language_server/src/file_system.rs | Stores file contents as Arc<str> and returns TextDocument with Arc clones instead of String clones. |
| crates/oxc_language_server/src/worker.rs | Adjusts tests to match the new TextDocument::new(..., Option<Arc<str>>) signature. |
Merge activity
|
4f147e7 to
da6874a
Compare

No description provided.