Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Example usage dont show in the autocomplete window #8346

Closed
1 task done
Iovans opened this issue Feb 24, 2024 · 6 comments
Closed
1 task done

API Example usage dont show in the autocomplete window #8346

Iovans opened this issue Feb 24, 2024 · 6 comments
Labels
bug [core label] popovers Feedback for tooltips, syntax hints, info popups, toasts, etc

Comments

@Iovans
Copy link

Iovans commented Feb 24, 2024

Check for existing issues

  • 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

![Screenshot 2024-02-24 alle 21 16 22](https://github.com/zed-
Screenshot 2024-02-24 alle 21 16 22

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

@Iovans Iovans added admin read bug [core label] labels Feb 24, 2024
@bennetbo
Copy link
Contributor

Not sure why, but the actual rust docs do not specify an example, you can see it here.

It works perfectly fine for i32::wrapping_rem(...), which actually has an example:
image

@Iovans
Copy link
Author

Iovans commented Feb 24, 2024

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!

@bennetbo
Copy link
Contributor

bennetbo commented Feb 24, 2024

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
image

While it works for wrapping_rem
image

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.

@bennetbo
Copy link
Contributor

Looks like this is an issue of the language server (rust-analyzer), see rust-lang/rust-analyzer#7688

@Iovans
Copy link
Author

Iovans commented Feb 24, 2024

okay thank you for tell me about it, they are fixing it right?

@maxdeviant
Copy link
Member

Closing this, since we've identified it as an upstream issue.

@JosephTLyons JosephTLyons added popovers Feedback for tooltips, syntax hints, info popups, toasts, etc and removed triage labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] popovers Feedback for tooltips, syntax hints, info popups, toasts, etc
Projects
None yet
Development

No branches or pull requests

4 participants