Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Code action to open namespace inserts declaration at wrong location when no other opens present #394

Open
@cgranade

Description

@cgranade

Describe the bug

When using a code action to add a missing open declaration to a source file that does not yet contain any open statements (including Microsoft.Quantum.Intrinsic), the new open declaration is included at the wrong location.

To Reproduce

Start with the following source file:

namespace Microsoft.Quantum.Arrays {

    /// # Summary
    function All<'T> (predicate : ('T -> Bool), array : 'T[]) : Bool {
       return Fold(And, true, Mapped(predicate, array));
    }

}

Select the available code action at And to obtain:

namespace Microsoft.Quantum.Arrays {

    /// # Summary
    open Microsoft.Quantum.Logical;


    function All<'T> (predicate : ('T -> Bool), array : 'T[]) : Bool {
       return Fold(And, true, Mapped(predicate, array));
    }

}

Expected behavior

namespace Microsoft.Quantum.Arrays {
    open Microsoft.Quantum.Logical;

    /// # Summary
    function All<'T> (predicate : ('T -> Bool), array : 'T[]) : Bool {
       return Fold(And, true, Mapped(predicate, array));
    }

}

System information

  • Version of the NuGet package or extension for which the problem occurs: 0.11.2003.2506
  • Your operating system and .NET Core version: Windows 10, .NET Core SDK 5.0.100-preview.1.20155.7
  • For issues with extensions, the version of the IDE for which the problem occurs: VS Code 1.43.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: editorExtensions for Visual Studio and Visual Studio CodebugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions