Skip to content

Completion list is missing re-exports from dependencies #2142

Open
@minestarks

Description

@minestarks

In many cases, the completion list is missing reexports from dependencies, which reduces the usability of libraries such as fixed_point.

REPRO

MyProj/src/Main.qs

namespace Test {
    open MyDep;
    
    operation Foo() : Unit {
        ExportedItem;    // Appears, but with auto-import edit ❌
        ReexportAlias;   // Does not appear ❌
        ReexportedItem;  // Appears, but with auto-import ❌
                         // Also, doesn't compile (#1955) ❌
    }
}

namespace Test2 {
    open SomeNS; // Does not appear ❌
}

namespace Test3 {    
    open MyDep.C.ReexportedNS; // `B` does not appear after `.` ❌
}

namespace Test4 {
    open ParentNS; // Does not appear ❌ 
}

MyProj/qsharp.json

{
  "dependencies": {
    "MyDep": {
      "path": "../MyDep"
    }
  }
}

MyDep/src/Main.qs

namespace SomeNS {
    operation ReexportedItem() : Unit {}
    export ReexportedItem;
}

namespace Main {
    operation ExportedItem() : Unit {}
     
    export ExportedItem, SomeNS.ReexportedItem, SomeNS.ReexportedItem as ReexportAlias;
}

namespace C {
    export ParentNS.ReexportedNS;
}

namespace ParentNS.ReexportedNS {
    operation ABOp() : Unit {}
}

MyDep/qsharp.json

{}

Seen in 3b32013

Additional context

Related: #1955

To capture some historical context -- there was an attempt to cover these cases in the original Completions implementation, but it required quite a few changes to the resolver. Currently, neither the HIR nor the resolver contains enough information about the reexports for the Completions module to include the reexports.

At the time I made some changes to the resolver to address some of the cases from above, but hit blockers on others. So that effort's been abandoned for a few months now.

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions