Don't show invisibles from inlays (#32088)
Closes #24266 Release Notes: - Whitespace added by inlay hints is no longer shown when `"show_whitespaces": "all"` is used. -
This commit is contained in:
parent
7d54d9f45e
commit
2c5aa5891d
5 changed files with 15 additions and 1 deletions
|
@ -639,6 +639,7 @@ pub struct HighlightedChunk<'a> {
|
|||
pub text: &'a str,
|
||||
pub style: Option<HighlightStyle>,
|
||||
pub is_tab: bool,
|
||||
pub is_inlay: bool,
|
||||
pub replacement: Option<ChunkReplacement>,
|
||||
}
|
||||
|
||||
|
@ -652,6 +653,7 @@ impl<'a> HighlightedChunk<'a> {
|
|||
let style = self.style;
|
||||
let is_tab = self.is_tab;
|
||||
let renderer = self.replacement;
|
||||
let is_inlay = self.is_inlay;
|
||||
iter::from_fn(move || {
|
||||
let mut prefix_len = 0;
|
||||
while let Some(&ch) = chars.peek() {
|
||||
|
@ -667,6 +669,7 @@ impl<'a> HighlightedChunk<'a> {
|
|||
text: prefix,
|
||||
style,
|
||||
is_tab,
|
||||
is_inlay,
|
||||
replacement: renderer.clone(),
|
||||
});
|
||||
}
|
||||
|
@ -693,6 +696,7 @@ impl<'a> HighlightedChunk<'a> {
|
|||
text: prefix,
|
||||
style: Some(invisible_style),
|
||||
is_tab: false,
|
||||
is_inlay,
|
||||
replacement: Some(ChunkReplacement::Str(replacement.into())),
|
||||
});
|
||||
} else {
|
||||
|
@ -716,6 +720,7 @@ impl<'a> HighlightedChunk<'a> {
|
|||
text: prefix,
|
||||
style: Some(invisible_style),
|
||||
is_tab: false,
|
||||
is_inlay,
|
||||
replacement: renderer.clone(),
|
||||
});
|
||||
}
|
||||
|
@ -728,6 +733,7 @@ impl<'a> HighlightedChunk<'a> {
|
|||
text: remainder,
|
||||
style,
|
||||
is_tab,
|
||||
is_inlay,
|
||||
replacement: renderer.clone(),
|
||||
})
|
||||
} else {
|
||||
|
@ -984,6 +990,7 @@ impl DisplaySnapshot {
|
|||
text: chunk.text,
|
||||
style: highlight_style,
|
||||
is_tab: chunk.is_tab,
|
||||
is_inlay: chunk.is_inlay,
|
||||
replacement: chunk.renderer.map(ChunkReplacement::Renderer),
|
||||
}
|
||||
.highlight_invisibles(editor_style)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue