mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Don't render multi-line literal values
This commit is contained in:
parent
a39c0493a1
commit
5b696bac5c
2 changed files with 29 additions and 1 deletions
|
@ -564,7 +564,13 @@ pub(super) fn literal(sema: &Semantics<'_, RootDatabase>, token: SyntaxToken) ->
|
|||
|
||||
let mut s = format!("```rust\n{ty}\n```\n___\n\n");
|
||||
match value {
|
||||
Ok(value) => format_to!(s, "value of literal: {value}"),
|
||||
Ok(value) => {
|
||||
if let Some(newline) = value.find('\n') {
|
||||
format_to!(s, "value of literal (truncated up to newline): {}", &value[..newline])
|
||||
} else {
|
||||
format_to!(s, "value of literal: {value}")
|
||||
}
|
||||
}
|
||||
Err(error) => format_to!(s, "invalid literal: {error}"),
|
||||
}
|
||||
Some(s.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue