Content Assistant

This is still on development, but it can already be useful. Current status is:

New content assistants added (0.9.2):

  • Implement superclass interface

  • If you do a subclass of another.
    E.g.: class Test(set): |Ctrl+1 - offers option for implementing the superclass interface, so, it gathers all methods from the class that are public (don't have underscore in the beggining) and adds a stub for each of them.

  • Make method override
  • E.g.:
    class Test(set):

    ....def | Ctrl+1 - offers option for overriding methods from superclass


    New content assistants added (0.7.1):

  • Move imports:

  • If you have some import on a non global scope, a move to global scope tip appears. It moves the current import line to the beggining of the file.

  • Surround with try..except or try..finally:

  • If you select any portion of a line (must be at least one character selected), typing Ctrl+1 will bring you surround with try..except and try..finally.
    Note: be careful on what you select to do this... it is not fool prof... if your selection is not ok, it doesn't care and tries to make it anyway.

  • Make statement new Class or Method:

  • If you are in the global scope and write a call (e.g.: NewClass(a, b)), and press Ctrl+1, the following tips will appear:
    Make this a new method and make this a new class.


    Resuming:

    Class C:

    ....def a(self):
    ........self.newMethod()| Ctrl+1 also brings some interesting assistants.

    class C:

    ....def __init__(self, param):
    ........self.newMethod()<- create new method on class C (with params if needed)
    ........................<- assign result to new local variable
    ........................<- assign result to new field

    ........a = A()
    ........a.newMethod() <- create new method on class A
    ......................<- assign result to new local variable
    ......................<- assign result to new field

    ........param.b() <- don't show anything.

    ........self.a1 = A()

    ........self.a1.newMethod() <- create new method on class A (difficult part is discovering class - still not implemented)
    ............................<- assign result to new local variable
    ............................<- assign result to new field

    ........def m(self):
    ............self.a1.newMethod() <- create new method on class A (difficult part is discovering class - still not implemented)
    ................................<- assign result to new local variable
    ................................<- assign result to new field

    ............import compiler<- move import to global context


    NewClass() <- Make this a new class
    ...........<- Make this a new method
    ...........<- assign result to new local variable
    ...........<- assign result to new field