Fix resolve status conversion
This commit is contained in:
parent
bcaff0a18a
commit
dcf570bb03
9 changed files with 71 additions and 72 deletions
|
@ -471,14 +471,14 @@ impl DisplaySnapshot {
|
||||||
&self,
|
&self,
|
||||||
display_rows: Range<u32>,
|
display_rows: Range<u32>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> DisplayChunks<'_> {
|
) -> DisplayChunks<'_> {
|
||||||
self.block_snapshot.chunks(
|
self.block_snapshot.chunks(
|
||||||
display_rows,
|
display_rows,
|
||||||
language_aware,
|
language_aware,
|
||||||
Some(&self.text_highlights),
|
Some(&self.text_highlights),
|
||||||
inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -589,7 +589,7 @@ impl BlockSnapshot {
|
||||||
rows: Range<u32>,
|
rows: Range<u32>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
text_highlights: Option<&'a TextHighlights>,
|
text_highlights: Option<&'a TextHighlights>,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> BlockChunks<'a> {
|
) -> BlockChunks<'a> {
|
||||||
let max_output_row = cmp::min(rows.end, self.transforms.summary().output_rows);
|
let max_output_row = cmp::min(rows.end, self.transforms.summary().output_rows);
|
||||||
|
@ -623,7 +623,7 @@ impl BlockSnapshot {
|
||||||
input_start..input_end,
|
input_start..input_end,
|
||||||
language_aware,
|
language_aware,
|
||||||
text_highlights,
|
text_highlights,
|
||||||
inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
),
|
),
|
||||||
input_chunk: Default::default(),
|
input_chunk: Default::default(),
|
||||||
|
|
|
@ -652,7 +652,7 @@ impl FoldSnapshot {
|
||||||
range: Range<FoldOffset>,
|
range: Range<FoldOffset>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
text_highlights: Option<&'a TextHighlights>,
|
text_highlights: Option<&'a TextHighlights>,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> FoldChunks<'a> {
|
) -> FoldChunks<'a> {
|
||||||
let mut transform_cursor = self.transforms.cursor::<(FoldOffset, InlayOffset)>();
|
let mut transform_cursor = self.transforms.cursor::<(FoldOffset, InlayOffset)>();
|
||||||
|
@ -675,7 +675,7 @@ impl FoldSnapshot {
|
||||||
inlay_start..inlay_end,
|
inlay_start..inlay_end,
|
||||||
language_aware,
|
language_aware,
|
||||||
text_highlights,
|
text_highlights,
|
||||||
inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
),
|
),
|
||||||
inlay_chunk: None,
|
inlay_chunk: None,
|
||||||
|
|
|
@ -997,22 +997,21 @@ impl InlaySnapshot {
|
||||||
range: Range<InlayOffset>,
|
range: Range<InlayOffset>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
text_highlights: Option<&'a TextHighlights>,
|
text_highlights: Option<&'a TextHighlights>,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> InlayChunks<'a> {
|
) -> InlayChunks<'a> {
|
||||||
let mut cursor = self.transforms.cursor::<(InlayOffset, usize)>();
|
let mut cursor = self.transforms.cursor::<(InlayOffset, usize)>();
|
||||||
cursor.seek(&range.start, Bias::Right, &());
|
cursor.seek(&range.start, Bias::Right, &());
|
||||||
|
|
||||||
let empty_text_highlights = TextHighlights::default();
|
|
||||||
let text_highlights = text_highlights.unwrap_or_else(|| &empty_text_highlights);
|
|
||||||
|
|
||||||
let mut highlight_endpoints = Vec::new();
|
let mut highlight_endpoints = Vec::new();
|
||||||
|
if let Some(text_highlights) = text_highlights {
|
||||||
if !text_highlights.is_empty() {
|
if !text_highlights.is_empty() {
|
||||||
while cursor.start().0 < range.end {
|
while cursor.start().0 < range.end {
|
||||||
let transform_start = self
|
let transform_start = self.buffer.anchor_after(
|
||||||
.buffer
|
self.to_buffer_offset(cmp::max(range.start, cursor.start().0)),
|
||||||
.anchor_after(self.to_buffer_offset(cmp::max(range.start, cursor.start().0)));
|
);
|
||||||
let transform_start = self.to_inlay_offset(transform_start.to_offset(&self.buffer));
|
let transform_start =
|
||||||
|
self.to_inlay_offset(transform_start.to_offset(&self.buffer));
|
||||||
|
|
||||||
let transform_end = {
|
let transform_end = {
|
||||||
let overshoot = InlayOffset(range.end.0 - cursor.start().0 .0);
|
let overshoot = InlayOffset(range.end.0 - cursor.start().0 .0);
|
||||||
|
@ -1066,6 +1065,7 @@ impl InlaySnapshot {
|
||||||
highlight_endpoints.sort();
|
highlight_endpoints.sort();
|
||||||
cursor.seek(&range.start, Bias::Right, &());
|
cursor.seek(&range.start, Bias::Right, &());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let buffer_range = self.to_buffer_offset(range.start)..self.to_buffer_offset(range.end);
|
let buffer_range = self.to_buffer_offset(range.start)..self.to_buffer_offset(range.end);
|
||||||
let buffer_chunks = self.buffer.chunks(buffer_range, language_aware);
|
let buffer_chunks = self.buffer.chunks(buffer_range, language_aware);
|
||||||
|
@ -1078,7 +1078,7 @@ impl InlaySnapshot {
|
||||||
buffer_chunk: None,
|
buffer_chunk: None,
|
||||||
output_offset: range.start,
|
output_offset: range.start,
|
||||||
max_output_offset: range.end,
|
max_output_offset: range.end,
|
||||||
hint_highlight_style: inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
highlight_endpoints: highlight_endpoints.into_iter().peekable(),
|
highlight_endpoints: highlight_endpoints.into_iter().peekable(),
|
||||||
active_highlights: Default::default(),
|
active_highlights: Default::default(),
|
||||||
|
|
|
@ -224,7 +224,7 @@ impl TabSnapshot {
|
||||||
range: Range<TabPoint>,
|
range: Range<TabPoint>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
text_highlights: Option<&'a TextHighlights>,
|
text_highlights: Option<&'a TextHighlights>,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> TabChunks<'a> {
|
) -> TabChunks<'a> {
|
||||||
let (input_start, expanded_char_column, to_next_stop) =
|
let (input_start, expanded_char_column, to_next_stop) =
|
||||||
|
@ -246,7 +246,7 @@ impl TabSnapshot {
|
||||||
input_start..input_end,
|
input_start..input_end,
|
||||||
language_aware,
|
language_aware,
|
||||||
text_highlights,
|
text_highlights,
|
||||||
inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
),
|
),
|
||||||
input_column,
|
input_column,
|
||||||
|
|
|
@ -576,7 +576,7 @@ impl WrapSnapshot {
|
||||||
rows: Range<u32>,
|
rows: Range<u32>,
|
||||||
language_aware: bool,
|
language_aware: bool,
|
||||||
text_highlights: Option<&'a TextHighlights>,
|
text_highlights: Option<&'a TextHighlights>,
|
||||||
inlay_highlight_style: Option<HighlightStyle>,
|
hint_highlight_style: Option<HighlightStyle>,
|
||||||
suggestion_highlight_style: Option<HighlightStyle>,
|
suggestion_highlight_style: Option<HighlightStyle>,
|
||||||
) -> WrapChunks<'a> {
|
) -> WrapChunks<'a> {
|
||||||
let output_start = WrapPoint::new(rows.start, 0);
|
let output_start = WrapPoint::new(rows.start, 0);
|
||||||
|
@ -595,7 +595,7 @@ impl WrapSnapshot {
|
||||||
input_start..input_end,
|
input_start..input_end,
|
||||||
language_aware,
|
language_aware,
|
||||||
text_highlights,
|
text_highlights,
|
||||||
inlay_highlight_style,
|
hint_highlight_style,
|
||||||
suggestion_highlight_style,
|
suggestion_highlight_style,
|
||||||
),
|
),
|
||||||
input_chunk: Default::default(),
|
input_chunk: Default::default(),
|
||||||
|
|
|
@ -4882,7 +4882,6 @@ impl Editor {
|
||||||
if let Some(clipboard_selection) = clipboard_selections.get(ix) {
|
if let Some(clipboard_selection) = clipboard_selections.get(ix) {
|
||||||
let end_offset = start_offset + clipboard_selection.len;
|
let end_offset = start_offset + clipboard_selection.len;
|
||||||
to_insert = &clipboard_text[start_offset..end_offset];
|
to_insert = &clipboard_text[start_offset..end_offset];
|
||||||
dbg!(start_offset, end_offset, &clipboard_text, &to_insert);
|
|
||||||
entire_line = clipboard_selection.is_entire_line;
|
entire_line = clipboard_selection.is_entire_line;
|
||||||
start_offset = end_offset + 1;
|
start_offset = end_offset + 1;
|
||||||
original_indent_column =
|
original_indent_column =
|
||||||
|
@ -7586,7 +7585,7 @@ impl Editor {
|
||||||
|
|
||||||
let right_position = right_position.clone();
|
let right_position = right_position.clone();
|
||||||
ranges[start_ix..].iter().take_while(move |range| {
|
ranges[start_ix..].iter().take_while(move |range| {
|
||||||
document_to_inlay_range(range, &display_snapshot)
|
document_to_inlay_range(range, display_snapshot)
|
||||||
.start
|
.start
|
||||||
.cmp(&right_position)
|
.cmp(&right_position)
|
||||||
.is_le()
|
.is_le()
|
||||||
|
|
|
@ -1935,8 +1935,9 @@ impl InlayHints {
|
||||||
|
|
||||||
pub fn project_to_proto_hint(response_hint: InlayHint, cx: &AppContext) -> proto::InlayHint {
|
pub fn project_to_proto_hint(response_hint: InlayHint, cx: &AppContext) -> proto::InlayHint {
|
||||||
let (state, lsp_resolve_state) = match response_hint.resolve_state {
|
let (state, lsp_resolve_state) = match response_hint.resolve_state {
|
||||||
|
ResolveState::Resolved => (0, None),
|
||||||
ResolveState::CanResolve(server_id, resolve_data) => (
|
ResolveState::CanResolve(server_id, resolve_data) => (
|
||||||
0,
|
1,
|
||||||
resolve_data
|
resolve_data
|
||||||
.map(|json_data| {
|
.map(|json_data| {
|
||||||
serde_json::to_string(&json_data)
|
serde_json::to_string(&json_data)
|
||||||
|
@ -1947,7 +1948,6 @@ impl InlayHints {
|
||||||
value,
|
value,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
ResolveState::Resolved => (1, None),
|
|
||||||
ResolveState::Resolving => (2, None),
|
ResolveState::Resolving => (2, None),
|
||||||
};
|
};
|
||||||
let resolve_state = Some(proto::ResolveState {
|
let resolve_state = Some(proto::ResolveState {
|
||||||
|
|
|
@ -5091,7 +5091,7 @@ impl Project {
|
||||||
InlayHints::proto_to_project_hint(resolved_hint, &project, &mut cx)
|
InlayHints::proto_to_project_hint(resolved_hint, &project, &mut cx)
|
||||||
.await
|
.await
|
||||||
.map(Some)
|
.map(Some)
|
||||||
.context("inlay hints proto response conversion")
|
.context("inlay hints proto resolve response conversion")
|
||||||
}
|
}
|
||||||
None => Ok(None),
|
None => Ok(None),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue