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:
Conrad Irwin 2025-04-23 20:51:01 -06:00 committed by GitHub
parent 8836c6fb42
commit 9d10489607
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 517 additions and 327 deletions

View file

@ -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)