Skip to content

[SR-15412] Suggest SDK imports for unimported SDK types in a fix-it #57726

@typesanitizer

Description

@typesanitizer
Previous ID SR-15412
Radar rdar://problem/84830023
Original Reporter @typesanitizer
Type New Feature
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels New Feature
Assignee None
Priority Medium

md5: 7ebe3e3fbf97401162a34aea13b6a832

Issue Description:

Sometimes, one doesn't have the right import in a file, but the compiler doesn't provide a suggestion on which module to import (at least, with Xcode 13.1), it just complains that a type isn't in scope. It would be nice to do better than that, and provide a fix-it which goes hey, would you like to import MyKit.

I understand this is probably not desirable to do out-of-the-box because of perf, one would need to build an index of some kind for the entire SDK...

Without going the whole "let's index the SDK" route, another option for a v1 of this would be to look at the imports which are already present in other files, and suggest adding an import accordingly. As a bonus, this approach would work with non-SDK modules too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions