qdk icon indicating copy to clipboard operation
qdk copied to clipboard

Completion list is missing re-exports from dependencies

Open minestarks opened this issue 10 months ago • 0 comments

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 3b32013a6e1ff26f5d12c12116b1946eeda4bb0d

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

minestarks avatar Jan 31 '25 22:01 minestarks