1) The file is parsed and all the business in the code is stripped out to create a skeleton module of the code. This is to make it safe to use for introspection, though it will under some contexts cause member attributes to not be shown in the choices for auto-completion (i.e self.myattr).
2) This code is then compiled and executed in a temporary namespace for introspection.
3) If matching results for the piece of code that is being checked exist then the tips are shown.
This happens when:
1) The document you are editing is recognized as Python by Editra (i.e the syntax highlighting is python.)
2) You type a '(' or '.' in the document. Then the steps mentioned above will be performed for the code segment directly to the left of these two characters.
- Code: Select all
import sys
sys.
In this example a list of what is available in the 'sys' module will be shown after typing the '.'
- Code: Select all
path="myfile.txt"
open(
In this example the signature for the builtin 'open' function will be shown right after typing the '('.
The auto-completion can operate in most cases and can correctly show results for objects in the current file as well as any file that is imported into that file so long as the import path for that module is relative to the current document or is a system module.
The current support for this feature was written mostly as a proof of concept implementation to give me some extra tools to help with developing Editra. It will be re-written (probably completely) at some point.


