gleam-lang/gleam

Import module in code action to fill missing case patterns

Open

#3,568 opened on Aug 27, 2024

View on GitHub
 (8 comments) (0 reactions) (0 assignees)Rust (960 forks)batch import
help wanted

Repository metrics

Stars
 (21,417 stars)
PR merge metrics
 (Avg merge 10d 19h) (69 merged PRs in 30d)

Description

Currently, if a user runs the "Add missing patterns" code action on this code:

case some_value.optional_field {}

They would get something like:

case some_value.optional_field {
  option.Some(_) -> todo
  option.None -> todo
}

Which is correct, but doesn't account for the fact that they need to import the gleam/option module. It would be helpful to detect this and automatically import gleam/option in this case.

Contributor guide