aBothe / Mono-D

D Add-In for MonoDevelop
http://wiki.dlang.org/Mono-D
Other
113 stars 26 forks source link

Auto import feature #618

Open tcak opened 9 years ago

tcak commented 9 years ago

In Eclipse, we press on "Ctrl+Shift+O", and generally a window comes that lists what classes to import into project. Mono-D is already able to capture what unknown variables or functions are available in the code. Then I thought, if an XML, JSON, or SQLite was used to store full module name of known modules (Phobos' example), it could be possible to bring a window with a list of modules to import into project automatically. At first, defining it for even only "std.stdio" would be quite useful. Later the improvement could be done in time.

aBothe commented 9 years ago

First off: Good idea. What do you mean with 'import into project' in D terms? Referencing an include path and a library in the project build configuration? Or putting in an import package.with.symbol; for all symbols that are unknown in your currently edited code? [Edit] Or both, i.e. putting in an include path (and import-statement) to the build config when you type a class name that is even unknown to your currently edited project(s)?

I got access to all available module names and such, so the technical solution shouldn't be that difficult to realize.

tcak commented 9 years ago

I wanted to say import into current code file, not project.

Just to keep everything simple at first, inserting an line "import package.with.symbol" would enough for now. Once the base is ready, other things can be added.

Let's say "writeln" is found, but linker is complaining about it. When "Ctrl+Shift+O" is pressed, check the list with "endsWith" (ignore case for better search maybe) to match "writeln". If there are more than one match, you can ask in a window which one to import.

aBothe commented 9 years ago

I suppose, when starting the 'auto import all unresolved symbols', a list shall popup that shows the modules to import. Furthermore, single items may be deselected (like when you prefer importing a package.d instead of the actual module).