DanielGavin / ols

Language server for Odin
MIT License
479 stars 71 forks source link

Renaming procedure parameters causes identically named struct fields to be replaced with the same token. #528

Open quatricise opened 1 month ago

quatricise commented 1 month ago

I only tested this in VS Code, the latest version as of this date. I'm not sure when this became a bug, or whether it's always been this way. To replicate the bug, create a procedure and then using the F2 command rename one of the parameters which happens to have the exact identifier as a field from any struct used in the procedure. This only replaces the token, and it doesn't rename the actual struct field in the struct definition.

Example: Before renaming parameter 'x':

random_procedure :: proc(x, y: f32)
{
    mouse.x += x
    mouse.y += y
}

After renaming parameter 'x' to 'offset_x':

random_procedure :: proc(offset_x, y: f32)
{
    mouse.offset_x += offset_x
    mouse.y += y
}

It doesn't matter where the struct lives, if outside or inside the procedure scope.