We really need a tooltip to offer to insert an appropriate import statement at the top of the module when calling a function that is not available.
C# does this very nicely. Java too.
Since this is a VS integration, I think we should mirror the C# experience and terminology.
It's a distinction between the polished C# experience and our D experience that annoys users on an almost minutely basis :)
Comment #1 by r.sagitario — 2015-01-01T22:18:05Z
C# is a pretty high bar, I'd be happy to get to the level of C++ integration. You don't get #include insertions out-of-the-box, you need extensions like VisualAssist for that...
Comment #2 by turkeyman — 2015-01-02T11:16:40Z
Do you think it's particularly hard?
I would have thought all the cool advanced helper tools would becomes a lot easier with D since everything is namespaced properly, and there's no preprocessor...
Well it's obviously not urgent anyway, but it's nice to have these things on the list.
I think import insertion would be a big win; D has a lot of modules. Try and do some string processing, you'll end up with 6 imports for different modules with string related functions.
My problem more often than not is that I can never remember which arbitrary module different phobos functions come from. A popup helper would save me from that :)
On a side note, if we were able to approach the C# experience, or at least exceeding the C++ experience, I think it would create a powerful attraction for C++ users towards D.
Mago really helps the debug experience! It feels a lot more natural now, but at least in my work where I'm always linking against C/C++ code, I can't lose the C debugger >_<
Comment #3 by r.sagitario — 2015-01-02T13:29:56Z
Let's see if Mono-D can do it, we might then be able to do it, too ;-)
More seriously, with the current rush to use selective local imports, a little more interaction might be necessary to select where to put that import. Also, adding to existing imports might be desirable...
Comment #4 by turkeyman — 2015-06-10T07:20:14Z
(In reply to Rainer Schuetze from comment #3)
> Let's see if Mono-D can do it, we might then be able to do it, too ;-)
>
> More seriously, with the current rush to use selective local imports, a
> little more interaction might be necessary to select where to put that
> import. Also, adding to existing imports might be desirable...
Yeah you're right, it's a lot more comprehensive than C# :)
I can imagine some nice solutions, but yeah, quite a few details.
There are 4 states I can imagine, global/local (ie, import placed in local function) and whole-module/single-symbol.
There would want to be logic such that single-symbol imports would be appended to a comma separated list of other symbols that may already be import from the same module.
The 4 states that the user may select may be a little awkward for ui :)
Comment #5 by doob — 2015-06-10T11:27:34Z
In Eclipse, the IDE will automatically add missing imports if autocomplete is used to select a symbol.
Comment #6 by turkeyman — 2019-05-11T15:14:45Z
*** Issue 17151 has been marked as a duplicate of this issue. ***
Comment #7 by robert.schadek — 2023-10-18T20:13:43Z