API Example usage dont show in the autocomplete window
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
When i see the api docs on the autocomplete window it doesnt show the example usage
Environment
Zed: v0.123.6 (Zed) OS: macOS 14.2.1 Memory: 8 GiB Architecture: x86_64
If applicable, add mockups / screenshots to help explain present your vision of the feature
, which actually has an example:
the example that you gave me dont work because is an experimental api and that reasonable, but in my case are not experimental, it should shows the code!
Sorry, looks like I am the one that got confused there. For some reason I thought the rust doc itself is empty. Looks like there is something wrong with the rendering indeed.
Edit: VS Code doesn't seem to display it either
While it works for wrapping_rem
Maybe the markdown is malformed or the language server is having some kind of issue, but I cannot find the actual markdown source of i32::checked_abs without the macros It uses.
Here is the documentation of checked_abs
/// Checked absolute value. Computes `self.abs()`, returning `None` if
/// `self == MIN`.
///
/// # Examples
///
/// Basic usage:
///
/// ```
#[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").checked_abs(), Some(5));")]
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.checked_abs(), None);")]
/// ```
Here is the documentation of wrapping_add
/// Wrapping (modular) remainder. Computes `self % rhs`, wrapping around at the
/// boundary of the type.
///
/// Such wrap-around never actually occurs mathematically; implementation artifacts make `x % y`
/// invalid for `MIN / -1` on a signed type (where `MIN` is the negative minimal value). In such a case,
/// this function returns `0`.
///
/// # Panics
///
/// This function will panic if `rhs` is 0.
///
/// # Examples
///
/// Basic usage:
///
/// ```
#[doc = concat!("assert_eq!(100", stringify!($SelfT), ".wrapping_rem(10), 0);")] //This line is missing
/// assert_eq!((-128i8).wrapping_rem(-1), 0); //This line gets rendered
/// ```
Im not sure what #[doc ...] is doing but those lines seem to be missing when rendering the docs in zed/vscode.
As you can see in the i32::wrapping_rem docs, the last line is displayed fine for the example code, but the line above seems to be missing.
Looks like this is an issue of the language server (rust-analyzer), see https://github.com/rust-lang/rust-analyzer/issues/7688
okay thank you for tell me about it, they are fixing it right?
Closing this, since we've identified it as an upstream issue.