starkware-libs / cairo

Cairo is the first Turing-complete language for creating provable programs for general computation.
Apache License 2.0
1.62k stars 501 forks source link

LS: Hovers show enclosing function when hovering over variable used in a macro #6534

Open mkaput opened 1 month ago

mkaput commented 1 month ago

Empty project, just the following Cairo snippet:

use core::to_byte_array::FormatAsByteArray;

/// Converts a `felt252` to a `base16` (hexadecimal) string without padding, but including the `0x`
/// prefix.
/// We need this because Starknet Foundry has a way of representing addresses and selectors that
/// does not include 0's after `Ox`.
pub fn to_base_16_string_no_padding(value: felt252) -> ByteArray {
    let string = value.format_as_byte_array(16);
    format!("0x{}", str<caret>ing)
}

currently it shows:

Image

while it should not show anything (easier solution) or show proper hover for a variable

another example: Image

Arcticae commented 3 weeks ago

(Temporary) Solution: Display nothing instead of rubbish