November 08, 2023
https://issues.dlang.org/show_bug.cgi?id=24234

          Issue ID: 24234
           Summary: suggest imports of known/processed symbols
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: schveiguy@gmail.com

Let's say you have a local module `foo` with a symbol `bar`.

You also have another module `baz`, which uses `bar` but does not import `foo`.

Something like:

```d
module foo;

int bar() { return 5; }
```

```d
module baz;

int fn() { return bar(); } // error, bar not defined
```

For known functions/symbols, the compiler suggests imports. If you are missing an import for `std.stdio`, and you use `writeln`, the compiler suggests the import.

But often times, you are compiling *both* `foo` and `baz`, and so the compiler knows there is a `bar`, and it can be accessed by importing `foo`. If you are already ending compilation anyway, why not give suggestions for the known symbol? You can even suggest multiple places where the symbol is defined if that is the case.

--