Offer "import library hint" when needed #12019
Replies: 7 comments 6 replies
-
Prior ArtI believe we are all used to our IDEs to help us managing imports. Having such a quick fix hint shouldn't be really surprising even in Enso IDE. |
Beta Was this translation helpful? Give feedback.
-
Why is Import Management Needed?
from Standard.Base import all
from Standard.Table import all
from Standard.Database import all
from Standard.AWS import all
from Standard.Google_Api import all
from Standard.Microsoft import all
from Standard.Snowflake import all
from Standard.Tableau import all
import Standard.Examples
import Standard.Visualization Conclusion: We have to stop over importing if we want to be fast! |
Beta Was this translation helpful? Give feedback.
-
Suggestion DBOf course, the next level would be to consult Suggestion DB and insert fully qualified import statement. I believe all the necessary information is already provided in the Suggestion DB, right @4e6? E.g. one can query suggestion DB for all symbols named |
Beta Was this translation helpful? Give feedback.
-
It's nothing new for GUI, as the Component Browser had auto-importing. The old version could even recognize partially-written fully qualified name, display all entries that matches, and after picking an entry add a proper import. But then the product team decides, that this is too advance a feature to be presented in Component Browser. |
Beta Was this translation helpful? Give feedback.
-
The data link mechanism also 'knows' which library provides the data link, but if it's not loaded the best it can do is display an error telling the user to add the missing import (that contains all the logic needed to 'decode' the given data link): This mechanism would benefit the data links a lot, by allowing such error to be accompanied with a 'Quick fix' button that will then enable the 'missing' data link and let the user easily continue the work. |
Beta Was this translation helpful? Give feedback.
-
@JaroslavTulach yes, the suggestions database contains the module where symbol is defined as well as the topmost module re-exporting the symbol. |
Beta Was this translation helpful? Give feedback.
-
Looks like nobody objects against the "Quick fix" button. Now we have just a small "technical" problem: we need somebody who's going to do it. @vitvakatu, guys, do you know where is the code that displays:
|
Beta Was this translation helpful? Give feedback.
-
A discussion is raging on about improving the way we deal with imports. It is a complex topic that cross cuts many areas and as such it is hard to grasp it and narrow it to something manageable. During one sleepless new year's night I had a dream that changed it all! We already have all the pieces ready, we just need a UI to glue them together!
The picture shows a simple project demonstrating what happens when one references a library type without importing it. All the information is there:
import Standard.Table
to the top of the fileCould the IDE add a Quick fix button "Import library" hint to the end of the error message? After clicking the button the IDE would add
import Standard.Table
at the top of the file. Is that possible, easy to try, @vitvakatu?If such a quick fix button was possible, it would be a great proof of possibility of import management and a fantastic tool to play with the overall system and discover what else needs changes and improvements to bring import management up to the high expectations of a dynamic live coding language like Enso!
Beta Was this translation helpful? Give feedback.
All reactions