Show diagnostic codes (#29296)
Closes #28135 Closes #4388 Closes #28136 Release Notes: - diagnostics: Show the diagnostic code if available --------- Co-authored-by: Neo Nie <nihgwu@live.com> Co-authored-by: Zed AI <ai+claude-3.7@zed.dev>
This commit is contained in:
parent
8836c6fb42
commit
9d10489607
13 changed files with 517 additions and 327 deletions
|
@ -215,11 +215,16 @@ impl Markdown {
|
|||
}
|
||||
|
||||
pub fn escape(s: &str) -> Cow<str> {
|
||||
let count = s.bytes().filter(|c| c.is_ascii_punctuation()).count();
|
||||
let count = s
|
||||
.bytes()
|
||||
.filter(|c| *c == b'\n' || c.is_ascii_punctuation())
|
||||
.count();
|
||||
if count > 0 {
|
||||
let mut output = String::with_capacity(s.len() + count);
|
||||
for c in s.chars() {
|
||||
if c.is_ascii_punctuation() {
|
||||
if c == '\n' {
|
||||
output.push('\n')
|
||||
} else if c.is_ascii_punctuation() {
|
||||
output.push('\\')
|
||||
}
|
||||
output.push(c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue