qdk icon indicating copy to clipboard operation
qdk copied to clipboard

Completion list doesn't include local variable that is later shadowed in the same scope

Open minestarks opened this issue 2 years ago • 0 comments

Introduced in #880 .

Playground link

namespace MyQuantumProgram {
    @EntryPoint()
    operation Main() : Result[] {

        // correct: completion list does not include `foo`
        let foo = 3;
        // INCORRECT: completion list does not include `foo`
        let foo = "hi";
        // correct: completion list includes `foo`
        
        return [];
    }
}

When the cursor is in between the two declarations, we should show foo in the list, with type Int. Instead, today, because we have set the "valid at" offset based on the last declaration in the scope, we don't show foo anywhere above that last declaration.

minestarks avatar Dec 08 '23 00:12 minestarks