Reduce amount of allocations in RustLsp label handling (#35786)
There can be a lot of completions after all Release Notes: - N/A
This commit is contained in:
parent
c397027ec2
commit
4dbd24d75f
9 changed files with 40 additions and 65 deletions
|
@ -73,7 +73,6 @@ use gpui::{
|
|||
App, AppContext, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Hsla, SharedString,
|
||||
Task, WeakEntity, Window,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
Buffer, BufferEvent, Capability, CodeLabel, CursorShape, DiagnosticSourceKind, Language,
|
||||
LanguageName, LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList,
|
||||
|
@ -113,7 +112,7 @@ use std::{
|
|||
|
||||
use task_store::TaskStore;
|
||||
use terminals::Terminals;
|
||||
use text::{Anchor, BufferId, OffsetRangeExt, Point};
|
||||
use text::{Anchor, BufferId, OffsetRangeExt, Point, Rope};
|
||||
use toolchain_store::EmptyToolchainStore;
|
||||
use util::{
|
||||
ResultExt as _,
|
||||
|
@ -668,10 +667,10 @@ pub enum ResolveState {
|
|||
}
|
||||
|
||||
impl InlayHint {
|
||||
pub fn text(&self) -> String {
|
||||
pub fn text(&self) -> Rope {
|
||||
match &self.label {
|
||||
InlayHintLabel::String(s) => s.to_owned(),
|
||||
InlayHintLabel::LabelParts(parts) => parts.iter().map(|part| &part.value).join(""),
|
||||
InlayHintLabel::String(s) => Rope::from(s),
|
||||
InlayHintLabel::LabelParts(parts) => parts.iter().map(|part| &*part.value).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ use git::{
|
|||
use git2::RepositoryInitOptions;
|
||||
use gpui::{App, BackgroundExecutor, SemanticVersion, UpdateGlobal};
|
||||
use http_client::Url;
|
||||
use itertools::Itertools;
|
||||
use language::{
|
||||
Diagnostic, DiagnosticEntry, DiagnosticSet, DiskState, FakeLspAdapter, LanguageConfig,
|
||||
LanguageMatcher, LanguageName, LineEnding, OffsetRangeExt, Point, ToPoint,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue