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

Hover shows header comment lines #134

Closed
julio4 opened this issue Jan 4, 2025 · 2 comments
Closed

Hover shows header comment lines #134

julio4 opened this issue Jan 4, 2025 · 2 comments

Comments

@julio4
Copy link

julio4 commented Jan 4, 2025

Problem

When hovering over functions, the LSP incorrectly includes decorative comment header lines (//////) in the documentation. These should be filtered out.

Example:

    /////////////////////////////////////////////////////////////////////////
    // Transforming contained values
    /////////////////////////////////////////////////////////////////////////

    /// Maps an `Option<T>` to `Option<U>` by applying a function to a contained value (if `Some`)
    /// or returns `Option::None` (if `None`).
    ///
    /// # Examples
    ///
    /// ```
    /// let maybe_some_string: Option<ByteArray> = Option::Some("Hello, World!");
    /// // `Option::map` takes self *by value*, consuming `maybe_some_string`
    /// let maybe_some_len = maybe_some_string.map(|s: ByteArray| s.len());
    /// assert!(maybe_some_len == Option::Some(13));
    ///
    /// let x: Option<ByteArray> = Option::None;
    /// assert!(x.map(|s: ByteArray| s.len()) == Option::None);
    /// ```
    fn map<U, F, +Destruct<F>, +core::ops::FnOnce<F, (T,)>[Output: U]>(
        self: Option<T>, f: F,
    ) -> Option<U>;

Show up as:
image.png

Steps

No response

Possible Solution(s)

Modify the LSP documentation parser to only capture the top comment doc block

Notes

No response

Scarb Version

scarb 2.9.2 (5070ff374 2024-12-11)
cairo: 2.9.2 (https://crates.io/crates/cairo-lang-compiler/2.9.2)
sierra: 1.6.0
@mkaput
Copy link
Member

mkaput commented Jan 7, 2025

This is a bug in cairo-lang-doc crate. Created bug report in Cairo repository: starkware-libs/cairo#7014

@mkaput mkaput closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Cairo Language Services Jan 7, 2025
@julio4
Copy link
Author

julio4 commented Jan 7, 2025

I see, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants