maziac / hex-hover-converter

MIT License
8 stars 3 forks source link

Do not show for Numbers without any prefix #9

Closed Vendicated closed 1 year ago

Vendicated commented 1 year ago

This could also be configurable if someone needs this without prefix

In any case, it's wrongfully adding hovers to things like methods, and it would be cool to not have these false positives image

Vendicated commented 1 year ago

image

maziac commented 1 year ago

Yeah, actually theses could also be hex numbers, therefore the false positives. But I, of course, see your point. Maybe some options are possible, e.g.:

The "F" is difficult because the "l" is interpreted as "long" (maybe the check need to be extended that the "l" is not followed by something ...)

ArjixWasTaken commented 1 year ago

i think it is safe to assume that you can't call a number as a function... (well, in the screenshot it is a function declaration and not a call, but oh well, doesn't change much)

so maybe edit the regex here image

/(?<!\w)[0-9a-fA-FbhxulULHB_]+\b(?!\()/
ArjixWasTaken commented 1 year ago

I haven't tested this regex that much, so please take it with a grain of salt.

ArjixWasTaken commented 1 year ago

My suggestion doesn't fix the false positives when declaring/using a variable though, and I doubt there is a language-agnostic way of doing that...

maziac commented 1 year ago

Maybe there could be an option for the mode: "lazy" and "strict".

maziac commented 1 year ago

I have thought about your original idea.

What about e.g.: "; Write to address 1000h(audio_port)." One could argue: there should be a space between h and (. But if not ...

Not sure if this problem can really be solved without more context.

Maybe simply fork the project and use an regex that fits better for you.

Do you mind if I close this issue?