== Auto complete and Calltips for Python == I created this page go give an overview and get possible hints/ correction/improvements for getting and implementing good Code completition and Calltips in an (Python) programmers editor. As these to things are very useful and common nowadays (so as syntax coloring is a "must"), I want to take a critical look at it ;) The first question: how shall we call it? Autocomplete or Codecomplete or Code Completition? I favour CodeCompletion, because Autocompletion is to common and could mean any completion to help/ make text editing more efficient. At the other side, AutoComplete is the word used in Scintilla. === DrPython === In DrPython (current state) there are three modes of text completion: a) Abbreviations plugin: Based on of SciTes Abbreviations with a abbreviation file acting as template. b) FindAndComplete: Suggests an word already available in the open file. This could also be called "AutoComplete". lisa fan franz fred typing f open code completion: suggests: fan franz fred typing fr suggests: franz fred c) Plugin Code Completition == Comparison between some editors == (which I prefer, because they are written in python/wxpython apart from SciTE, because it is nice for python editing too): criteria: import module before: example: in editing code, there must be import wx before, before you get wx. code completions. sorted case sensitive: is the list sorted case sensitive (better in my opinion, if it is not) Speed triggered by key '.' (this is very comfortable) list seems to be complete leave codecompletion open after false typing (char not fit) close codecompletion after backspace when reaching first char typing case sensitive (I prefer no case sensivity) completition with: (should be standard enter and tab) variable completition: you type btn=wx.Button => next line btn. option Speed (annoying to wait until the listbox appears) case sensitive sort (off) make it an option case sensitive typing: no distinguish between direct members/variables (bold style, icons) and from base class (Screenshot) hide "internal" function, which begins with __ (on) make it an option (display somewhere "filtered" or similar and make a switch to toggle that (ignore '__', ignore '_') Exemplary in PyCrust: Include Magic Attributes Include Single Underscores Include Doublee Underscores tolerant to false typing (should not close listbox) this could be an option at the other side if it doesn't vanish automatically, this could be annoying. but why should one type something, which does not fit? At this rare cases, one can still type ESC key. launch it with typing '.' and with a hotkey (you have not to press backspace until 'wx.') == Calltips and Editors == Other people call it Intellisense. taken init string or class description or both (option) What string: tested: wx.Frame, os.path.basename === Stanis editor Spe == wx.Frame: Proxy of C++ Frame Class (Press ESC to close) (takes class docstring) os.path.basename: (p) Returns the final document of a pathname (Press ESC to close) Remark: Calltips adjustable: disable first paragraph only whole documentation nice background colour === Pycrust respectively PyShell === wx.Frame: (inserts __init__ doc string) __init__(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) -> Frame Autoinserts *args, **kwargs); (taken from __init__) os.path.basename: dirname (p) Returns the final document of a pathname (Press ESC to close) Autoinserts: p) Remark: Option Show Calltips === DrPython's Code Completion plugin === wx.Frame: Proxy of C++ Frame Class (takes class docstring) os.path.basename: Returns the final document of a pathname Remark: I don't like the intensive yellow field; rather light yellow from Pycrust If Code completions is turned off, no calltips appear (own calltips switch(?)) === Boa === wx.Frame: (inserts __init__ doc string) __init__(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) os.path.basename: no calltips appear Remark: Does not close, when typing ')' does not open, when typing '(' os.path.basename: no calltip appears === SciTE === wx.Frame: no Calltips os.path.basename: os.path.basename(??) [doc: Returns the final document of a pathname] Remark: - == What I think, good Call Tips are == Esc should close them, also when hitting ')', after return, or when focus of editor is lost or window change, cursor keys. (this is fulfilled in the 3 editors) Fast disable/enable them (pycrust); option enable by default yes/no Key to insert the actual calltips into the current cursor position (only the first line?) (tab key?) Pycrust has good Calltips. Should open, when tpying '(' and open with a hotkey. Should show the __init__ docstring (like pycrust) and maybe the class docstring extra, or about (when object creation) base class would be also interesting. class docstring ------------------ __init__ docstring example wx.Frame: """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" class Frame(TopLevelWindow): """Proxy of C++ Frame class""" --------------------------- (self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=DEFAULT_FRAME_STYLE, String name=FrameNameStr) -> Frame If there are some expression/grammatical errors (I'm no native english speaker), then please feel free to correct them. thanks.