visuald icon indicating copy to clipboard operation
visuald copied to clipboard

Offer to 'import missing packages' like C# and Java

Open dlangBugzillaToGithub opened this issue 10 years ago • 6 comments

turkeyman reported this on 2014-12-30T01:21:08Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=13912

CC List

  • doob (@jacob-carlborg)
  • r.sagitario
  • Scellow33

Description

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 :)

dlangBugzillaToGithub avatar Dec 30 '14 01:12 dlangBugzillaToGithub

r.sagitario commented on 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...

dlangBugzillaToGithub avatar Jan 01 '15 22:01 dlangBugzillaToGithub

turkeyman commented on 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 >_<

dlangBugzillaToGithub avatar Jan 02 '15 11:01 dlangBugzillaToGithub

r.sagitario commented on 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...

dlangBugzillaToGithub avatar Jan 02 '15 13:01 dlangBugzillaToGithub

turkeyman commented on 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 :)

dlangBugzillaToGithub avatar Jun 10 '15 07:06 dlangBugzillaToGithub

doob (@jacob-carlborg) commented on 2015-06-10T11:27:34Z

In Eclipse, the IDE will automatically add missing imports if autocomplete is used to select a symbol.

dlangBugzillaToGithub avatar Jun 10 '15 11:06 dlangBugzillaToGithub

turkeyman commented on 2019-05-11T15:14:45Z

*** Issue 17151 has been marked as a duplicate of this issue. ***

dlangBugzillaToGithub avatar May 11 '19 15:05 dlangBugzillaToGithub