Komodo / KomodoEdit

Komodo Edit is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform.
http://www.komodoide.com/komodo-edit
Other
2.15k stars 301 forks source link

Auto-including for classes #278

Open Defman21 opened 9 years ago

Defman21 commented 9 years ago

I'm working on some Java apps now so I have to use Eclipse. (I'm waiting for Java support in Komodo, too :smiley:). And I really like the feature: auto-including classes. For example if I start typing "List" and press Enter, Eclipse will automatically include java.util.List in the top of the file (import java.util.List;). So I want to see something like that in Komodo for Python and PHP files. E.g. I start typing "MyClass" in a php file (namespace for MyClass is \app\utils\MyClass). Komodo should show this class in auto-complete popup. And when I pick that for auto-complete - Komodo should add use \app\utils\MyClass in the top of the file I'm editing.

Naatan commented 9 years ago

I'm waiting for Java support in Komodo, too

Don't hold your breath :p

To the point though - good idea :) Added to Backlog for now but might fit this into 9.2.

Defman21 commented 9 years ago

Hmm, in case when there are two files with the same class names but different namespaces, Komodo should show the namespace in auto-complete popup.

Example

Code Structure:

- root
-- app
--+ App.php
--- utils
---+ Test.php (class - Test, namespace - \app\utils)
--- hooks
---+ Test.php (class - Test, namespace - \app\hooks)

I'm working with the file App.php, I'm typing Test to get auto-complete. The popup should looks like that:

\app\utils\Test
\app\hooks\Test

If I pick the first one, Komodo should add use \app\utils\Test; to the top of the file. If I pick the second one, Komodo should add use \app\hooks\Test; to the top of the file.

In both cases Komodo also should add Test to the cursor position, like

class MyTest extends Te %cursor%

Komodo should respect what uses are included already, so no additional copies of uses should be putted in the file I'm working on. Also if there is an include (use keyword) with the same class name and I want to include \app\hooks\Test, not \app\utils\Test, e.g.

use \app\utils\Test;

class HookTest extends Te %cursor%

Komodo shouldn't insert use \app\hooks\Test;, just put \app\hooks\Test in the cursor position. Looks like a lot of logical work, huh.