-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Labels
Milestone
Description
Summary:
Allow a user to quickly add an import when in the context of a defintion, so that adding the import is just a keyboard shortcut away, without loosing the current context the user is in.
Details:
- User is inside a function definition and writes
Json.decodeStringand presses magic key combo - The editor is able to figure out
- That the only module that exposes
decodeStringis theJson.Decodemodule - That this module has not been already imported
- That the only module that exposes
- With that knowledge is able to add a new import declaration node to the AST with
module: "Json.Decode", alias: "Json"(and no exposing node) - The user may keep on typing with the knowledge the import is in place and that the
Jsonalias know can be safely used (and will give autocompletions etc etc upon further usage)
So you would need:
- a way to introspect all exposeds for all modules in the project (bar the ones you have already imported for the given module, and probably default imports)
- a way to figure out based on cursor position that you are in range of a top level definition
Discusion:
- Might partially be out of scope as it requires knowledge of other modules exposed functions
- For it to work, an illegal state (partially) must be supported