Add features to interactive console session
Since MR !282 (merged) we have code.InteractiveConsole
and readline
in place. This enables additional features that can be implemented with ralative low effort:
- Tab-completion. A custom completer function for
readline
has to be written. This can directly run the texts/textm parser and extract the next possible tokens from the messages of the exceptions raised. https://docs.python.org/3/library/readline.html#completion https://stackoverflow.com/questions/7821661/how-to-write-code-to-autocomplete-words-and-sentences http://pymotw.com/3/readline/ - Multi-line statements. This can be achieved by the returned value of the overriden
runsource
of the base class. When it returnsTrue
(that currently does not occur) the interactive console will create on extension prompt, collect more user input and call backrunsource
again. To decide whether to returnTrue
one has to decide whether the current statement has been completed that can be again found from the exception message of the parser (or the lack of it). - Faster syntax check. This is automatically provided if we implement the two features above in the suggested way. Why is it faster? Because only the syntax of the model extension is checked, without the persistent model. This saves a lot of time, the main savings would be from retrieving the model from the database and running model processors.
Another, smaller thing that can be added is a banner with a hint about %help
magic command that should show an overview of the magics.
Edited by Ivan Kondov