question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement add-import-statement intention

See original GitHub issue

Feature Proposal

Intention Action: Add Import Statement

When the cursor is over an unresolved reference which could be resolved by importing a module in the project, an intention should be provided to easily add the import.

Details

  • We should look for candidate modules in the user’s source files as well as from elm-package.json. I think this is already handled by the plugin since we treat elm-stuff as a source-root.
  • If the selected element is a “dotted” name (e.g. String.length), then just the module name should be imported (e.g. import String)
  • If the selected element is a “bare” name (e.g. length), then the value’s name itself should be imported (e.g. import String exposing (length))

The last example, length, would presumably have many candidates. The user should be shown the list of candidate modules to select from.

Related Work

  • optimize imports
  • convert between importing a value name in a qualified manner (String.length) and unqualified (length)
  • assuming that we extend code completion to present currently-unresolvable-references, selecting such a result would add an import in a manner similar to this intention
  • add-to-exports (see #18)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
durkiewiczcommented, Sep 13, 2016

@klazuka The feature is released. I’ve also made master branch the master so you don’t need to worry about Elm 0.16 anymore.

0reactions
klazukacommented, Sep 10, 2016

Done pending release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implementation intention - Wikipedia
An implementation intention is a self-regulatory strategy in the form of an "if-then plan" that can lead to better goal attainment, as well...
Read more >
Achieve Your Goals: The Simple Trick That Doubles Your ...
Research has revealed a simple strategy that you can use to achieve your goals ... Broadly speaking, the format for creating an implementation...
Read more >
Implementation Intention Explained: How to DOUBLE YOUR ...
What is an implementation intention ? Simply put: This is a strategy you can use to follow through with the goals that you...
Read more >
Code Quality Assistance Tips and Tricks, or How to Make Your ...
... with the use of PyCharm's code intelligence features. ... Next, press Alt+Enter and choose the intention action Create class 'Solver':.
Read more >
Implementation Intentions - Use This Simple Formula To Build ...
In this article you will learn how implementation intentions can help you to form new habits quickly and effectivly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found